Prevent Multiple Login with the same account.

How to customize and extend your OpenVPN installation.

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

Post Reply
princedastan79
OpenVpn Newbie
Posts: 7
Joined: Mon Jun 01, 2015 8:01 am

Prevent Multiple Login with the same account.

Post by princedastan79 » Sat Aug 08, 2015 5:57 am

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.

User avatar
Traffic
OpenVPN Protagonist
Posts: 4066
Joined: Sat Aug 09, 2014 11:24 am

Re: Prevent Multiple Login with the same account.

Post by Traffic » Tue Aug 11, 2015 10:46 am

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

Post Reply