Connect via the Command Line

587 views
Skip to first unread message

ma...@manngo.net

unread,
Jul 12, 2015, 6:04:46 PM7/12/15
to tunnelbli...@googlegroups.com
How do I start Tunnelblick and make a connection via the command line?

From time to time I need to establish a connection remotely. I can connect to my Mac via SSH, and from there do anything I like.

I get the impression that the trick is to run openvpnstart with some parameters. I also get the impression that some files need to be located in the Application Support folder. From there I’m lost.

Thanks

jkbull...gmail.com

unread,
Jul 12, 2015, 6:18:40 PM7/12/15
to tunnelbli...@googlegroups.com, ma...@manngo.net, ma...@manngo.net
The easiest way to do it is using AppleScript and osascript.

osascript -e "tell application \"Tunnelblick\"" -e "connect \"YOUR-CONFIG-NAME\"" -e "end tell"

It will echo "false" if there is no such configuration or there is some other problem.

It will echo "true" if Tunnelblick was able to start OpenVPN trying to make a connection. Note that it does not mean that the connection was successful. See AppleScriptSupport for more info on using AppleScript to control Tunnelblick.

Randy Witlicki

unread,
Jul 12, 2015, 6:24:34 PM7/12/15
to tunnelbli...@googlegroups.com, ma...@manngo.net

  Could you clarify - It looks like you want to have an OpenVPN server running on the Mac you ssh into and then want to connect from your remote client ?
  So, you want to have an OpenVPN server listening no the Mac you ssh into ?
  I think Tunnelblick is a client GUI only and server side management is outside of Tunnelblick's design.

  Randy

--
You received this message because you are subscribed to the Google Groups "tunnelblick-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tunnelblick-dis...@googlegroups.com.
Visit this group at http://groups.google.com/group/tunnelblick-discuss.
For more options, visit https://groups.google.com/d/optout.

Randy Witlicki

unread,
Jul 12, 2015, 6:26:07 PM7/12/15
to tunnelbli...@googlegroups.com, ma...@manngo.net

  Oops, sorry, I defer to a higher authority.

jkbull...gmail.com

unread,
Jul 12, 2015, 6:30:08 PM7/12/15
to tunnelbli...@googlegroups.com, randy.w...@valley.net, ma...@manngo.net
I assumed he wanted to run Tunnelblick client on the remote computer, but maybe not.

Although Tunnelblick is mostly a client interface, it can start/stop server instances of OpenVPN, too. (Tunnelblick doesn't include much in the way of support for server instances, but you can start and stop the server.)

To clarify one thing: The AppleScripting works only if Tunnelblick is installed, configured, etc. So if you can connect using Tunnelblick, you can connect using Tunnelblick via AppleScript.


On Sunday, July 12, 2015 at 6:24:34 PM UTC-4, randywitlicki wrote:

  Could you clarify - It looks like you want to have an OpenVPN server running on the Mac you ssh into and then want to connect from your remote client ?
  So, you want to have an OpenVPN server listening no the Mac you ssh into ?
  I think Tunnelblick is a client GUI only and server side management is outside of Tunnelblick's design.

  Randy

ma...@manngo.net

unread,
Jul 12, 2015, 10:49:08 PM7/12/15
to tunnelbli...@googlegroups.com, ma...@manngo.net
This is not what I had thought, but it does the job perfectly. I also didn’t realise that you can run an applescript as a one-liner like that. And, yes, I did mean starting the client on the machine.

Thanks for the solution!

Mark

jkbull...gmail.com

unread,
Jul 12, 2015, 11:22:46 PM7/12/15
to tunnelbli...@googlegroups.com, ma...@manngo.net, ma...@manngo.net
You're welcome.

Just for the record, you can use the "openvpnstart" program located in /Applications/Tunnelblick/Contents/Resources to start (but not stop) a configuration, but it has very complex options and was originally used by the Tunnelblick program itself to start configurations. (Tunnelblick now uses a different, more secure, method; and openvpnstart is now just a backward-compatible front-end for using the same method.) Using osascript with a quick AppleScript is much easier.
Reply all
Reply to author
Forward
0 new messages