Tunnelblick Connection & Authentication via Script

Skip to first unread message

Alex Massey

Oct 9, 2022, 9:16:51 AM10/9/22
to tunnelblick-discuss
Hi, I am trying to mimic what I can do on the windows and linux OpenVPN client where I can control the VPN connection via script. I have found a script I can use to connect to an existing VPN connection, however I want to be able to supply a configuration file and connect to it with authentication from an external app without any interaction from the user on Tunnelblick. 

Currently on the Windows OpenVPN client for instance I can temporarily write the username/password to a file, pass the configuration file to the executable via a single command and it will read the credentials and connect then I can safely delete the file. How can I go about mimicking this setup using Tunnelblick? 

Currently I'm using the following script to at least connect however I need to automate the credentials as well as the user won't know what their credentials actually are.

tell application "Tunnelblick"
connect "TUNNEL1"
get state of first configuration where name = "TUNNEL1"
repeat until result = "CONNECTED"
delay 1
get state of first configuration where name = "TUNNEL1"
end repeat
end tell


Tunnelblick developer

Apr 28, 2023, 6:34:11 AMApr 28
to tunnelblick-discuss
(Sorry for answering this so late. Perhaps my answer will help someone else with this question.)

Two ways to do it:
  1. You can use OpenVPN's --auth-user-pass file option. file is a file contains the username and password, each on a line terminated by a LF character.
  2. You can save the credentials in the KeyChain and set a Tunnelblick per-configuration preference to indicate they are available.

Reply all
Reply to author
0 new messages