Got a tip for us? Let us know
|
|||||||
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
|
#1 |
|
Automatically log into VPN (Cisco) when connecting to certain wireless networks
Hi,
so my University uses the lovely Cisco VPN Client. Easy to get it working, not a big deal, but it annoys me that I need to start it manually every time I switch wifi networks and such. Is there a way to automate this? I want to connect to the VPN whenever the Airport logs into one of the University's wifi networks. The Cisco client also supports command-line mode, so I could write a script for that. But the big question is: is there a "connected to wifi network" event I can hook into using AppleScript or something. Sorry if this is a dumb question, I just switched from PC to Mac on Thursday
__________________
Hello. I'm a signature virus. Please copy me to other signatures to help me spread :] |
|
|
|
0
|
|
|
#2 |
|
I'm sure there is a way to write this in Applescript.
However, if you are roaming across networks when connected, it makes perfect sense why the client is dropping you. If the university is using IKE, part of the initiation/configuration of the tunnel is to record the remote address. When your address changes, the tunnel is destroyed to remove any possibility of a hacking attempt. |
|
|
|
0
|
|
|
#3 |
|
True, and that's okay. What I don't want is to start the VPN Client manually and make it connect. It should happen automatically whenever I connect to one of the university's access points. That's why I was asking whether it would be possible to write an AppleScript or download a tool / daemon / whatever that can execute another script which establishes the VPN connection as soon as Airport logs into the wireless network.
__________________
Hello. I'm a signature virus. Please copy me to other signatures to help me spread :] |
|
|
|
0
|
|
|
#4 | |
|
Quote:
it probably possible, but the reason why it just doesn't do it is because of security the reason. They want to force you to go through the motion because that is a more method of access is more secure. |
||
|
|
0
|
|
|
#5 |
|
I found out I can add entries to /System/Library/SystemConfiguration/Kicker.bundle/Contents/Resources/Kicker.xml which is called on every network change, so I'll just add a script in there that checks if I'm in university (dunno yet if I'll do this via access point detection or simply by querying the current location), and if so, start the vpn client. I'll let you guys know if this works
__________________
Hello. I'm a signature virus. Please copy me to other signatures to help me spread :] |
|
|
|
0
|
|
|
#6 |
|
Okay guys, I solved this one. This is how it works:
__________________
Hello. I'm a signature virus. Please copy me to other signatures to help me spread :] |
|
|
|
1
|
|
|
#7 |
|
One question though, when you connect to the server, does your university post a message? Something like Welcome to xyz, use this profile for this and that. This is at least something my universities do and I always have to either type "y" in the cli or hit return using the GUI. If I could get arount responding to this message, automation would be great. Because if I don't respond I get a time out and the connection gets cancelled.
|
|
|
|
0
|
|
|
#8 | |
|
Quote:
__________________
Hello. I'm a signature virus. Please copy me to other signatures to help me spread :] |
||
|
|
0
|
|
|
#9 |
|
Thanks a TON for figuring this out! I've been looking for a way to do this through AppleScript or Automator, but this looks like it should work just as well.
EDIT: hmm... how do you connect to a VPN that has both group and individual authentication? In other words, when I use the GUI client, it connects using the stored profile, but then I have to enter my network username (usually filled in) and password. There doesn't seem to be any way to store this, AFAICT.
__________________
I bring order to chaos. You are in chaos Windows, you are the contradiction, a bug wishing to be an OS. Visit Softyards Software NEW DEFINITION OF GEEK Like politics, free speech, computers, entertainment, and more? Join us at Wordforge.net Last edited by GeeYouEye; Dec 2, 2005 at 05:46 PM. |
|
|
|
0
|
|
|
#10 | |
|
Quote:
Note that I'm using Code:
if [ $ssid = "somenetwork" -o $ssid = "anotherSSID" ] There's a caveat, though: you can't really disconnect from VPN because disconnecting will result in a network configuration change, which again starts the script and establishes a connection. So if you want to get out of the network, you have to disable Airport or log out from the wireless network altogether. Should not be a big deal, though, since you usually have to be on VPN to use the network at all. I don't have figured out yet how to be notified only on Airport connection changes. And, as I said, it doesn't always work right after system startup. It should not be a problem since usually, you don't boot your computer but just wake it up from sleep, where it always works like a charm. I'm soooooo glad I found out how this works. I'm really sorry for all those Linux guys sitting around me in front of their ugly, uncool laptops, entering 20+ lines on the console to log in to wireless and VPN
__________________
Hello. I'm a signature virus. Please copy me to other signatures to help me spread :] |
||
|
|
0
|
|
|
#11 | |
|
Quote:
__________________
Hello. I'm a signature virus. Please copy me to other signatures to help me spread :] |
||
|
|
0
|
|
|
#12 |
|
My Ongoing Solution to Cisco VPN
About a year ago I asked that very question (along with others regarding Cisco VPN). I started creating apple scripts and tried bash scripts, all sucked. So I moved on to creating a full App. A new interface to Cisco's VPN Client. I was still in the learning process of Cocoa, so I shared my idea with a hard core programmer (Gorman) and he did the coding in cocoa.
The "VPNMenu" is a app that computicates with the VPN Driver (through Cisco API's) that installs when you install the Cisco VPN Client, version 4.7 of the client is required to use this app. This app is a Status Item (in Menu bar) that allows you to store your username and password in prefferences (keychain). VPNMenu also has a feature to Auto-connect, to a particular domain, or to all connections. It detects the Domain IP or name from the DHCP server and decides if it should connect to the VPN. There is even a few more features. Now this client is still in very early stages. It has flaws, but don't complain about them, download the source and fix them. Then post the fix. You can download the VPNMenu here at: http://niumug.org/projects/vpnmenu This is the first time I think the client has been made "public" so comment on it, tell me what you think. The download is currently being hosted through NIU Mac User Group, which is in the process of becoming an offical Mac User Group. |
|
|
|
0
|
|
|
#13 |
|
1) For those of you who require a user login/password there are command line options for that:
vpnclient connect profilename user username password password Of course the password will be easily visible to anyone who has access to the script, so keep that in mind... 2) I can't get the VPNMenu to work for some reason. It gives me errors -10 and -17. I'll try again later, our VPN server is really flakey. |
|
|
|
0
|
|
|
#14 |
|
VPNMenu requires 4.7
OK, a few things to check. For some reason (haven't figured out yet), in the testing I have done, You MUST have Cisco VPN Client 4.7 (which I think is a good thing). If you have that version installed (or higher) and provide the right username and passwd with the right profile, this client should work. Test the Cisco supplied interface, or the command line client, if it works, the VPNMenu client should work. After doing all that, and it still does not work, post the errors you get and the clients reaction (animation effects and such).
Last edited by newtonick; Dec 3, 2005 at 01:09 AM. |
|
|
|
0
|
|
|
#15 |
|
Thank you for the kicker code. I had something like this running in an brute force infinite loop.
As for typing "y", you can do that with "yes | vpnclient connect ..." |
|
|
|
0
|
|
|
#16 |
|
VPNMenu is extremely slick
It's really very nice. Stores your domain credentials and lets you connect instantly. The Cisco GUI is quite easy, but this is really, really easy. Thanks for this.
|
|
|
|
0
|
|
|
#17 |
|
Using Kicker
I'm trying to adapt this technique to adjust my default printer as I move between office and home. I have a shell script, called set_default_printer, which does the right thing when called, but I haven't been able to get it invoked when my powerbook wakes up. I added the following to Kicker.xml:
<dict> <key>execCommand</key> <string>/Users/leonard/Source/bin/set_default_printer</string> <key>execUID</key> <integer>501</integer> <key>keys</key> <array> <string>Setup:</string> <string>State:/Network/Global/IPv4</string> </array> <key>name</key> <string>SelectPrinter</string> </dict> But it doesn't seem to be invoked when I wake the machine. And unfortunately, I don't understand what these various strings are supposed to do. Any suggestions what to try, or where to look? Thanks. |
|
|
|
0
|
|
|
#18 |
|
I think you're missing the / behind Setup:
|
|
|
|
0
|
|
|
#19 |
|
Has anyone figured this out for Leopard, yet? The Kicker bundle appears to be gone.
|
|
|
|
0
|
|
|
#20 |
|
hi,
kind of a long-term thread.. is there a better way known after that long time? maybe a tool which can auto-connect to a VPN? greetings.. |
|
|
|
0
|
|
|
#21 |
|
This doesn't handle the automation part on network change, but the magic incantation with Cisco VPN Client 4.9 to eliminate pwd prompt is:
open /Applications/VPNClient.app --args -c -user YourUsername -pwd YourPassword ProfileNameToConnect I haven't figured out yet how I can make it disconnect or quit cleanly (I can ask it to quit via Applescript, but it pops a "Connection active/do you wish to terminate alert". |
|
|
|
0
|
|
|
#22 | |
|
How can I do this on my new iPhone4 OS 4.1 which is jailbroken already?
Quote:
Any suggestions? Thanks! |
||
|
|
0
|
![]() |
|
«
Previous Thread
|
Next Thread
»
Similar Threads
|
||||
| thread | Thread Starter | Forum | Replies | Last Post |
| iBook G3 Not Connecting To Wireless Networks. | Goftrey | PowerPC Macs | 13 | May 28, 2013 03:50 PM |
| Wireless Internet connection is not connecting automatically | Nerdy Keith | iMac | 3 | May 25, 2013 08:43 PM |
| Cisco modem/router plus AirPort Extreme separated networks | edunon | Mac Peripherals | 5 | Mar 25, 2013 01:44 PM |
| Cisco VPN on 10.8 Mountain Lion | Ripmax2000 | OS X 10.8 Mountain Lion | 14 | Mar 16, 2013 03:53 PM |
| Cisco IPsec VPN & iOS 6 | Mastidon | iOS 6 | 2 | Sep 24, 2012 03:18 PM |
|
All times are GMT -5. The time now is 03:31 AM.









Linear Mode
