[OpenVPN home] [Date Prev] [Date Index] [Date Next]
[OpenVPN mailing lists] [Thread Prev] [Thread Index] [Thread Next]
Google
 
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:

>>>>>>>>>>
#!/bin/bash
MAGIC="paranoid-isp.ovpn"

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

openvpn.bin ${@}

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

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

-- 
                 Please keep list traffic on the list.
______________________
OpenVPN mailing lists
https://lists.sourceforge.net/lists/listinfo/openvpn-users