First of all we need to configure VPN. After that we will create a web console by which user or client username and password will be created. So After Configuring yum
1. For Redhat
#yum -y install pptpd*
For Ubuntu( We must update apt through internet)
#sudo su
#apt-get install pptpd
ms-dns 8.8.4.4
5. for IPv4 forwardig we need to Change /etc/sysctl.conf file, add forward rule below
1. For Redhat
#yum -y install pptpd*
For Ubuntu( We must update apt through internet)
#sudo su
#apt-get install pptpd
2. Add we have to append or edit these three lines below in the file /etc/pptpd.conf
#vi /etc/pptpd.conf
localip 192.168.1.242 ### LAN IP localip 203.76.98.155 ### WAN IP remote ip 172.16.255.1-20 ### IP range for client 3. We will add client username,protocol,password and client IP to /etc/ppp/chap.secrets file
#vi /etc/ppp/chap.secrets #username pptpd password ip branch1 pptpd vpn1 172.16.255.1 branch2 pptpd vpn2 172.16.255.2
4. If we want to set dns for client then we need to edit the file /etc/ppp/pptpd-options and Uncomment the ms-dns and add google like below or OpenDNS
# vi /etc/ppp/pptpd-options
ms-dns 8.8.8.8
ms-dns 8.8.4.4
5. for IPv4 forwardig we need to Change /etc/sysctl.conf file, add forward rule below
# vi /etc/sysctl.conf
##Uncomment the line and change 0 to 1
net.ipv4.ip_forward=1
6. Now we will make a web form for taking username, Password and ip for client.
<html>
<body>
<div><table>
<form action=2nd.php method=post>
<tr><td width=20px></td><td>UserName:</td><td> <input type=text, name=n></td></tr>
<tr><td></td><td>Password:</td><td><input type=password, name=p></td></tr>
<tr><td></td><td>IP Addss:</td><td><table><tr><td>172.16.255.</td><td><input
type=text, name=ip size=6 placeholder="40-50" maxlength=2></td></tr></table>
</td></tr>
<tr><td></td><td></td><td></td></tr>
<tr><td></td><td></td><td><input type=submit value=create></td></tr>
</form></table>
<br><br>
</div>
</body>
</html>
7. After that we will make a php script containing shell script which will sent
username,password and ip to the /etc/ppp/chap-secret file
<?php
//session_start();
//$abc=$_SESSION['username'];
$name=$_POST['n'];
$pass=$_POST['p'];
$ip=$_POST['ip'];
if(isset($name,$pass,$ip))
{
include ('header.php');
include ('menu.php');
echo shell_exec("echo '$name pptpd $pass 172.16.255.$ip'>>/etc/ppp/chap-secrets");
echo shell_exec("echo ''>>/var/www/html/vpn/log");
echo shell_exec("echo '####" . date("Y/m/d H:i:s") . "###'>>/var/www/html/vpn/log");
echo shell_exec("echo '$name pptpd $pass 172.16.255.$ip created by $abc'>>/var/www/html/vpn/log");
echo "<b>$name user is Created</b><br>";
echo "<br>";
echo "<b><pre>  Added Users are :</b><br>";
echo shell_exec("cat /etc/ppp/chap-secrets");
echo "</pre>";
include ('footer.php');
}
else
{
include ('home.php');
}
?>
For displaying Connected user we can use this script
<?php
include ('header.php');
include ('menu.php');
echo "<br><br><b>Existing Users Are :</b>";
echo "<br>";
echo "<br>";
echo shell_exec("cat /etc/ppp/chap-secrets");
echo "<br>";
include ('footer.php');
?>
Lets play
Good job. I need mail script
ReplyDeletegood one
ReplyDeleteGood Job...........
ReplyDeleteVai Web application ta ki Vabe korbo
ReplyDeleteVai Web application ta ki Vabe korbo
ReplyDeletevai web page dia kivabe user add korbo.
ReplyDeleteJahid Vai Web application ta ki vaba korbo akto kindly janaben.
ReplyDelete