MacOS – SSTP Client with Search Domains

dnsmacosNetworkvpn

I am connecting to my work's vpn via sstp-client on my mac.
Everything is working except that I cannot use short names in urls.

For example, if I type "servera" it doesn't resolve to anything. If I use "servera.work.domain" it will work fine.

When connected to the vpn, if I look at etc/resolv/conf I can see there are only the two nameservers and no domain listed. When disconnected, the search domains reappear in the file.

Here is the command used to invoke sstp from a script.

sudo sstpc --log-stderr --log-level 4 --cert-warn --user $UN --password $PW $SERVICE_URL usepeerdns require-mschap-v2 noauth noipdefault defaultroute refuse-eap noccp

I have also tried adding domain work.domain to the end of the command without luck.

Any ideas how to get this working?

Best Answer

Modify the sstpc command to have pppd call a script like so.

sudo sstpc --log-stderr --log-level 4 --cert-warn --user $UN --password $PW $SERVICE_URL call myScript

Then use the terminal to create the script. I believe this file needs execute permissions but I"m not 100% sure on that...

sudo touch /etc/ppp/peers/myScript

This script should contain all of the pppd options needed for the vpn connection. In my case I used this.

usepeerdns 
require-mschap-v2 
noauth 
noipdefault 
defaultroute 
refuse-eap 
noccp 
domain work.domain

The key is the last option domain. For some reason we are unable to add it via the command line, but by using this file we can set the proper search domain.