Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- export DEBIAN_FRONTEND=noninteractive
- if ! [[ -e /etc/debian_version ]]; then
- echo For DEBIAN only.
- exit;fi
- # OPENVPN SERVER SETTINGS
- cd /etc/openvpn
- wget -qO 1194.conf https://raw.githubusercontent.com/X-DCB/Unix/master/openvpn/1194.conf
- function chvar {
- . script/config.sh
- [[ `cat script/config.sh` =~ "$1" ]] || echo "$1=" >> script/config.sh
- if [[ ${!1} == '' ]];then
- echo $2
- while [[ $ccx == '' ]];do
- read -p "$3: " ccx;done;
- sed -i "/$1/{s/=.*/=$ccx/g}" script/config.sh; fi; ccx=''
- . script/config.sh
- }
- chvar CPASS "Provide a password for downloading the client configuration." "Set Password"
- chvar OWNER "Your name as Owner of this server." "Set Owner"
- # WEB DATA
- cd /var/www/html
- wget "https://raw.githubusercontent.com/X-DCB/Unix/master/openvpn/webfiles-simple.tar.gz" -qO- | tar xz
- # ROUTING TABLE
- echo '#!/bin/bash
- iptables -F
- iptables -X
- iptables -F -t nat
- iptables -X -t nat
- iptables -P INPUT ACCEPT
- iptables -P FORWARD ACCEPT
- iptables -P OUTPUT ACCEPT
- iptables -t nat -I POSTROUTING -o eth0 -j MASQUERADE
- iptables -A INPUT -j ACCEPT
- iptables -A FORWARD -j ACCEPT
- iptables -A INPUT -p tcp --dport 1194 -j ACCEPT
- iptables -I FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
- iptables -A OUTPUT -p tcp -m state --state ESTABLISHED --sport 22 -j ACCEPT
- iptables -A INPUT -p udp -m state --state ESTABLISHED --sport 53 -j ACCEPT
- iptables -A OUTPUT -p udp -m state --state NEW,ESTABLISHED --dport 53 -j ACCEPT
- iptables -A INPUT -p tcp -m state --state NEW,ESTABLISHED --dport 22 -j ACCEPT
- iptables -t filter -A FORWARD -j REJECT --reject-with icmp-port-unreachable
- sysctl -w net.ipv4.ip_forward=1
- ' > /sbin/iptab
- chmod +x /sbin/iptab;iptab
- bash -c "$(wget -qO- https://git.io/fxxHa)"
- echo "Installation finished."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement