AutoMount SMB Share when VPN connects

pbetancourth
New Contributor

We currently use Cisco AnyConnect and are trying to see if there is any method to have a Network Share mount when VPN connects. Does anyone have any experience with this or has tried doing it?

4 REPLIES 4

alexjdale
Valued Contributor III

I haven't done this, but we were looking into doing something else when VPN connects (fixing /etc/resolv.conf, which our VPN doesn't modify on connecting, causing nslookup and other commands to not work properly).

My plan was to create a launchdaemon plist that would watch for network changes, then run a script that would look for the VPN connection (grep for utun0 in the results of an ifconfig) and then echo out a new /etc/resolv.conf. In your case, this could mount the share if it is not mounted.

tkimpton
Valued Contributor II

I use junipers Sslvpn network connect. I then use a launchagent to run a bash script (with watch paths to the library's system configuration)apple scripted app to mount network shares as the logged in user.

When state changes the app is opened and the drives map.

Hope that helps a bit, I know it may not be exactly what you want, but you could try something similar. :)

pbetancourth
New Contributor

This might be one way of doing this. I'll test when I am able and will let you know results. Thanks guys!!

bentoms
Release Candidate Programs Tester

It's not automated, but we run an AppleScript app to map drives, people run it after a VPN connection.. Enter their Username & password (as will not have a Kerberos ticket) & the drives map.

http://macmule.com/2011/09/08/how-to-map-drives-printers-based-on-ad-group-membership-on-osx/

But, if you wish to automate it.. In Casper v9 there is a policy trigger for "Network Change State."

I'm guessing you could create a policy, which is scoped to your VPN's network segment & using the "network change state" trigger that would run a script to mount the drive(s).