mirror of
https://github.com/hwdsl2/openvpn-install.git
synced 2024-07-05 03:05:52 +02:00
Fix resolv.conf detection
- Apply upstream change Nyr/openvpn-install commit d28c8e7. - Some systems have other DNS servers along with 127.0.0.53 in /etc/resolv.conf.
This commit is contained in:
parent
56c3d97661
commit
97635f7cb6
|
@ -344,13 +344,13 @@ server 10.8.0.0 255.255.255.0" > /etc/openvpn/server/server.conf
|
||||||
1|"")
|
1|"")
|
||||||
# Locate the proper resolv.conf
|
# Locate the proper resolv.conf
|
||||||
# Needed for systems running systemd-resolved
|
# Needed for systems running systemd-resolved
|
||||||
if grep -q '^nameserver 127.0.0.53' "/etc/resolv.conf"; then
|
if grep '^nameserver' "/etc/resolv.conf" | grep -qv '127.0.0.53' ; then
|
||||||
resolv_conf="/run/systemd/resolve/resolv.conf"
|
|
||||||
else
|
|
||||||
resolv_conf="/etc/resolv.conf"
|
resolv_conf="/etc/resolv.conf"
|
||||||
|
else
|
||||||
|
resolv_conf="/run/systemd/resolve/resolv.conf"
|
||||||
fi
|
fi
|
||||||
# Obtain the resolvers from resolv.conf and use them for OpenVPN
|
# Obtain the resolvers from resolv.conf and use them for OpenVPN
|
||||||
grep -v '^#\|^;' "$resolv_conf" | grep '^nameserver' | grep -oE '[0-9]{1,3}(\.[0-9]{1,3}){3}' | while read line; do
|
grep -v '^#\|^;' "$resolv_conf" | grep '^nameserver' | grep -v '127.0.0.53' | grep -oE '[0-9]{1,3}(\.[0-9]{1,3}){3}' | while read line; do
|
||||||
echo "push \"dhcp-option DNS $line\"" >> /etc/openvpn/server/server.conf
|
echo "push \"dhcp-option DNS $line\"" >> /etc/openvpn/server/server.conf
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user