Set configuration password via AppleScript

156 views
Skip to first unread message

Marcin Gryszko

unread,
Jun 5, 2021, 6:09:22 AM6/5/21
to tunnelblick-discuss
Hi! Release notes say that I can script setting the password:

3.8.0beta03 build 5350
    Adds AppleScript commands to set username/password/passphrase and delete credentials for a configuration.

But it seems not to be documented. Is there any example for this?

The problem I'm trying to solve is to add the OTP to the secret before connecting.

Tunnelblick developer

unread,
Jun 5, 2021, 7:26:54 AM6/5/21
to tunnelblick-discuss
What you want to do is probably better done using one of two other mechanisms built into Tunnelblick:
  1. If the OTP can be generated or read from a device by a script, you can use a "password-append.sh" script (or a "password-prepend", or a "password-replace" script) to modify or set the password before it is sent to OpenVPN. See Using Scripts for details.

  2. If the OTP cannot be generated or read from a device by a script, Tunnelblick 3.8.6beta02 and higher allow you to enter an OTP into the username/password dialog. The OTP will then be appended to the password before it is sent to the OpenVPN server.
(These mechanisms are usually used after saving the username and password in the Keychain.)


If you really want to set the password using AppleScript, the command is:

save password "PW" for "CONFIGURATION"

where CONFIGURATION is the name of the configuration and PW is the password.

(Also, note that the best way to get an up-to-date list of AppleScript commands for any application is to open the application's dictionary in /Utilities/Script Editor.)

Marcin Gryszko

unread,
Jun 5, 2021, 10:02:26 AM6/5/21
to tunnelblick-discuss
I went for the option 1). I added the append script and I worked like a charm. 

Thank you very much for your support!

Tunnelblick developer

unread,
Jun 5, 2021, 11:47:02 AM6/5/21
to tunnelblick-discuss
You're welcome. Thanks for letting us know it worked out for you.
Reply all
Reply to author
Forward
0 new messages