Advertisement
Portdroid

Updater (Squid, Web, Ovpn Server Config)

Oct 25th, 2019
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. #!/bin/bash
  2. export DEBIAN_FRONTEND=noninteractive
  3. if ! [[ -e /etc/debian_version ]]; then
  4. echo For DEBIAN only.
  5. exit;fi
  6. # OPENVPN SERVER SETTINGS
  7. cd /etc/openvpn
  8. wget -qO 1194.conf https://raw.githubusercontent.com/X-DCB/Unix/master/openvpn/1194.conf
  9. function chvar {
  10. . script/config.sh
  11. [[ `cat script/config.sh` =~ "$1" ]] || echo "$1=" >> script/config.sh
  12. if [[ ${!1} == '' ]];then
  13. echo $2
  14. while [[ $ccx == '' ]];do
  15. read -p "$3: " ccx;done;
  16. sed -i "/$1/{s/=.*/=$ccx/g}" script/config.sh; fi; ccx=''
  17. . script/config.sh
  18. }
  19. chvar CPASS "Provide a password for downloading the client configuration." "Set Password"
  20. chvar OWNER "Your name as Owner of this server." "Set Owner"
  21. # WEB DATA
  22. cd /var/www/html
  23. wget "https://raw.githubusercontent.com/X-DCB/Unix/master/openvpn/webfiles-simple.tar.gz" -qO- | tar xz
  24. # ROUTING TABLE
  25. echo '#!/bin/bash
  26. iptables -F
  27. iptables -X
  28. iptables -F -t nat
  29. iptables -X -t nat
  30. iptables -P INPUT ACCEPT
  31. iptables -P FORWARD ACCEPT
  32. iptables -P OUTPUT ACCEPT
  33. iptables -t nat -I POSTROUTING -o eth0 -j MASQUERADE
  34. iptables -A INPUT -j ACCEPT
  35. iptables -A FORWARD -j ACCEPT
  36. iptables -A INPUT -p tcp --dport 1194 -j ACCEPT
  37. iptables -I FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
  38. iptables -A OUTPUT -p tcp -m state --state ESTABLISHED --sport 22 -j ACCEPT
  39. iptables -A INPUT -p udp -m state --state ESTABLISHED --sport 53 -j ACCEPT
  40. iptables -A OUTPUT -p udp -m state --state NEW,ESTABLISHED --dport 53 -j ACCEPT
  41. iptables -A INPUT -p tcp -m state --state NEW,ESTABLISHED --dport 22 -j ACCEPT
  42. iptables -t filter -A FORWARD -j REJECT --reject-with icmp-port-unreachable
  43. sysctl -w net.ipv4.ip_forward=1
  44. ' > /sbin/iptab
  45. chmod +x /sbin/iptab;iptab
  46. bash -c "$(wget -qO- https://git.io/fxxHa)"
  47. echo "Installation finished."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement