Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #Database Details
- HOST='31.22.4.46';
- USER='takashiv';
- PASS='917!dE6Y]wvXUf';
- DBNAME='takashiv_devtakashi';
- #Colors
- RED='\033[01;31m';
- RESET='\033[0m';
- GREEN='\033[01;32m';
- WHITE='\033[01;37m';
- YELLOW='\033[00;33m';
- timedatectl set-timezone Asia/Manila
- install_packages () {
- echo -e "$GREEN Installing Update....$RESET"
- apt-get update &> /dev/null
- sleep 3
- echo -e "$GREEN Installing Packages...$RESET"
- apt-get install mysql-client openvpn unzip build-essential curl privoxy apache2 stunnel4 -y &> /dev/null
- apt-get install php php-mysqli php-mysql php-gd php-mbstring -y &> /dev/null
- apt-get install php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap -y &> /dev/null
- }
- create_directory (){
- mkdir /etc/openvpn/script
- mkdir /var/www/html/stat
- touch /var/www/html/stat/status.txt
- }
- create_files () {
- cat <<\EOM >/etc/openvpn/server.conf
- port 1194
- sndbuf 0
- rcvbuf 0
- push "sndbuf 393216"
- push "rcvbuf 393216"
- reneg-sec 432000
- push "persist-key"
- push "persist-tun"
- proto tcp
- dev tun
- ca ca.crt
- cert server.crt
- key server.key
- dh dh2048.pem
- server 10.8.0.0 255.255.255.0
- user nobody
- username-as-common-name
- client-cert-not-required
- auth-user-pass-verify /etc/openvpn/script/authvpn.sh via-env
- push "redirect-gateway def1 bypass-dhcp"
- push "dhcp-option DNS 8.8.4.4"
- push "dhcp-option DNS 8.8.8.8"
- client-to-client
- keepalive 10 120
- comp-lzo
- script-security 3
- client-connect /etc/openvpn/script/connect.sh
- client-disconnect /etc/openvpn/script/disconnect.sh
- status /var/www/html/stat/status.txt
- persist-key
- persist-tun
- verb 3
- EOM
- cat <<\EOM >/etc/openvpn/server2.conf
- port 110
- sndbuf 0
- rcvbuf 0
- push "sndbuf 393216"
- push "rcvbuf 393216"
- reneg-sec 432000
- push "persist-key"
- push "persist-tun"
- proto tcp
- dev tun
- ca ca.crt
- cert server.crt
- key server.key
- dh dh2048.pem
- server 10.9.0.0 255.255.255.0
- user nobody
- username-as-common-name
- client-cert-not-required
- auth-user-pass-verify /etc/openvpn/script/authvpn.sh via-env
- push "redirect-gateway def1 bypass-dhcp"
- push "dhcp-option DNS 8.8.4.4"
- push "dhcp-option DNS 8.8.8.8"
- client-to-client
- keepalive 10 120
- comp-lzo
- script-security 3
- #client-connect /etc/openvpn/script/connect.sh
- #client-disconnect /etc/openvpn/script/disconnect.sh
- #status /var/www/html/stat/status.txt
- persist-key
- persist-tun
- verb 3
- EOM
- cat <<\EOM >/etc/openvpn/ca.crt
- -----BEGIN CERTIFICATE-----
- MIIE5TCCA82gAwIBAgIJAP0GLynOqm38MA0GCSqGSIb3DQEBCwUAMIGnMQswCQYD
- VQQGEwJQSDERMA8GA1UECBMIQmF0YW5nYXMxETAPBgNVBAcTCEJhdGFuZ2FzMRIw
- EAYDVQQKEwlTYXZhZ2VWUE4xEjAQBgNVBAsTCVNhdmFnZVZQTjEWMBQGA1UEAxMN
- c2F2YWdlLXZwbi50azEPMA0GA1UEKRMGc2VydmVyMSEwHwYJKoZIhvcNAQkBFhJz
- YXZhZ2U5OUBnbWFpbC5jb20wHhcNMTgwNDIwMDQ1MTMyWhcNMjgwNDE3MDQ1MTMy
- WjCBpzELMAkGA1UEBhMCUEgxETAPBgNVBAgTCEJhdGFuZ2FzMREwDwYDVQQHEwhC
- YXRhbmdhczESMBAGA1UEChMJU2F2YWdlVlBOMRIwEAYDVQQLEwlTYXZhZ2VWUE4x
- FjAUBgNVBAMTDXNhdmFnZS12cG4udGsxDzANBgNVBCkTBnNlcnZlcjEhMB8GCSqG
- SIb3DQEJARYSc2F2YWdlOTlAZ21haWwuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOC
- AQ8AMIIBCgKCAQEAwMNjUVNKJvcMBAx5k/doMtYwVhoSV2gnxA16rtZMnkckHRQc
- ApvgSWOBc0e2OgL+rlb48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E-----
- EOM
- cat <<\EOM >/etc/openvpn/dh2048.pem
- -----BEGIN DH PARAMETERS-----
- MIIBCAKCAQEA0ICVDq0dT7Px8IEaEU0EBWEmOVW2EWUOi4pma37x+auX5h+27OjT
- C3qvt4fNOXuPRf0CMDIpR9yOjraEqRNv2sPK8MGBRrK2a/DaBvETxWJyQS1g3Vs3
- sUBsFtRW/XTF+ziEbTZX4V9jyIWh6m05XkjfNv20szMG91QMotOKup3qYTM5xmgI
- HOukzE+/oRh6wxOAp5/fo2yAcpNKTt0QVcwJYSGFyAqV9QfyLHTCXPo0RFxMnifg
- fsqRRlPApW0XeE2VPdHHETsEGdGPT5w67X6Y/o5RHuyaDgJa4HqHfjKauCI8RFji
- x2VycpPPw21XKLXkwnuC0TVprwWcqOMFcwIBAg==
- -----END DH PARAMETERS-----
- EOM
- cat <<\EOM >/etc/openvpn/server.crt
- Certificate:
- Data:
- Version: 3 (0x2)
- Serial Number: 1 (0x1)
- Signature Algorithm: sha256WithRSAEncryption
- Issuer: C=PH, ST=Mandaue Cebu, L=Mandaue Cebu, O=SavageVPN, OU=SavageVPN, CN=savage-vpn.tk/name=server/emailAddress=savage99@gmail.com
- Validity
- Not Before: Apr 20 04:53:44 2018 GMT
- Not After : Apr 17 04:53:44 2028 GMT
- Subject: C=PH, ST=Mandaue Cebu, L=Mandaue Cebu, O=SavageVPN, OU=SavageVPN, CN=savage-vpn.tk/name=server/emailAddress=savage99@gmail.com
- Subject Public Key Info:
- Public Key Algorithm: rsaEncryption
- Public-Key: (2048 bit)
- Modulus:
- 00:b6:a9:b9:e6:f9:19:85:24:ba:6b:dc:7e:b2:d4:
- 2c:01:46:26:fa:3e:41:ee:0c:b9:18:27:99:34:27:
- 61:eb:4f:cb:83:c0:0b:43:27:05:53:a5:b9:3c:5a:
- 8a:c5:7e:2e:72:1d:f9:83:97:44:b5:00:21:36:d7:
- 51:27:be:b7:d0:0c:2c:09:38:52:a0:e0:89:6f:cb:
- 0e:11:37:d9:7c:43:fe:b1:25:c1:2f:78:25:c1:a0:
- 15:c9:1d:35:b6:1d:33:e9:e6:75:83:4b:30:54:a4:
- 4e:f5:01:ae:fc:0c:37:c0:c7:07:43:4c:04:50:80:
- c8:13:9a:27:4c:d1:6d:c6:87:e4:38:38:67:c1:87:
- e4:3a:e3:79:11:c1:23:d4:2c:72:b7:0c:60:72:c7:
- 29:7e:36:17:09:2d:ca:9d:b3:49:2f:2f:56:85:a9:
- 24:34:5a:e7:eb:4b:ee:cf:43:bb:20:ef:dc:26:95:
- e6:dd:3a:8a:61:d8:33:b0:28:0f:fb:ce:d9:db:dd:
- ca:2f:85:f0:ec:66:58:67:77:8e:e0:a0:21:f8:b5:
- fe:e3:02:7e:3c:9c:5c:91:65:1a:bc:3c:6f:ce:3d:
- b8:38:8e:b0:d4:5b:ef:a5:e1:b3:0c:f4:bf:49:95:
- 7b:1f:9f:41:9f:ce:fa:ae:e1:e7:68:f4:f9:a6:99:
- 74:95
- Exponent: 65537 (0x10001)
- X509v3 extensions:
- X509v3 Basic Constraints:
- CA:FALSE
- Netscape Cert Type:
- SSL Server
- Netscape Comment:
- Easy-RSA Generated Server Certificate
- X509v3 Subject Key Identifier:
- 0C:4B:B3:78:75:C7:5E:C8:16:D2:A7:BC:8E:15:3F:33:E3:58:19:04
- X509v3 Authority Key Identifier:
- keyid:30:B7:64:91:7B:B4:F6:D0:F5:25:03:32:6E:8F:D2:1C:57:9A:F3:48
- DirName:/C=PH/ST=Batangas/L=Batangas/O=SavageVPN/OU=SavageVPN/CN=savage-vpn.tk/name=server/emailAddress=savage99@gmail.com
- serial:FD:06:2F:29:CE:AA:6D:FC
- X509v3 Extended Key Usage:
- TLS Web Server Authentication
- X509v3 Key Usage:
- Digital Signature, Key Encipherment
- X509v3 Subject Alternative Name:
- DNS:server
- Signature Algorithm: sha256WithRSAEncryption
- 95:13:80:8a:95:42:9e:16:b6:58:5f:4a:d2:74:61:fb:25:04:
- 3c:77:fa:09:41:05:e3:9b:df:93:4e:65:8e:b8:05:87:35:c0:
- 9a:eb:62:fa:16:0d:15:28:79:b7:7f:8c:55:72:7a:31:16:3f:
- ff:ba:29:70:0c:96:78:6e:1e:a9:ff:42:d7:f2:53:43:e6:f3:
- a4:3a:02:7b:85:18:18:bc:b6:56:47:3b:be:ae:6f:1c:93:8b:
- 13:55:0d:b1:51:30:c2:f4:03:c9:a9:cf:bb:ad:60:70:ec:32:
- 1e:e5:74:d5:4d:2b:5e:02:73:28:b0:84:28:f4:6c:93:45:a1:
- f8:3c:58:91:38:21:7b:b2:8f:fe:26:4c:18:72:a3:13:79:46:
- b8:43:8c:cc:5c:03:7c:20:8a:51:25:8b:d0:80:a8:ae:33:5c:
- 19:20:f6:a9:02:39:47:42:1d:37:c6:ec:9f:6e:80:5b:61:0b:
- 53:bf:26:4b:6d:b5:a6:98:21:e0:ad:42:3a:7d:3f:c9:00:a3:
- 61:4c:76:e0:45:36:0b:7e:71:38:37:4f:73:a9:6f:bf:7a:77:
- 04:8d:27:cb:e3:d4:11:f4:c3:c5:85:c2:1d:8a:9f:3b:da:43:
- 97:8d:f3:3e:30:51:b4:ad:2b:65:04:58:f3:95:7f:23:b2:3a:
- f8:bd:7c:f8
- -----BEGIN CERTIFICATE-----
- MIIFWDCCBECgAwIBAgIBATANBgkqhkiG9w0BAQsFADCBpzELMAkGA1UEBhMCUEgx
- ETAPBgNVBAgTCEJhdGFuZ2FzMREwDwYDVQQHEwhCYXRhbmdhczESMBAGA1UEChMJ
- U2F2YWdlVlBOMRIwEAYDVQQLEwlTYXZhZ2VWUE4xFjAUBgNVBAMTDXNhdmFnZS12
- cG4udGsxDzANBgNVBCkTBnNlcnZlcjEhMB8GCSqGSIb3DQEJARYSc2F2YWdlOTlA
- Z21haWwuY29tMB4XDTE4MDQyMDA0NTM0NFoXDTI4MDQxNzA0NTM0NFowgacxCzAJ
- BgNVBAYTAlBIMREwDwYDVQQIEwhCYXRhbmdhczERMA8GA1UEBxMIQmF0YW5nYXMx
- EjAQBgNVBAoT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m+ntgV3+QioNbRWhG9fb
- -----END PRIVATE KEY-----
- EOM
- cat <<\EOM >/etc/openvpn/script/config.sh
- #!/bin/bash
- HOST='DBHOST'
- USER='DBUSER'
- PASS='DBPASS'
- DB='DBNAME'
- EOM
- cat <<\EOM >/etc/openvpn/script/connect.sh
- #!/bin/bash
- . /etc/openvpn/script/config.sh
- ##tm="$(date +%s)"
- ##dt="$(date +'%Y-%m-%d %H:%M:%S')"
- ##timestamp="$(date +'%FT%TZ')"
- ##set status online to user connected
- mysql -u $USER -p$PASS -D $DB -h $HOST -e "UPDATE users SET is_active=1 WHERE user_name='$common_name' "
- EOM
- cat <<\EOM >/etc/openvpn/script/disconnect.sh
- #!/bin/bash
- . /etc/openvpn/script/config.sh
- tm="$(date +%s)"
- dt="$(date +'%Y-%m-%d %H:%M:%S')"
- timestamp="$(date +'%FT%TZ')"
- ##mysql -u $USER -p$PASS -D $DB -h $HOST -sN -e "UPDATE bandwidth_logs SET bytes_received='$bytes_received',bytes_sent='$bytes_sent',time_out='$dt', status='offline' WHERE username='$common_name' AND status='online' AND category='vip' "
- mysql -u $USER -p$PASS -D $DB -h $HOST -sN -e "UPDATE users SET is_active=0 WHERE user_name='$common_name' "
- EOM
- cat <<EOF >/etc/privoxy/config
- user-manual /usr/share/doc/privoxy/user-manual
- confdir /etc/privoxy
- logdir /var/log/privoxy
- filterfile default.filter
- logfile logfile
- listen-address 0.0.0.0:8080
- toggle 1
- enable-remote-toggle 0
- enable-remote-http-toggle 0
- enable-edit-actions 0
- enforce-blocks 0
- buffer-limit 4096
- enable-proxy-authentication-forwarding 1
- forwarded-connect-retries 1
- accept-intercepted-requests 1
- allow-cgi-request-crunching 1
- split-large-forms 0
- keep-alive-timeout 5
- tolerate-pipelining 1
- socket-timeout 300
- permit-access 0.0.0.0/0 `curl ipecho.net/plain`
- EOF
- cat <<EOF >/etc/stunnel/stunnel.pem
- -----BEGIN RSA PRIVATE KEY-----
- MIIEpQIBAAKCAQEAyN+jQb8vvS1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GSIb3DQEJARYUc3Ryb25nLXZwbkBnbWFpbC5jb20wggEiMA0G
- CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDI36NBvy+9LWPBtBJcA/0fRqVHG5e6
- KOEine7WB48YGwYsaDwJZCt2FsHjRbs6/bHODgrKJHAuBx+c4/a0e+2w3sHMLwNa
- uqpmw3IQ0PIizexfmhz4kYtBkmK/ZBIA/c3/j9QACzBScZFbVPNAVchJJV6JJwGw
- H3ouhUuI90DV7geGORu+CAs4cdNxepzUEHMi316DrvY77KIguw4W5g8aHdMHBVnQ
- O8phmhwSwn9ETE64AgPHT5MeWnI7c9mEijcQ3kFUKYFyxRugHIf38uyH7Xm0mqm8
- zy6IH2mPGVZSJE2IeOYnn6k5ZfgWkaWCslRhJKxRR11eY9VYCPUF5DYbAgMBAAGj
- UDBOMB0GA1UdDgQWBBTxI2YSnxnuDpwgxKOUgglmgiH/vDAfBgNVHSMEGDAWgBTx
- I2YSnxnuDpwgxKOUgglmgiH/vDAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBCwUA
- A4IBAQC30dcIPWlFfBEK/vNzG1Dx+BWkHCfd2GfmVc+VYSpmiTox13jKBOyEdQs4
- xxB7HiESKkpAjQ0YC3mjE6F53NjK0VqdfzXhopg9i/pQJiaX0KTTcWIelsJNg2aM
- s8GZ0nWSytcAqAV6oCnn+eOT/IqnO4ihgmaVIyhfYvRgXfPU/TuERtL9f8pAII44
- jAVcy60MBZ1bCwQZcToZlfWCpO/8nLg4nnv4e3W9UeC6rDgWgpI6IXS3jikN/x3P
- 9JIVFcWLtsOLC+D/33jSV8XDM3qTTRv4i/M+mva6znOI89KcBjsEhX5AunSQZ4Zg
- QkQTJi/td+5kVi00NXxlHYH5ztS1
- -----END CERTIFICATE-----
- EOF
- cat <<EOF >/etc/stunnel/stunnel.conf
- cert = /etc/stunnel/stunnel.pem
- client = no
- socket = a:SO_REUSEADDR=1
- socket = l:TCP_NODELAY=1
- socket = r:TCP_NODELAY=1
- [SSH]
- accept = 443
- connect = 127.0.0.1:22
- EOF
- }
- iptable_rules (){
- echo "
- net.ipv4.ip_forward = 1
- " > /etc/sysctl.conf
- sysctl -p
- chmod -R 755 /etc/openvpn
- iptables -t nat -A POSTROUTING -s 10.8.0.0/16 -o eth0 -j MASQUERADE
- iptables -t nat -A POSTROUTING -s 10.8.0.0/16 -o eth0 -j SNAT --to-source `curl ipecho.net/plain`
- iptables -t nat -A POSTROUTING -s 10.8.0.0/16 -o ens3 -j MASQUERADE
- iptables -t nat -A POSTROUTING -s 10.8.0.0/16 -o ens3 -j SNAT --to-source `curl ipecho.net/plain`
- iptables -t nat -A POSTROUTING -s 10.9.0.0/16 -o eth0 -j MASQUERADE
- iptables -t nat -A POSTROUTING -s 10.9.0.0/16 -o eth0 -j SNAT --to-source `curl ipecho.net/plain`
- iptables -t nat -A POSTROUTING -s 10.9.0.0/16 -o ens3 -j MASQUERADE
- iptables -t nat -A POSTROUTING -s 10.9.0.0/16 -o ens3 -j SNAT --to-source `curl ipecho.net/plain`
- systemctl start openvpn
- }
- change_details (){
- sed -i 's/ENABLED=0/ENABLED=1/g' /etc/default/stunnel4
- sed -i "s|DBHOST|$HOST|g" /etc/openvpn/script/config.sh
- sed -i "s|DBUSER|$USER|g" /etc/openvpn/script/config.sh
- sed -i "s|DBPASS|$PASS|g" /etc/openvpn/script/config.sh
- sed -i "s|DBNAME|$DBNAME|g" /etc/openvpn/script/config.sh
- }
- enable_server () {
- systemctl enable privoxy
- systemctl enable stunnel4
- systemctl enable openvpn
- service ssh restart
- systemctl restart privoxy
- systemctl restart stunnel4
- systemctl restart openvpn
- }
- display_memo () {
- clear
- echo -e "${YELLOW}#############################################"
- echo -e "# ${YELLOW}DEBIAN9 Setup Dual POrt OPENVPN/SSH/SSL #"
- echo -e "# ${YELLOW} TAKASIVPN PRO #"
- echo -e "# ${YELLOW}Setup by: dev_orly of scripsteam #"
- echo -e "# ${YELLOW}Dont EDIT CODES: CASE---- SENSITIVE #"
- echo -e "# ${YELLOW}owner: Takashi #"
- echo -e "#############################################${RESET}"
- }
- install_cron (){
- crontab -l > mycron;.
- echo "*/5 * * * * php /root/ssh.php >/dev/null 2>&1" >> mycron;
- echo "*/5 * * * * bash /root/active.sh >/dev/null 2>&1" >> mycron;
- echo "*/5 * * * * bash /root/inactive.sh >/dev/null 2>&1" >> mycron;
- crontab mycron;
- rm mycron;
- service cron restart;
- sed -i "s|DBHOST|$HOST|g" /root/ssh.php
- sed -i "s|DBUSER|$USER|g" /root/ssh.php
- sed -i "s|DBPASS|$PASS|g" /root/ssh.php
- sed -i "s|DBNAME|$DBNAME|g" /root/ssh.php
- }
- display_memo
- PS3='Please enter your choice:'
- options=("Install Prem" "Install VIP" "Install PRIVATE" "Quit")
- select opt in "${options[@]}"
- do
- case $opt in
- "Install Prem")
- clear
- display_memo
- install_packages
- create_directory
- cat <<\EOM >/etc/openvpn/script/authvpn.sh
- #!/bin/bash
- . /etc/openvpn/script/config.sh
- user_name=`mysql -u $USER -p$PASS -h $HOST $DB -sN -e "SELECT user_name FROM users WHERE user_name='$username' AND user_pass='$password' AND is_validated=1 AND frozen=0 AND (duration > 0 OR vip_duration > 0 OR private_duration > 0)"`
- [ "$user_name" != '' ] && [ "$user_name" = "$username" ] && echo "user : $username" && echo 'authentication ok.' && exit 0 || echo 'Mali User Or Pass'; exit 1
- EOM
- create_files
- iptable_rules &> /dev/null
- change_details
- enable_server
- ##ssh link pls change this to your link
- wget -O ssh.php strongteam.co/lamborghini/premiumssh.sh
- install_cron
- display_memo
- echo -e "$GREEN Installation Done....$RESET"
- rm -f install.sh
- break;;
- "Install VIP")
- clear
- display_memo
- install_packages
- create_directory
- cat <<\EOM >/etc/openvpn/script/authvpn.sh
- #!/bin/bash
- . /etc/openvpn/script/config.sh
- user_name=`mysql -u $USER -p$PASS -h $HOST $DB -sN -e "SELECT user_name FROM users WHERE user_name='$username' AND user_pass='$password' AND is_validated=1 AND frozen=0 AND (vip_duration > 0 OR private_duration > 0)"`
- [ "$user_name" != '' ] && [ "$user_name" = "$username" ] && echo "user : $username" && echo 'authentication ok.' && exit 0 || echo 'Mali User Or Pass'; exit 1
- EOM
- create_files
- iptable_rules &> /dev/null
- change_details
- enable_server
- ##ssh link pls change this to your link
- wget -O ssh.php strongteam.co/lamborghini/vipssh.sh
- install_cron
- display_memo
- echo -e "$GREEN Installation Done....$RESET"
- rm -f install.sh
- break;;
- "Install PRIVATE")
- clear
- display_memo
- install_packages
- create_directory
- cat <<\EOM >/etc/openvpn/script/authvpn.sh
- #!/bin/bash
- . /etc/openvpn/script/config.sh
- user_name=`mysql -u $USER -p$PASS -h $HOST $DB -sN -e "SELECT user_name FROM users WHERE user_name='$username' AND user_pass='$password' AND is_validated=1 AND frozen=0 AND private_duration > 0"`
- [ "$user_name" != '' ] && [ "$user_name" = "$username" ] && echo "user : $username" && echo 'authentication ok.' && exit 0 || echo 'Mali User Or Pass'; exit 1
- EOM
- create_files
- iptable_rules &> /dev/null
- change_details
- enable_server
- ##ssh link pls change this to your link
- wget -O ssh.php strongteam.co/lamborghini/privatessh.sh
- install_cron
- display_memo
- echo -e "$GREEN Installation Done....$RESET"
- rm -f install.sh
- break;;
- "Quit")
- rm -f install.sh
- break
- ;;
- *) echo invalid option;;
- esac
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement