-
Notifications
You must be signed in to change notification settings - Fork 35
/
ubuntu
58 lines (44 loc) · 1.43 KB
/
ubuntu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
echo "###################################"
echo "This script will configure PPTP VPN"
echo "###################################"
# Install PPTP daemon service
apt-get -y install pptpd
# Set DNS
echo "ms-dns 8.8.8.8" >> /etc/ppp/pptpd-options
echo "ms-dns 8.8.4.4" >> /etc/ppp/pptpd-options
# Get server IP
ip=`ifconfig eth0 | grep 'inet addr' | awk {'print $2'} | sed s/.*://`
# Set IP for server & user
echo "localip $ip" >> /etc/pptpd.conf
echo "remoteip 10.1.0.1-100" >> /etc/pptpd.conf
# Input username and password
echo "###################################"
echo "Please enter your new login details"
echo "###################################"
echo "Enter new username: "
read username
echo "Enter new password: "
read password
# Set user & password
# Replace $username and $password
echo "$username pptpd $password *" >> /etc/ppp/chap-secrets
# Restart PPTPD to reload all config
service pptpd restart
# Forward packet between localip and remoteip
echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
# Restart sysctl to reload config
sysctl -p
# Allow PPTP traffic on iptables
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A INPUT -p 47 -j ACCEPT
# Save iptable
iptables-save
echo "############################"
echo "PPTP VPN Login Details"
echo "############################"
echo "Your IP is " $ip
echo "Your username is " $username
echo "Your password is " $password
echo "############################"
exit