[OpenVPN home] [Date Prev] [Date Index] [Date Next]
[OpenVPN mailing lists] [Thread Prev] [Thread Index] [Thread Next]
Google
 
Web openvpn.net

Re: [Openvpn-users] Adding remote DNS server for OS X client



In <44B80AD5.6070809@xxxxxxxxxxxxxxxxx>, Stephen Woolerton <sdw2@xxxxxxxxxxxxxxxxx> typed:
> Hi All,
> 
> Looking through the list and it appears setting that questions re 
> setting DNS for an OS X client have been asked a few times but I haven't 
> seen a response.
> 
> http://www.macosxhints.com/article.php?story=20050621051643993
> http://www.afp548.com/article.php?story=20050703052052393
> http://njr.sabi.net/2005/08/04/overriding-dns-for-domains-in-os-x-tiger/

I'm pretty sure I posted my OSX solution to the openvpn list.

> Some googling later and as per the links above I find I can set DNS 
> servers from the command line. The issue I have is that setting DNS only 
> works using sudo. However, Tunnelblick doesn't have a mechanism to ask 
> for a sudo password. I find that if I add a script to add in the remote 
> site DNS server at time of connection then Tunnelblick fails on opening 
> the connection (icon stops flashing), presumably because of the sudo 
> requirement.

Hmm. TunnelBlick normally runs priveleged, and starts openvpn
priveleged by default. I use a different solution, and it works
fine. I am using the 3.0rc of tunnelblick (got to - got three vpn's on
my box).

> I've included a script to set the DNS server below. If someone could 
> give an idea of how to get around or work with the sudo script 
> requirement and Tunnelblick it would be very helpful.

I think mine is a bit simpler - mostly because use the superresolver
instead of scutil. You might try it, and see if it works. If not, you
might consider showing us your client's openvpn config file.

#!/bin/bash
# ${!...*} is a bash-ism, so...

# This script sets up an OS "super resolver" (see "man resolver")
# resolv.conf file for the domain named by the OpenVPN config file for
# the connection coming up.  The config file is assumed to be named
# "domain.name.conf". The server should push a DNS ip address via
# 'push "dhcp-options DNS address"'.

dns=dns
for opt in ${!foreign_option_*}
do
    eval "dns=\${$opt#dhcp-option DNS }"
    if [ "$dns" != "dns" ]
    then
        cat >/etc/resolver/$(basename $config .conf) <<EOF
nameserver $dns
timeout 10
EOF
        exit 0
    fi
done


	<mike

-- 
Mike Meyer <mwm@xxxxxxxxx>		http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.

______________________
OpenVPN mailing lists
https://lists.sourceforge.net/lists/listinfo/openvpn-users


Warning: require_once(../../../archive_common.php) [function.require-once]: failed to open stream: No such file or directory in /home/openvpn/domains/openvpn.net/public_html/archive/openvpn-users/2006-07/msg00097.html on line 237

Fatal error: require_once() [function.require]: Failed opening required '../../../archive_common.php' (include_path='/usr/local/lib/php') in /home/openvpn/domains/openvpn.net/public_html/archive/openvpn-users/2006-07/msg00097.html on line 237