Fix unbound setup for existing installations
This commit is contained in:
parent
d496ed9f5c
commit
09f89cd3d8
1 changed files with 8 additions and 9 deletions
|
|
@ -176,27 +176,26 @@ private-address: ::ffff:0:0/96" >> /etc/unbound/unbound.conf
|
||||||
else
|
else
|
||||||
echo ""
|
echo ""
|
||||||
echo "Unbound is already installed."
|
echo "Unbound is already installed."
|
||||||
echo "You can allow the script to configure it automatically for OpenVPN integration:"
|
echo "You can allow the script to configure it in order to use it from your OpenVPN clients"
|
||||||
echo "an 'include:' statement will be added to 'unbound.conf' with the necessary changes in a separate 'openvpn-server.conf' file."
|
echo "We will simply add a second server to /etc/unbound/unbound.conf for the OpenVPN subnet."
|
||||||
echo "No other changes are made to the current configuration."
|
echo "No changes are made to the current configuration."
|
||||||
|
|
||||||
while [[ $CONTINUE != "y" && $CONTINUE != "n" ]]; do
|
while [[ $CONTINUE != "y" && $CONTINUE != "n" ]]; do
|
||||||
read -rp "Apply configuration changes? [y/n]: " -e CONTINUE
|
read -rp "Apply configuration changes? [y/n]: " -e CONTINUE
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ $CONTINUE = "y" ]]; then
|
if [[ $CONTINUE = "y" ]]; then
|
||||||
# Add include: statement
|
|
||||||
awk '{ print } !flag && /server:/ { print " include: /etc/unbound/openvpn-server.conf"; flag = 1 }' /etc/unbound/unbound.conf > /etc/unbound/unbound.conf
|
|
||||||
|
|
||||||
# Add OpenVPN integration
|
# Add OpenVPN integration
|
||||||
echo 'interface: 10.8.0.1
|
echo 'server:
|
||||||
access-control: 10.8.0.1/24 allow' > /etc/unbound/openvpn-server.conf
|
interface: 10.8.0.1
|
||||||
|
access-control: 10.8.0.1/24 allow' >> /etc/unbound/unbound.conf
|
||||||
|
|
||||||
# Restart the service
|
# Restart the service
|
||||||
systemctl restart unbound
|
systemctl restart unbound
|
||||||
else
|
else
|
||||||
echo "OpenVPN will be configured to use 10.8.0.1 IP for clients DNS"
|
echo "OpenVPN clients will be configured to use 10.8.0.1 as DNS resolver."
|
||||||
echo "You need to manually configure Unbound to listen on this interface and accept connections from the subnet"
|
echo "You need to manually configure Unbound to listen on this interface and accept connections from the subnet."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue