Skip to content

Instantly share code, notes, and snippets.

@ktosiek
Created September 11, 2020 16:16
Show Gist options
  • Save ktosiek/88bdaa331563164125a5474735cbc8f8 to your computer and use it in GitHub Desktop.
Save ktosiek/88bdaa331563164125a5474735cbc8f8 to your computer and use it in GitHub Desktop.
Workaround for DNS being down after disconnecting from SSTP VPN

Workaround for DNS being down after disconnecting from SSTP VPN

When to use?

When you are using network-manager-sstp with Automatic DNS configuration, but don't have resolveconf installed. This will trigger the bug, and make your /etc/resolv.conf readable only by root.

How to use this fix?

Copy content of ip-up.local.sh to /etc/ppp/ip-up.local, and sudo chmod +x /etc/ppp/ip-up.local.

Why it works?

ppp has a whole up/down scripts system, which is pretty handy when you use it by hand. But when run from NetworkManager, this gets in the way - and some hooks explicitly bail when they detect they run under NM. They detect it by looking at "ipparam" - a ppp parameter that's passed straight to the scripts. The problem is - they only look for values generated by the network-manager-pptp plugin, and the SSTP plugin generates slightly different ones.

This workaround replaces the whole "run the interface setup scripts" stage with one that ignores scripts when running under NM's SSTP plugin.

#!/bin/sh
# Workaround for https://bugs.launchpad.net/debian/+source/ppp/+bug/1778946 (comment #33)
case "$6" in
nm-sstp-service-*)
exit 0
;;
esac
run-parts /etc/ppp/ip-up.d \
--arg="$1" --arg="$2" --arg="$3" --arg="$4" --arg="$5" --arg="$6"
# if pon was called with the "quick" argument, stop pppd
if [ -e /var/run/ppp-quick ]; then
rm /var/run/ppp-quick
wait
kill $PPPD_PID
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment