#!/bin/bash -x # # drewsymo/××× # # Installs a PPTP ×××-only system for CentOS # # # Create UDF Options ## ××× Username #<udf name="***_user" label="Enter your ××× Username" # default="myuser" # example="***-user"> ## ××× Password #<udf name="***_pass" label="Enter the Password of ××× User" # default="sudoninja" # example="wackytubeman23x"> ## ××× Local IP #<udf name="***_local" label="Enter the Local IP Address of your Server" # default="192.168.0.1" # example="10.0.0.1"> ## ××× Remote IP #<udf name="***_remote" label="Enter the Local IP Address of your Home Device (or range)" # default="192.168.0.1" # example="192.168.0.151-200"> ( ×××_IP=`curl ipv4.icanhazip.com>/dev/null 2>&1` yum -y groupinstall "Development Tools" rpm -Uvh http://poptop.sourceforge.net/yum/stable/rhel6/pptp-release-current.noarch.rpm yum -y install policycoreutils policycoreutils yum -y install ppp pptpd yum -y update echo "1" > /proc/sys/net/ipv4/ip_forward sed -i 's/net.ipv4.ip_forward = 0/net.ipv4.ip_forward = 1/g' /etc/sysctl.conf sysctl -p /etc/sysctl.conf echo "localip $×××_LOCAL" >> /etc/pptpd.conf # Local IP address of your ××× server echo "remoteip $×××_REMOTE" >> /etc/pptpd.conf # Scope for your home network echo "ms-dns 8.8.8.8" >> /etc/ppp/options.pptpd # Google DNS Primary echo "ms-dns 209.244.0.3" >> /etc/ppp/options.pptpd # Level3 Primary echo "ms-dns 208.67.222.222" >> /etc/ppp/options.pptpd # OpenDNS Primary echo "$×××_USER pptpd $×××_PASS *" >> /etc/ppp/chap-secrets service iptables start echo "iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE" >> /etc/rc.local iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE service iptables save service iptables restart service pptpd restart echo -e '\E[37;44m'"\033[1m Installation Log: /var/log/***-installer.log \033[0m" echo -e '\E[37;44m'"\033[1m You can now connect to your ××× via your external IP ($×××_IP)\033[0m" echo -e '\E[37;44m'"\033[1m Username: $×××_USER\033[0m" echo -e '\E[37;44m'"\033[1m Password: $×××_PASS\033[0m" ) 2>&1 | tee /var/log/***-installer.log
转载于:https://blog.51cto.com/nowsafe/1391828