Skip to content

Instantly share code, notes, and snippets.

@gil-obradors
Created September 29, 2019 18:11
Show Gist options
  • Save gil-obradors/91c93e6e00f24b4d603b97f8570c19f3 to your computer and use it in GitHub Desktop.
Save gil-obradors/91c93e6e00f24b4d603b97f8570c19f3 to your computer and use it in GitHub Desktop.
Automated PPTP-CLient Devian creater
#!/bin/bash
# Inspired from https://www.prado.lt/how-to-set-up-pptp-client-on-debian-9
#apt-get install pptp-linux
if dpkg -l | grep pptp-linux ; then echo "No instalarem paquet" ; else apt-get install pptp-linux ; fi
echo "Ip del servidor de tunel?"
read server
echo "Nom que vols dir-li al tunel?"
read tunnel
echo "Té domini?"
read domain
echo "Nom d'usuari?"
read username
echo "Contrasenya?"
read password
#sudo tee /etc/ppp/options.pptp << 'EOF'
#lock noauth nobsdcomp nodeflate
#EOF
echo "$username PPTP $password *" | sudo tee -a /etc/ppp/chap-secrets
sudo tee /etc/ppp/$tunnel << 'EOF'
pty "pptp $server --nolaunchpppd"
name $username
remotename PPTP
file /etc/ppp/options.pptp
ipparm $tunnel
EOF
sudo tee -a /etc/network/interface << 'EOF'
auto tunnel
iface tunnel inet ppp
provider $tunnel
pre-down ip -4 addr flush dev ppp0 scope global
EOF
sudo tee /etc/ppp/ip-up.d/$tunnel << 'EOF'
#!/bin/bash
/sbin/ip route add 10.255.254.199/32 dev ppp0
/sbin/ip route add 10.54.0.81/32 dev ppp0
/sbin/ip route add 10.101.0.0/18 dev ppp0
EOF
chmod +x /etc/ppp/ip-ip.d/$tunnel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment