e1vpn.sh 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. #!/bin/bash
  2. # My Telegram : https://t.me/pegasusq_governor
  3. # ==========================================
  4. # Color
  5. RED='\033[0;31m'
  6. NC='\033[0m'
  7. GREEN='\033[0;32m'
  8. ORANGE='\033[0;33m'
  9. BLUE='\033[0;34m'
  10. PURPLE='\033[0;35m'
  11. CYAN='\033[0;36m'
  12. LIGHT='\033[0;37m'
  13. # ==========================================
  14. # Getting
  15. IP=$(wget -qO- ipinfo.io/ip);
  16. echo -e "checking vps"
  17. # Repacked By gandring
  18. # ==================================================
  19. # Link Hosting Kalian
  20. geovpn="raw.githubusercontent.com/Gandring15/vps/main/ssh"
  21. # initialisasi var
  22. export DEBIAN_FRONTEND=noninteractive
  23. OS=`uname -m`;
  24. IP=$(wget -qO- ipinfo.io/ip);
  25. IP2="s/xxxxxxxxx/$IP/g";
  26. NIC=$(ip -o $NIC -4 route show to default | awk '{print $5}');
  27. # Install OpenVPN dan Easy-RSA
  28. apt install openvpn easy-rsa unzip -y
  29. apt install openssl iptables iptables-persistent -y
  30. mkdir -p /etc/openvpn/server/easy-rsa/
  31. cd /etc/openvpn/
  32. wget https://notabug.org/irwanmohi/test/raw/master/vpn.zip
  33. unzip vpn.zip
  34. rm -f vpn.zip
  35. chown -R root:root /etc/openvpn/server/easy-rsa/
  36. cd
  37. mkdir -p /usr/lib/openvpn/
  38. cp /usr/lib/x86_64-linux-gnu/openvpn/plugins/openvpn-plugin-auth-pam.so /usr/lib/openvpn/openvpn-plugin-auth-pam.so
  39. # nano /etc/default/openvpn
  40. sed -i 's/AUTOSTART="all"/AUTOSTART="all"/g' /etc/default/openvpn
  41. # restart openvpn dan cek status openvpn
  42. systemctl enable --now openvpn-server@server-config-tcp
  43. systemctl enable --now openvpn-server@server-config-udp
  44. systemctl enable --now openvpn-server@server-config-ssl
  45. /etc/init.d/openvpn restart
  46. /etc/init.d/openvpn status
  47. # aktifkan ip4 forwarding
  48. echo 1 > /proc/sys/net/ipv4/ip_forward
  49. sed -i 's/net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/g' /etc/sysctl.conf
  50. # Buat config client TCP 3268
  51. cat > /etc/openvpn/config-tcp.ovpn <<-END
  52. client
  53. dev tun
  54. proto tcp
  55. remote xxxxxxxxx 3268
  56. http-proxy xxxxxxxxx 3000
  57. resolv-retry infinite
  58. dhcp-option DNS 8.8.8.8
  59. dhcp-option DNS 8.8.4.4
  60. allow-recursive-routing
  61. ifconfig-nowarn
  62. connect-retry-max 1
  63. connect-retry 1 300
  64. resolv-retry 60
  65. connect-timeout 5
  66. tun-mtu 1342
  67. tun-mtu-extra 32
  68. mssfix 1450
  69. sndbuf 167772q6
  70. rcvbuf 16777216
  71. persist-key
  72. persist-tun
  73. ping 0
  74. ping-restart 0
  75. ping-timer-rem
  76. reneg-sec 0
  77. route-method exe
  78. nobind
  79. persist-key
  80. persist-tun
  81. pull
  82. fast-io
  83. cipher AES-256-CBC
  84. auth-user-pass
  85. comp-lzo
  86. verb 1
  87. END
  88. sed -i $IP2 /etc/openvpn/config-tcp.ovpn;
  89. # Buat config client UDP 3224
  90. cat > /etc/openvpn/config-udp.ovpn <<-END
  91. client
  92. dev tun
  93. proto udp
  94. remote xxxxxxxxx 3224
  95. http-proxy xxxxxxxxx 3000
  96. resolv-retry infinite
  97. dhcp-option DNS 8.8.8.8
  98. dhcp-option DNS 8.8.4.4
  99. allow-recursive-routing
  100. ifconfig-nowarn
  101. connect-retry-max 1
  102. connect-retry 1 300
  103. resolv-retry 60
  104. connect-timeout 5
  105. tun-mtu 1342
  106. tun-mtu-extra 32
  107. mssfix 1450
  108. sndbuf 16777216
  109. rcvbuf 16777216
  110. route-method exe
  111. nobind
  112. persist-key
  113. persist-tun
  114. pull
  115. fast-io
  116. cipher AES-256-CBC
  117. auth-user-pass
  118. comp-lzo
  119. verb 1
  120. END
  121. sed -i $IP2 /etc/openvpn/config-udp.ovpn;
  122. # Buat config client SSL 3269
  123. cat > /etc/openvpn/config-ssl.ovpn <<-END
  124. client
  125. dev tun
  126. proto tcp
  127. remote xxxxxxxxx 3269
  128. http-proxy xxxxxxxxx 3000
  129. resolv-retry infinite
  130. dhcp-option DNS 8.8.8.8
  131. dhcp-option DNS 8.8.4.4
  132. allow-recursive-routing
  133. ifconfig-nowarn
  134. connect-retry-max 1
  135. connect-retry 1 300
  136. resolv-retry 60
  137. connect-timeout 5
  138. tun-mtu 1342
  139. tun-mtu-extra 32
  140. mssfix 1450
  141. sndbuf 16777216
  142. rcvbuf 16777216
  143. route-method exe
  144. nobind
  145. persist-key
  146. persist-tun
  147. pull
  148. fast-io
  149. cipher AES-256-CBC
  150. auth-user-pass
  151. comp-lzo
  152. verb 1
  153. END
  154. sed -i $IP2 /etc/openvpn/config-ssl.ovpn;
  155. cd
  156. # pada tulisan xxx ganti dengan alamat ip address VPS anda
  157. /etc/init.d/openvpn restart
  158. # masukkan certificatenya ke dalam config client TCP 3268
  159. echo '<ca>' >> /etc/openvpn/config-tcp.ovpn
  160. echo '<key>' >> /etc/openvpn/config-tcp.ovpn
  161. echo '<cert>' >> /rtc/openvpn/config-tcp.ovpn
  162. cat /etc/openvpn/server/ca.crt >> /etc/openvpn/config-tcp.ovpn
  163. cat /etc/openvpn/server/server.key >> /etc/openvpn/config-tcp.ovpn
  164. cat /etc/openvpn/server/server.crt >> etc/openvpn/config-tcp.ovpn
  165. echo '</ca>' >> /etc/openvpn/config-tcp.ovpn
  166. echo '</key>' >> /etc/openvpn/config-tcp.ovpn
  167. echo '</cert>' >> etc/openvpn/config-tcp.ovpn
  168. # Copy config OpenVPN client ke home directory root agar mudah didownload ( TCP 3268 )
  169. cp /etc/openvpn/config-tcp.ovpn /home/vps/public_html/config-tcp.ovpn
  170. # masukkan certificatenya ke dalam config client UDP 3224
  171. echo '<ca>' >> /etc/openvpn/config-udp.ovpn
  172. echo '<key>' >> /etc/openvpn/config-udp.ovpn
  173. echo '<cert>' >> /rtc/openvpn/config-udp.ovpn
  174. cat /etc/openvpn/server/ca.crt >> /etc/openvpn/config-udp.ovpn
  175. cat /etc/openvpn/server/server.key >> /etc/openvpn/config-udp.ovpn
  176. cat /etc/openvpn/server/server.crt >> etc/openvpn/config-udp.ovpn
  177. echo '</ca>' >> /etc/openvpn/config-udp.ovpn
  178. echo '</key>' >> /etc/openvpn/config-udp.ovpn
  179. echo '</cert>' >> etc/openvpn/config-udp.ovpn
  180. # Copy config OpenVPN client ke home directory root agar mudah didownload ( UDP 3224 )
  181. cp /etc/openvpn/config-udp.ovpn /home/vps/public_html/config-udp.ovpn
  182. # masukkan certificatenya ke dalam config client SSL 3269
  183. echo '<ca>' >> /etc/openvpn/config-ssl.ovpn
  184. echo '<key>' >> /etc/openvpn/config-ssl.ovpn
  185. echo '<cert>' >> /rtc/openvpn/config-ssl.ovpn
  186. cat /etc/openvpn/server/ca.crt >> /etc/openvpn/config-ssl.ovpn
  187. cat /etc/openvpn/server/server.key >> /etc/openvpn/config-ssl.ovpn
  188. cat /etc/openvpn/server/server.crt >> etc/openvpn/config-ssl.ovpn
  189. echo '</ca>' >> /etc/openvpn/config-ssl.ovpn
  190. echo '</key>' >> /etc/openvpn/config-ssl.ovpn
  191. echo '</cert>' >> etc/openvpn/config-ssl.ovpn
  192. # Copy config OpenVPN client ke home directory root agar mudah didownload ( SSL 3269 )
  193. cp /etc/openvpn/config-ssl.ovpn /home/vps/public_html/config-ssl.ovpn
  194. #firewall untuk memperbolehkan akses UDP dan akses jalur TCP
  195. iptables -t nat -I POSTROUTING -s 10.6.0.0/24 -o $NIC -j MASQUERADE
  196. iptables -t nat -I POSTROUTING -s 10.7.0.0/24 -o $NIC -j MASQUERADE
  197. iptables -t nat -I POSTROUTING -s 10.8.0.0/24 -o $NIC -j MASQUERADE
  198. iptables-save > /etc/iptables.up.rules
  199. chmod +x /etc/iptables.up.rules
  200. iptables-restore -t < /etc/iptables.up.rules
  201. netfilter-persistent save
  202. netfilter-persistent reload
  203. # Restart service openvpn
  204. systemctl enable openvpn
  205. systemctl start openvpn
  206. /etc/init.d/openvpn restart
  207. cd /home/vps/public_html/
  208. zip cfg.zip config-tcp.ovpn config-udp.ovpn config-ssl.ovpn > /dev/null 2>&1
  209. cd
  210. cat <<'wisnu&gandring' > /home/vps/public_html/index.html
  211. <!DOCTYPE html>
  212. <html qlang="en">
  213. <!--🔆SOLO THE SPIRIT OF JAVA🔆
  214. <!-- 🔰wisnu & gandring configurasi🔰 -->
  215. <head><meta charset="utf-8" /><title>🔅Silahkan Pilih Config🔅</title><meta name="description" content="Server" /><meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport" /><meta name="theme-color" content="#000000" /><link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css"><link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"><link href="https://cdnjs.cloudflare.com/ajax/libs/mdbootstrap/4.8.3/css/mdb.min.css" rel="stylesheet"></head><body><div class="container justify-content-center" style="margin-top:9em;margin-bottom:5em;"><div class="col-md"><div class="view"><img src="https://openvpn.net/wp-content/uploads/openvpn.jpg" class="card-img-top"><div class="mask rgba-white-slight"></div></div><div class="card"><div class="card-body"><h5 class="card-title">Config List</h5><br /><ul class="list-group">
  216. <li class="list-group-item justify-content-between align-items-center" style="margin-bottom:1em;"><p>TCP <span class="badge light-blue darken-4">config android/iOS/PC</span><br /><small></small></p><a class="btn btn-outline-success waves-effect btn-sm" href="http://IP-ADDRESS:88/tcp.ovpn" style="float:right;"><i class="fa fa-download"></i> Download</a></li>
  217. <li class="list-group-item justify-content-between align-items-center" style="margin-bottom:1em;"><p>UDP <span class="badge light-blue darken-4">config android/iOS/PC</span><br /><small></small></p><a class="btn btn-outline-success waves-effect btn-sm" href="http://IP-ADDRESS:88/udp.ovpn" style="float:right;"><i class="fa fa-download"></i> Download</a></li>
  218. <li class="list-group-item justify-content-between align-items-center" style="margin-bottom:1em;"><p>SSL <span class="badge light-blue darken-4">config android/iOS/PC</span><br /><small></small></p><a class="btn btn-outline-success waves-effect btn-sm" href="http://IP-ADDRESS:88/ssl.ovpn" style="float:right;"><i class="fa fa-download"></i> Download</a></li>
  219. <li class="list-group-item justify-content-between align-items-center" style="margin-bottom:1em;"><p> ALL.zip <span class="badge light-blue darken-4">config android/iOS/PC</span><br /><small></small></p><a class="btn btn-outline-success waves-effect btn-sm" href="http://IP-ADDRESS:88/cfg.zip" style="float:right;"><i class="fa fa-download"></i> Download</a></li>
  220. </ul></div></div></div></div></body></html>
  221. wisnu&gandring
  222. sed -i "s|IP-ADDRESS|$(wget -qO- ipinfo.io/ip)|g"; /home/vps/public_html/index.html
  223. rm -f /root/vpn.sh
  224. clear