Q: VPN fails when rebooted
I'm having a peculiar problem with the Server VPN Service on Yosemite.
Whenever I reboot the Mac the VPN will not allow access. The key error message in the System log when a user tries to connect, from what I can tell, is
racoon[266]: not acceptable Identity Protection mode
After a lot of experimenting I have discovered that after a reboot if I simply use the Server app to turn off the VPN, wait a few seconds, then turn the VPN service back on then the VPN service works fine. I am using an account created just for VPN access (e.g. Home Folder is "None - Services Only". Regular local user accounts are not part of the VPN permissions list.
Once I go through this process the VPN seems to work just fine until the next reboot.
This is a significant issue for me. Any advice on how to fix this would be greatly appreciated!
I am running Yosemite 10.10.2 with Server 4.0.3.
Posted on Mar 17, 2015 5:24 PM
OK, this solution works for me. First, create this script in /usr/local/bin and call it restartvpn.sh:
#!/bin/sh
#
# The "live" version of this script lives in /usr/local/bin
#
# In Yosemite and Server 4.0.x the racoon daemon fails to start correctly when there is a reboot
# It gives an error that it can't bind to an address
# The solution is to turn the VPN off and then back on, which clears this up
# That can be done manually but it's easy to forget when there is a reboot
# so this tries to automate that as a launchctl script
# If this runs immediately serveradmin returns an error and the script doesn't work so sleep some first
sleep 60
# Stop the VPN
/Applications/Server.app/Contents/ServerRoot/usr/sbin/serveradmin stop vpn
echo Sleep until things settle down
sleep 180
# Now start it back up
echo Restarting VPN
/Applications/Server.app/Contents/ServerRoot/usr/sbin/serveradmin start vpn
echo VPN restart complete
Then create this plist file /Library/LaunchDaemons/yourdomain.restart.plist. Note you should put a domain in the name, instead of yourdomain, in the plist file name and in the Label value in the plist but it isn't mandatory AFAIK
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>yourdomain.restartvpn</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/restartvpn.sh</string>
</array>
<key>StandardOutPath</key>
<string>/var/log/restartvpn.log</string>
<key>StandardErrorPath</key>
<string>/var/log/restartvpn.log</string>
<key>RunAtLoad</key>
<true/>
<key>ExitTimeOut</key>
<integer>300</integer>
<key>LaunchOnlyOnce</key>
<true/>
</dict>
</plist>
Now load it using
sudo launchctl load -w /Library/LaunchDaemons/yourdomain.restartvpn.plist
When you login after reboot this should get the VPN working. It logs to /var/log/restartvpn.log so you can watch the progress. Both sleeps seem necessary though I didn't experiment to see how short they could be.
I'm no expect at these launch daemons but this seems to work and I don't think there are any bad side effects. If there are, don't blame me
Posted on Mar 21, 2015 6:32 PM