connected.sh or other scripts...

578 views
Skip to first unread message

sal...@live.de

unread,
Nov 21, 2016, 2:44:38 PM11/21/16
to tunnelblick-discuss
Hello,

i had read the doku but understand nothing.
Where is the location for connected.sh what I can edit?

My idea:
I want to connect with a server AFTER connection with my OpenVPN Server.

Maybe with AppleScript...


Tunnelblick developer

unread,
Nov 21, 2016, 2:53:52 PM11/21/16
to tunnelblick-discuss, sal...@live.de
The "connected.sh" file needs to be inside a .tblk.

So when you create your .tblk to install a configuration, put the connected.sh file inside it.

For example, to install a VPN configuration and have it named "SampleVPN":
  1. Create a "Desktop/SampleVPN" folder.
  2. Put the OpenVPN configuration file in the folder. (The name doesn't matter as long as it ends in .ovpn or .conf.)
  3. Put the "connected.sh" file in the folder.
  4. Put any other files that are needed (key and certificate files, for example) in the folder.
  5. Rename the folder to "SampleVPN.tblk".
  6. Drag "SampleVPN.tblk" to the Tunnelblick icon in the status bar (right side of the menu bar).

spyd...@gmail.com

unread,
May 19, 2017, 7:55:02 PM5/19/17
to tunnelblick-discuss, sal...@live.de
Is there a way to do this with an already installed configuration? I tried to follow directions to edit config but my tunnelblick (3.7.1a) does not have the "Edit OpenVPN Configuration File" option under vpn settings. 

Tunnelblick developer

unread,
May 19, 2017, 8:10:06 PM5/19/17
to tunnelblick-discuss, sal...@live.de, spyd...@gmail.com
You don't edit the OpenVPN configuration file to "do this" (add a connected.sh script).

You should take your original Tunnelblick VPN Configuration if you have one, make changes to it, and then install it. The new one will replace the old one.

If you don't have your original, or didn't make one and only installed the OpenVPN configuration file directly, then
  1. Copy the installed Tunnelblick VPN Configuration (.tblk) to the Desktop (see note below).
  2. Rename it to remove the ".tblk" (it will turn into a folder).
  3. Add the "connected.sh" file into the folders's Contents/Resources subfolder.
  4. Rename the folder by adding ".tblk" at the end of the name (it will change back to a Tunnelblick VPN Configuration).
  5. Drag the .tblk to the Tunnelblick icon in the status bar (right side of the menu bar) and it will replace the existing configuration.
The installed .tblk can be found:
  • For a "private" configuration, in /Users/YOUR-USERNAME/Library/Application Support/Tunnelblick/Configurations
  • For a "shared" configuration, in /Library/Application Support/Tunnelblick/Shared

Note: The "Edit OpenVPN Configuration File" option should be visible in 3.7.1. If it is dimmed, that's because only a "private" configuration can be edited. Convert the configuration from shared to private and you will be able to edit the OpenVPN file; you can convert it back when you're done editing.

spyd...@gmail.com

unread,
May 20, 2017, 1:31:11 AM5/20/17
to tunnelblick-discuss, sal...@live.de, spyd...@gmail.com
Thank you, i got the script to work, now im trying to figure out why its not running the reconnecting.sh script after it disconnects and tries to reconnect after sleeping.

The "edit conf. file" option is not greyed out it was completely missing. After I changed it to private it does show.  

spyd...@gmail.com

unread,
May 20, 2017, 2:11:26 AM5/20/17
to tunnelblick-discuss, sal...@live.de, spyd...@gmail.com
Not sure if i can add to my another post so i'm replying.  

Im also getting the following error 

*Tunnelblick: The 'post-disconnect.sh' script failed; 'openvpnstart postDisconnect' returned error 1

Executing post-disconnect.sh in /Library/Application Support/Tunnelblick/Shared/USVPN.tblk/Contents/Resources...

post-disconnect.sh returned with status 1


I am trying to run the post-disconnect.sh script, Contents of the script


#!/bin/bash


pkill Deluge

Tunnelblick developer

unread,
May 20, 2017, 8:32:50 AM5/20/17
to tunnelblick-discuss, spyd...@gmail.com
pkill returns a status of 1 if no processes were killed.

bash returns that status of 1 to Tunnelblick, and Tunnelblick thinks the script failed, so it complains.

To avoid the complaint, put an exit 0 command at the end of the script. The script will return a status of 0 to bash, bash will return that status to Tunnelblick, and Tunnelblick will not complain about a non-zero status.

(Note that a plain exit command -- without the 0 -- will return the status of the command that was last executed (pkill) and thus won't fix the problem.)

spyd...@gmail.com

unread,
May 20, 2017, 6:02:32 PM5/20/17
to tunnelblick-discuss, spyd...@gmail.com
The script now executes without the previous error, but it still does not kill the application. Any ideas?

Jonathan K. Bullard

unread,
May 20, 2017, 10:51:23 PM5/20/17
to tunnelbli...@googlegroups.com
All I can suggest is some basic troubleshooting:
  • Is the process named "Deluge"? (The process does not have to have the same name as the application.)

  • Can you kill the application from Terminal with "sudo pkill Deluge"? ("sudo" because Tunnelblick will execute the script as root.)


--
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-discuss+unsub...@googlegroups.com.
Visit this group at https://groups.google.com/group/tunnelblick-discuss.
For more options, visit https://groups.google.com/d/optout.

spyd...@gmail.com

unread,
May 21, 2017, 3:28:32 AM5/21/17
to tunnelblick-discuss
Thank you, my issued ended up being Capital D instead of lowercase d. Activity monitor showed it as Deluge so I used that spelling. Everything is working how I want it to now. I appreciate the quick help.
Reply all
Reply to author
Forward
0 new messages