[Solved] OpenVPN VHD and client-connect scripts?

How to customize and extend your OpenVPN installation.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Locked
CaptainOblivi0us
OpenVpn Newbie
Posts: 3
Joined: Mon Oct 07, 2013 5:52 pm

[Solved] OpenVPN VHD and client-connect scripts?

Post by CaptainOblivi0us » Mon Oct 07, 2013 6:00 pm

Anyone have client-connect scripts working with VHD? I can't get passed this error:

client-connect command failed: could not execute external program'

Things I have tried:
File permissions (755)
Moving script to user's home directory and /usr/local/openvpn_as/scripts/
Simplified script:
---
#!/bin/bash
exit 0
---

At this point i have no idea what's wrong. Has anyone got it working?

Heere's the what I am using.
script-security 2
client-connect "/bin/bash /usr/local/openvpn_as/scripts/mail.sh"
Last edited by debbie10t on Wed Mar 26, 2014 1:29 am, edited 1 time in total.
Reason: [Solved / closed]

CaptainOblivi0us
OpenVpn Newbie
Posts: 3
Joined: Mon Oct 07, 2013 5:52 pm

Re: OpenVPN VHD and client-connect scripts?

Post by CaptainOblivi0us » Sun Mar 23, 2014 8:46 pm

bump,
instead of VHD I tried reinstalling openvpn-as on ubuntu server but I still get the same problem.

Failed running command (--client-connect): could not execute external program"

script-security 3 system
client-connect "/tmp/email.sh"

I see it chroots:
chroot to '/dev/shm/openvpn_as' and cd to '/' succeeded"

Although /dev/shm/openvpn_as is not prepared as a chroot environment.

I was also getting
" Could not create temporary file '/tmp/openvpn_cc_ffcc43e43fdab0279712b10ee01e5a1c.tmp': No such file or directory" although that went away after I created tmp in /dev/shm/openvpn_as.

Please any help would be appreciated.

CaptainOblivi0us
OpenVpn Newbie
Posts: 3
Joined: Mon Oct 07, 2013 5:52 pm

Re: [FIXED] OpenVPN VHD and client-connect scripts?

Post by CaptainOblivi0us » Mon Mar 24, 2014 2:17 pm

Figured it out indeed all client-connect and client-disconnect scripts fail because openvpn runs chrooted in "run/shm/openvpn_as"

So you need to copy /bin/bash to /run/shm/openvpn_as/bin/

cd /run/shm/openvpn_as/
mkdir bin dev proc lib lib64

mount --bind /dev/ dev/
mount --bind /proc/ proc/
mount --bind /usr/lib/ lib/
mount --bind /lib64/ lib64/

Other binaries you are calling in your script also need to be moved as well.

Locked