1

I've success installed and PPTP VPN in my Linode by using this script:

https://github.com/liaohuqiu/centos-setup/blob/master/install/install_vpn.sh

yum install -y ppp

wget http://centos-files.liaohuqiu.net/f/pptpd-1.3.4-2.el6.x86_64.rpm
rpm -ihv pptpd-1.3.4-2.el6.x86_64.rpm
rm -rf *.rpm

rm -rf /etc/pptpd.conf
rm -rf /etc/ppp
mkdir -p /etc/ppp

echo "option /etc/ppp/options.pptpd" >> /etc/pptpd.conf
echo "localip 10.0.0.1" >> /etc/pptpd.conf
echo "remoteip 10.0.0.10-100" >> /etc/pptpd.conf

echo "ms-dns 8.8.8.8" >> /etc/ppp/options.pptpd
echo "ms-dns 8.8.4.4" >> /etc/ppp/options.pptpd

pass=`openssl rand 6 -base64`
if [ "$1" != "" ]
then pass=$1
fi
echo "vpn pptpd ${pass} *" >> /etc/ppp/chap-secrets

function config_iptables()
{
    # Reset/Flush iptables
    iptables -F
    iptables -X
    iptables -t nat -F
    iptables -t nat -X
    iptables -t mangle -F
    iptables -t mangle -X
    iptables -P INPUT ACCEPT
    iptables -P FORWARD ACCEPT
    iptables -P OUTPUT ACCEPT
    # Flush end

    iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

    iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE


    iptables -A INPUT -i eth0 -p tcp --dport 1723 -j ACCEPT
    iptables -A INPUT -i eth0 -p gre -j ACCEPT

    # Allow localhost traffic
    iptables -A INPUT -i lo   -m state --state NEW  -j ACCEPT
    iptables -A OUTPUT -o lo   -m state --state NEW  -j ACCEPT

    # Allow server and internal network to go anyway
    iptables -A INPUT  -s 10.0.0.0/24   -m state --state NEW  -j ACCEPT
    iptables -A OUTPUT  -m state --state NEW  -j ACCEPT

    # Allow ssh
    iptables -A INPUT -p tcp --dport ssh -j ACCEPT

    service iptables save
    service iptables restart
}

chkconfig pptpd on
service pptpd start
config_iptables

ip=`/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`
echo "===================================="
echo " VPN INSTALLATION COMPLETE"
echo "===================================="
echo " "
echo "VPN hostname/ip: ${ip}"
echo "VPN type: PPTP"
echo "VPN username: vpn"
echo "VPN password: ${pass}"
echo " "

It works very well. But in these days I found there are a lot off connections which make my server out of traffic.

It seems that I can connect to the server by using any account and password.

And this my config files:

[root@mylinode ppp]# ll
total 24
-rw------- 1 root root  16 Jun 20 01:53 chap-secrets
-rw------- 1 root root 349 Oct 23  2013 eaptls-client
-rw------- 1 root root 405 Oct 23  2013 eaptls-server
-rw-r--r-- 1 root root   5 Nov 16  2009 options
-rw-r--r-- 1 root root  86 Jun 20 01:37 options.pptpd
-rw------- 1 root root  77 Nov 16  2009 pap-secrets

And the chap-secets

[root@mylinode ppp]# cat chap-secrets
vpn pptpd 111 *

And there the log from /var/log/message:

Jun 20 02:03:53 mylinode pptpd[23994]: CTRL: Client 221.218.36.184 control connection started
Jun 20 02:03:53 mylinode pptpd[23994]: CTRL: Starting call (launching pppd, opening GRE)
Jun 20 02:03:53 mylinode pppd[23995]: pppd 2.4.5 started by huqiu, uid 0
Jun 20 02:03:53 mylinode pppd[23995]: Using interface ppp0
Jun 20 02:03:53 mylinode pppd[23995]: Connect: ppp0 <--> /dev/pts/3
Jun 20 02:03:56 mylinode pppd[23995]: peer from calling number 221.218.36.184 authorized
Jun 20 02:03:57 mylinode pppd[23995]: local  IP address 10.0.0.1
Jun 20 02:03:57 mylinode pppd[23995]: remote IP address 10.0.0.10

I've tried to reinstall for many times, the problem is still there.

Any help will be great, I can provider more information if needed. Thank you in advance.

-1

Seems you have a weak password and cracked,the man post your ip and your pass somewhere, making your vpn server a public server,please rename your user and pass.

  • But I can connect to the server by using any account and any password. – srain Jun 30 '15 at 8:57
  • 1
    You never edit /etc/ppp/options.pptpd?pptpd don't have anonymous mode,check your options.pptd--------------------------------------------refuse-pap refuse-chap refuse-mschap require-mschap-v2 require-mppe-128 – Jarett Jun 30 '15 at 9:22
0

You can check the contents of /etc/ppp/chap-secrets. The username and password that can connect to the VPN server are stored there. The contents of the file should look like this:

$ cat /etc/ppp/chap-secrets
# Secrets for authentication using CHAP
# client        server  secret                  IP addresses
username1 pptpd password1 *
username2 pptpd password2 *
  • Thank you, I've added this to my /etc/ppp/chap-secrets, but I still can use any account and password to login in. That's weird. – srain Jun 30 '15 at 11:08
0

Thank you @Jarett

I added this to /etc/ppp/options.pptpd:

refuse-pap
refuse-chap
refuse-mschap
require-mschap-v2
require-mppe-128

Then I should use the account and password in /etc/ppp/chap-secrets to login.


The reason

I forget to mention the content in /etc/ppp/options.pptpd, they were:

name pptpd

ms-dns 8.8.8.8
ms-dns 8.8.4.4

Then I connected to the server by using encryption level: None.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.