Created
June 13, 2011 01:53
-
-
Save tom2cjp/1022221 to your computer and use it in GitHub Desktop.
pptpd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
############################################################ | |
# Description: pptpd vpn installation script for debian.#### | |
# Author: Netexr #### | |
# Date: 2011-02-24 #### | |
############################################################ | |
# | |
# Install pptpd | |
apt-get remove -y --purge pptpd | |
apt-get update | |
apt-get -y install pptpd openssl | |
apt-get -y install iptables | |
pass=`openssl rand 9 -base64` | |
# | |
# Configurate the vpn server | |
echo "localip 192.168.0.1" >> /etc/pptpd.conf | |
echo "remoteip 192.168.0.2-245" >> /etc/pptpd.conf | |
echo "ms-dns 8.8.8.8" >> /etc/ppp/pptpd-options | |
echo "ms-dns 8.8.4.4" >> /etc/ppp/pptpd-options | |
echo "vpnuser pptpd $pass *" >> /etc/ppp/chap-secrets | |
# | |
# Add firewall rules | |
iptables -t nat -F | |
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -j MASQUERADE | |
iptables -A FORWARD -p tcp --syn -s 192.168.0.0/24 -j TCPMSS --set-mss 1356 | |
# | |
# Save iptables rules | |
iptables-save > /etc/iptables_rules | |
echo "iptables-restore < /etc/iptables_rules" > /etc/rc.local | |
# | |
# Restart the vpn service | |
/etc/init.d/pptpd restart | |
# | |
# The End of the script | |
echo "#############################################################" | |
echo "VPN server installaion successed!" | |
echo "Your username is vpnuser" | |
echo "Your password is $pass" | |
echo "#############################################################" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment