Re: openvpn in command line using MAC OSX

3,410 views
Skip to first unread message

Jonathan K. Bullard

unread,
Nov 7, 2012, 7:07:19 AM11/7/12
to tunnelbli...@googlegroups.com, junp...@gmail.com
I think the cause of the error is that the tun/tap kext is not loaded. Tunnelblick looks to see if the kext appropriate for the configuration is loaded, sets a bit in the openvpnstart command line to load it if necessary, and unloads it when done.

Your best bet is probably to let Tunnelblick do all the work, and send AppleScript commands to Tunnelblick to connect/disconnect, etc. See AppleScript Support for details.

An alternative is to use Tunnelblick to get the connection working properly, then copy the command line that Tunnelblick uses to start openvpnstart and use that. (The command line appears in Tunnelblick's log.)

Take a look at https://groups.google.com/d/topic/tunnelblick-discuss/uvX2Ub4XCoo/discussion to see some of the pitfalls of using openvpnstart directly. You have to enter username/password for the VPN from the command line, too, for example. OpenVPN is not built to allow usernames/passwords in files by default, and Tunnelblick builds OpenVPN with the default settings.

On Wed, Nov 7, 2012 at 6:11 AM, Syntax wrote

Hello,

Im trying to use command line to connect to a vpn server. Could someone help me? I'm getting this error:

Cannot allocate TUN/TAP dev dynamically
Exiting due to fatal error

What I did was:
cd /Applications/Tunnelblick.app/Contents/openvpn-2.3-alpha1/
./openvpn "configuration file"      (I copied the configuration file to this directory)

I already tried to run the openvpnstart start but same error...

--
You received this message because you are subscribed to the Google Groups "tunnelblick-discuss" group.
To view this discussion on the web visit https://groups.google.com/d/msg/tunnelblick-discuss/-/_Tax0p9H-ngJ.
To post to this group, send email to tunnelbli...@googlegroups.com.
To unsubscribe from this group, send email to tunnelblick-dis...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/tunnelblick-discuss?hl=en.

Syntax

unread,
Nov 7, 2012, 7:29:22 AM11/7/12
to tunnelbli...@googlegroups.com
thanks..i think that's a good suggestion to use openvpnstart.i tinkered a bit and also thought that the 2 kext files were not loaded.

using AppleScript is not an option for me as i need to use commandline since I am automating the vpn connect after some process in our build system.

I appreciate the reply.It's a big help.

Jonathan K. Bullard

unread,
Nov 7, 2012, 7:34:06 AM11/7/12
to tunnelbli...@googlegroups.com, junp...@gmail.com
Sorry about the misunderstanding: you can run AppleScripts from the command line, using OS X's osascript commmand. Read the osascript man page or search for examples.


--
You received this message because you are subscribed to the Google Groups "tunnelblick-discuss" group.

Syntax

unread,
Nov 7, 2012, 7:46:04 AM11/7/12
to tunnelbli...@googlegroups.com
Hi, indeed I can run applescripts in commandline and have already tried it and does not work. I thnk it is because the commands I am going to set are going to be performed by a build agent as build steps so the change vpn is like the last step of before I upload our built packages somewhere else...alle the build steps im using command line.

Jonathan K. Bullard

unread,
Nov 7, 2012, 8:05:49 AM11/7/12
to tunnelbli...@googlegroups.com, junp...@gmail.com
I'm not sure what you mean by "does not work". Does your AppleScript waiting for the connection to actually be made? The "Connect" AppleScript verb returns after initiated the connection -- it does not wait for the connection to succeed or fail.

On Wed, Nov 7, 2012 at 7:46 AM, Syntax <junp...@gmail.com> wrote:
Hi, indeed I can run applescripts in commandline and have already tried it and does not work. I thnk it is because the commands I am going to set are going to  be performed by a build agent as build steps so the change vpn is like the last step of before I upload our built packages somewhere else...alle the build steps im using command line.
--
You received this message because you are subscribed to the Google Groups "tunnelblick-discuss" group.

Syntax

unread,
Nov 7, 2012, 8:18:59 AM11/7/12
to tunnelbli...@googlegroups.com
Sorry I meant our build agent cannot run any applescript...I think its because its running as a daemon when its executing build step so it cannot open applications, only command line executables...

I already tried my simple ascript opennting tunnelblick and connecting to a vpn works fine when I manually run it in commandline but when I let our build agent execute or any applescript it cannot do it...

Syntax

unread,
Nov 14, 2012, 2:42:21 AM11/14/12
to tunnelbli...@googlegroups.com
I got the osascript to work as suggested. Just a stupid syntax mistake on my part. Thanks for the help. What I did was just a simple osascript command to tell tunnelblick to connect to this vpn using a configuration.

Reply all
Reply to author
Forward
0 new messages