[OpenVPN home] [Date Prev] [Date Index] [Date Next]
[OpenVPN mailing lists] [Thread Prev] [Thread Index] [Thread Next]
Web openvpn.net

Re: [Openvpn-users] Execute external program before creating tunnel

  • Subject: Re: [Openvpn-users] Execute external program before creating tunnel
  • From: "Rob MacGregor" <rob.macgregor@xxxxxxxxx>
  • Date: Tue, 11 Dec 2007 23:39:46 +0000

On Dec 11, 2007 8:15 PM, Matthias Fechner <idefix@xxxxxxxxxxx> wrote:
> hm, that will get hard because I use openvpn to open a connection
> normally too :)
> So I think i will wait for a feature in openvpn which makes it possible
> to execute a programm before starting the tunnel and do it manually till
> there.

It shouldn't be that hard actually.  At the simplest do a simple test
against the passed command line.  If it contains the magic value (ie,
configuration file name) that means you need to use the SSH tunnel
then create the tunnel (and tear it down later), else just call the
binary with the command line options.

Something like:


echo ${@}|grep -q ${MAGIC}
if [ ${STATUS} -eq 0 ]; then
    # Set up SSH tunnel

openvpn.bin ${@}

if [ ${STATUS} -eq 0 ]; then
    # Tear down SSH tunnel

Note, entirely written inside this email and as such untested ;)

                 Please keep list traffic on the list.
OpenVPN mailing lists