Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing Captive Network Assistant on MacOSX to connect to VPN
    text
    copied!<p>Apple introduced a new "feature" with MacOSX Lion (10.7) which is called Captive Network Assistant. In my opinion its just a useless and annoying feature. It's aim is to help you login to networks which require authentication (see: <a href="http://en.wikipedia.org/wiki/Captive_portal" rel="noreferrer">Captive Portal</a>), but the feature doesn't store cookies or saves passwords.</p> <p>In my university we also use such a network which requires users to login. The login doesn't happen via browser but via VPN, which makes the Captive Network Assistant completely useless and annoying.</p> <p>So im posting a Guide here on how to replace this "feature" with something actually useful and i didn't want it to get lost and be useful to other people</p> <p><strong>#1.</strong> create a bash script with name "Captive Network Assistant", paste the following code inside and replace your file with the same at <em>/System/Library/CoreServices/Captive Network Assistant.app/Contents/MacOS/</em></p> <pre><code>#!/bin/bash scriptlocation="/System/Library/CoreServices/Captive Network Assistant.app/Contents/MacOS/vpn.scpt" osascript "$scriptlocation" </code></pre> <p><strong>#2.</strong> create an applescript with name "vpn.scpt", place it under the path mentioned in the bash-script and place the following code inside:</p> <pre><code>set wlanssid to do shell script "networksetup -getairportnetwork en1 | cut -c 24-" connectVPN(wlanssid) on connectVPN(SSID) tell application "System Events" tell current location of network preferences local VPNService if (SSID = "XYZXYZ") then --WLANNAME set VPNService to service "XYZXYZ-VPN" --VPNNAME set isConnected to connected of current configuration of VPNService if not isConnected then connect VPNService end if end if end tell end tell end connectVPN </code></pre> <p>This script will be executed everytime your computer connects to a "Captive Network" and if the SSID of the WLAN is called "XYZXYZ" it will start the VPN-Connection with name XYZXYZ-VPN</p> <p>The script can be modified to support multiple captive networks.</p> <p>Also its possible to add Growl-Notifications to the Script. My complete Script looks like this: <a href="http://pastebin.com/Rtp9EqQR" rel="noreferrer">http://pastebin.com/Rtp9EqQR</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload