Unable to create temporary file + client-connect script

Scripts which allow the use of special authentication methods (LDAP, AD, MySQL/PostgreSQL, etc).

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

Post Reply
tushar.sharma
OpenVPN Power User
Posts: 58
Joined: Fri Oct 07, 2011 12:23 pm
Location: Pune
Contact:

Unable to create temporary file + client-connect script

Post by tushar.sharma » Fri Oct 07, 2011 12:30 pm

Hello.,

I have created openvpn server and client its all working fine using authentication, allowed lan network on both sides.
Now i want to create file in ccd directory as per common name of connecting client.
For that i need to retrieve common name of connecting client. I have refer documents and manual page on openvpn.net site
but unable to do so. I have created one script script.sh in that i have just used
#!/bin/sh
echo $* > /path/tmp.txt

also i have tried

#!/bin/sh

if [ -n "$1" ] ; then
echo $1 > /path/tmp.txt
echo $common_name >> $1
else
exit 1

fi

But its not working . while i start server using openvpn --config openvpnserver.conf --client-connect script.sh and on other side starting client,, server get exit and its shows unable to create /tmp/openvpn_cc_oe.... file .


I have also tried using option --tmp-dir

but its not working..

Do any one have any example to retrieve environment variables of connecting client like common_name of other using
client-connect script...



thanking You,,

Tushar

tushar.sharma
OpenVPN Power User
Posts: 58
Joined: Fri Oct 07, 2011 12:23 pm
Location: Pune
Contact:

Re: Unable to create temporary file + client-connect script

Post by tushar.sharma » Sat Oct 08, 2011 9:36 am

I have solved Problem.
It was due to improper rights that is being assigned to script file.

I was trying to run script as root and connecting client and server in openvpn
using user openvpn and group openvpn

Just changed user from openvpn to root and problem got solved..

Thanking You.
tushar

Post Reply