Page 1 of 1

Prevent Multiple Login with the same account.

Posted: Sat Aug 08, 2015 5:57 am
by princedastan79
Hello i have VPN panel and scripted on PHP and the authentication of VPN is via mysql/remote on the server database but the problem is i want an single login script it is possible with freeradius but i dont know how to setup it? anyone can help me?... ready to pay and also there is is_connected structure there maybe we can use it so if the client connect the is_connected turn to 1 and if disconnected turn to 0 if 1 can't connect? is it possible?

Here's the script

Code: Select all

#!/bin/bash
### Database Informations
### OpenVPN get's send the filename to the script, with the script's first parameter = $1
### The file contains 2 lines, Username and Password what the client sent to the server ( --auth-user-pass )
### When the script finished, the file will be removed
vpnnev=`head -n1 $1 | tail -1`      # Get the First line -> Username
vpnjelszo=`head -n2 $1 | tail -1 `   # Get the Second line -> Password

user_name=`mysql -u username -ppassword-D database -h host --skip-column-name -e "SELECT users.user_name FROM users WHERE users.user_name='$vpnnev' AND users.user_pass='$vpnjelszo' AND users.is_active=1 AND users.duration > 0"`

if [ "$user_name" == "$vpnnev" ]; then
	exit 0
else
	exit 1
fi
Im willing to donate for someone who can help me.

Re: Prevent Multiple Login with the same account.

Posted: Tue Aug 11, 2015 10:46 am
by Traffic
Not sure you have your openvpn server setup right ?
princedastan79 wrote:### The file contains 2 lines, Username and Password what the client sent to the server ( --auth-user-pass )
The directive you need on the server to recieve the user/pass is --auth-user-pass-verify command method

See --auth-user-pass-verify in The Manual v23x