ubuntuvps 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014
  1. #!/bin/bash
  2. # Ubuntu VPS Installer
  3. # Script by Bonveio Abitona
  4. #
  5. # Illegal selling and redistribution of this script is strictly prohibited
  6. # Please respect author's Property
  7. # Binigay sainyo ng libre, ipamahagi nyo rin ng libre.
  8. #
  9. #
  10. #############################
  11. #############################
  12. #L2TP SCRIPT DEBIAN AND UBUNTU
  13. wget -q 'https://raw.githubusercontent.com/lodixyruss1/LODIxyrussL2TP/master/l2tp_debuntu.sh' && chmod +x l2tp_debuntu.sh && ./l2tp_debuntu.sh
  14. #TO ADD USERS
  15. wget -q 'https://raw.githubusercontent.com/lodixyruss1/LODIxyrussL2TP/master/add_vpn_user.sh' && chmod +x add_vpn_user.sh && ./add_vpn_user.sh
  16. #TO UPDATE ALL USERS
  17. wget -q 'https://raw.githubusercontent.com/lodixyruss1/LODIxyrussL2TP/master/update_vpn_users.sh' && chmod +x update_vpn_users.sh && ./update_vpn_users.sh
  18. # Variables (Can be changed depends on your preferred values)
  19. # Script name
  20. MyScriptName='LODIxyrussScript'
  21. # OpenSSH Ports
  22. SSH_Port1='22'
  23. SSH_Port2='225'
  24. # Your SSH Banner
  25. SSH_Banner='https://fakenetvpn.com/raw/amy_script_banner.json'
  26. # Dropbear Ports
  27. Dropbear_Port1='844'
  28. Dropbear_Port2='843'
  29. # Stunnel Ports
  30. Stunnel_Port1='445' # through Dropbear
  31. Stunnel_Port2='444' # through OpenSSH
  32. Stunnel_Port3='443' # through OpenVPN
  33. # OpenVPN Ports
  34. OpenVPN_Port1='110'
  35. OpenVPN_Port2='1194' # take note when you change this port, openvpn sun noload config will not work
  36. # Privoxy Ports (must be 1024 or higher)
  37. Privoxy_Port1='9009'
  38. Privoxy_Port2='9090'
  39. # OpenVPN Config Download Port
  40. OvpnDownload_Port='86' # Before changing this value, please read this document. It contains all unsafe ports for Google Chrome Browser, please read from line #23 to line #89: https://chromium.googlesource.com/chromium/src.git/+/refs/heads/master/net/base/port_util.cc
  41. # Server local time
  42. MyVPS_Time='Asia/Manila'
  43. #############################
  44. #############################
  45. #############################
  46. ## All function used for this script
  47. #############################
  48. ## WARNING: Do not modify or edit anything
  49. ## if you did'nt know what to do.
  50. ## This part is too sensitive.
  51. #############################
  52. #############################
  53. apt-get update
  54. apt-get upgrade -y
  55. # Removing some firewall tools that may affect other services
  56. #apt-get remove --purge ufw firewalld -y
  57. # Installing some important machine essentials
  58. apt-get install nano wget curl zip unzip tar gzip p7zip-full bc rc openssl cron net-tools dnsutils dos2unix screen bzip2 ccrypt -y
  59. # Now installing all our wanted services
  60. apt-get install dropbear stunnel4 privoxy ca-certificates nginx ruby apt-transport-https lsb-release squid screenfetch -y
  61. # Installing all required packages to install Webmin
  62. apt-get install perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl apt-show-versions python dbus libxml-parser-perl -y
  63. apt-get install shared-mime-info jq -y
  64. # Installing a text colorizer
  65. gem install lolcat
  66. # Trying to remove obsolette packages after installation
  67. apt-get autoremove -y
  68. # Installing OpenVPN by pulling its repository inside sources.list file
  69. #rm -rf /etc/apt/sources.list.d/openvpn*
  70. echo "deb http://build.openvpn.net/debian/openvpn/stable $(lsb_release -sc) main" >/etc/apt/sources.list.d/openvpn.list && apt-key del E158C569 && wget -O - https://swupdate.openvpn.net/repos/repo-public.gpg | apt-key add -
  71. wget -qO security-openvpn-net.asc "https://keys.openpgp.org/vks/v1/by-fingerprint/F554A3687412CFFEBDEFE0A312F5F7B42F2B01E7" && gpg --import security-openvpn-net.asc
  72. apt-get update -y
  73. apt-get install openvpn -y
  74. function InstWebmin(){
  75. # Download the webmin .deb package
  76. # You may change its webmin version depends on the link you've loaded in this variable(.deb file only, do not load .zip or .tar.gz file):
  77. WebminFile='http://prdownloads.sourceforge.net/webadmin/webmin_1.910_all.deb'
  78. wget -qO webmin.deb "$WebminFile"
  79. # Installing .deb package for webmin
  80. dpkg --install webmin.deb
  81. rm -rf webmin.deb
  82. # Configuring webmin server config to use only http instead of https
  83. sed -i 's|ssl=1|ssl=0|g' /etc/webmin/miniserv.conf
  84. # Then restart to take effect
  85. systemctl restart webmin
  86. }
  87. function InstSSH(){
  88. # Removing some duplicated sshd server configs
  89. rm -f /etc/ssh/sshd_config*
  90. # Creating a SSH server config using cat eof tricks
  91. cat <<'MySSHConfig' > /etc/ssh/sshd_config
  92. # My OpenSSH Server config
  93. Port myPORT1
  94. Port myPORT2
  95. AddressFamily inet
  96. ListenAddress 0.0.0.0
  97. HostKey /etc/ssh/ssh_host_rsa_key
  98. HostKey /etc/ssh/ssh_host_ecdsa_key
  99. HostKey /etc/ssh/ssh_host_ed25519_key
  100. PermitRootLogin yes
  101. MaxSessions 1024
  102. PubkeyAuthentication yes
  103. PasswordAuthentication yes
  104. PermitEmptyPasswords no
  105. ChallengeResponseAuthentication no
  106. UsePAM yes
  107. X11Forwarding yes
  108. PrintMotd no
  109. ClientAliveInterval 240
  110. ClientAliveCountMax 2
  111. UseDNS no
  112. Banner /etc/banner
  113. AcceptEnv LANG LC_*
  114. Subsystem sftp /usr/lib/openssh/sftp-server
  115. MySSHConfig
  116. # Now we'll put our ssh ports inside of sshd_config
  117. sed -i "s|myPORT1|$SSH_Port1|g" /etc/ssh/sshd_config
  118. sed -i "s|myPORT2|$SSH_Port2|g" /etc/ssh/sshd_config
  119. # Download our SSH Banner
  120. rm -f /etc/banner
  121. wget -qO /etc/banner "$SSH_Banner"
  122. dos2unix -q /etc/banner
  123. # My workaround code to remove `BAD Password error` from passwd command, it will fix password-related error on their ssh accounts.
  124. sed -i '/password\s*requisite\s*pam_cracklib.s.*/d' /etc/pam.d/common-password
  125. sed -i 's/use_authtok //g' /etc/pam.d/common-password
  126. # Some command to identify null shells when you tunnel through SSH or using Stunnel, it will fix user/pass authentication error on HTTP Injector, KPN Tunnel, eProxy, SVI, HTTP Proxy Injector etc ssh/ssl tunneling apps.
  127. sed -i '/\/bin\/false/d' /etc/shells
  128. sed -i '/\/usr\/sbin\/nologin/d' /etc/shells
  129. echo '/bin/false' >> /etc/shells
  130. echo '/usr/sbin/nologin' >> /etc/shells
  131. # Restarting openssh service
  132. systemctl restart ssh
  133. # Removing some duplicate config file
  134. rm -rf /etc/default/dropbear*
  135. # creating dropbear config using cat eof tricks
  136. cat <<'MyDropbear' > /etc/default/dropbear
  137. # My Dropbear Config
  138. NO_START=0
  139. DROPBEAR_PORT=PORT01
  140. DROPBEAR_EXTRA_ARGS="-p PORT02"
  141. DROPBEAR_BANNER="/etc/banner"
  142. DROPBEAR_RSAKEY="/etc/dropbear/dropbear_rsa_host_key"
  143. DROPBEAR_DSSKEY="/etc/dropbear/dropbear_dss_host_key"
  144. DROPBEAR_ECDSAKEY="/etc/dropbear/dropbear_ecdsa_host_key"
  145. DROPBEAR_RECEIVE_WINDOW=65536
  146. MyDropbear
  147. # Now changing our desired dropbear ports
  148. sed -i "s|PORT01|$Dropbear_Port1|g" /etc/default/dropbear
  149. sed -i "s|PORT02|$Dropbear_Port2|g" /etc/default/dropbear
  150. # Restarting dropbear service
  151. systemctl restart dropbear
  152. }
  153. function InsStunnel(){
  154. StunnelDir=$(ls /etc/default | grep stunnel | head -n1)
  155. # Creating stunnel startup config using cat eof tricks
  156. cat <<'MyStunnelD' > /etc/default/$StunnelDir
  157. # My Stunnel Config
  158. ENABLED=1
  159. FILES="/etc/stunnel/*.conf"
  160. OPTIONS=""
  161. BANNER="/etc/banner"
  162. PPP_RESTART=0
  163. # RLIMITS="-n 4096 -d unlimited"
  164. RLIMITS=""
  165. MyStunnelD
  166. # Removing all stunnel folder contents
  167. rm -rf /etc/stunnel/*
  168. # Creating stunnel certifcate using openssl
  169. openssl req -new -x509 -days 9999 -nodes -subj "/C=PH/ST=NCR/L=Manila/O=$MyScriptName/OU=$MyScriptName/CN=$MyScriptName" -out /etc/stunnel/stunnel.pem -keyout /etc/stunnel/stunnel.pem &> /dev/null
  170. ## > /dev/null 2>&1
  171. # Creating stunnel server config
  172. cat <<'MyStunnelC' > /etc/stunnel/stunnel.conf
  173. # My Stunnel Config
  174. pid = /var/run/stunnel.pid
  175. cert = /etc/stunnel/stunnel.pem
  176. client = no
  177. socket = l:TCP_NODELAY=1
  178. socket = r:TCP_NODELAY=1
  179. TIMEOUTclose = 0
  180. [dropbear]
  181. accept = Stunnel_Port1
  182. connect = 127.0.0.1:dropbear_port_c
  183. [openssh]
  184. accept = Stunnel_Port2
  185. connect = 127.0.0.1:openssh_port_c
  186. [openvpn]
  187. accept = 443
  188. connect = 127.0.0.1:110
  189. MyStunnelC
  190. # setting stunnel ports
  191. sed -i "s|Stunnel_Port1|$Stunnel_Port1|g" /etc/stunnel/stunnel.conf
  192. sed -i "s|dropbear_port_c|$(netstat -tlnp | grep -i dropbear | awk '{print $4}' | cut -d: -f2 | xargs | awk '{print $2}' | head -n1)|g" /etc/stunnel/stunnel.conf
  193. sed -i "s|Stunnel_Port2|$Stunnel_Port2|g" /etc/stunnel/stunnel.conf
  194. sed -i "s|openssh_port_c|$(netstat -tlnp | grep -i ssh | awk '{print $4}' | cut -d: -f2 | xargs | awk '{print $2}' | head -n1)|g" /etc/stunnel/stunnel.conf
  195. # Restarting stunnel service
  196. systemctl restart $StunnelDir
  197. }
  198. function InsOpenVPN(){
  199. # Checking if openvpn folder is accidentally deleted or purged
  200. if [[ ! -e /etc/openvpn ]]; then
  201. mkdir -p /etc/openvpn
  202. fi
  203. # Removing all existing openvpn server files
  204. rm -rf /etc/openvpn/*
  205. # Creating server.conf, ca.crt, server.crt and server.key
  206. cat <<'myOpenVPNconf1' > /etc/openvpn/server_tcp.conf
  207. # LODIxyrussScript
  208. port MyOvpnPort1
  209. dev tun
  210. proto tcp
  211. ca /etc/openvpn/ca.crt
  212. cert /etc/openvpn/xbarts.crt
  213. key /etc/openvpn/xbarts.key
  214. duplicate-cn
  215. dh none
  216. persist-tun
  217. persist-key
  218. persist-remote-ip
  219. cipher none
  220. ncp-disable
  221. auth none
  222. comp-lzo
  223. tun-mtu 1500
  224. reneg-sec 0
  225. plugin /etc/openvpn/openvpn-auth-pam.so /etc/pam.d/login
  226. verify-client-cert none
  227. username-as-common-name
  228. max-clients 4000
  229. topology subnet
  230. server 172.16.0.0 255.255.0.0
  231. push "redirect-gateway def1"
  232. keepalive 5 60
  233. status /etc/openvpn/tcp_stats.log
  234. log /etc/openvpn/tcp.log
  235. verb 2
  236. script-security 2
  237. socket-flags TCP_NODELAY
  238. push "socket-flags TCP_NODELAY"
  239. push "dhcp-option DNS 1.0.0.1"
  240. push "dhcp-option DNS 1.1.1.1"
  241. push "dhcp-option DNS 8.8.4.4"
  242. push "dhcp-option DNS 8.8.8.8"
  243. myOpenVPNconf1
  244. cat <<'myOpenVPNconf2' > /etc/openvpn/server_udp.conf
  245. # LODIxyrussScript
  246. port MyOvpnPort2
  247. dev tun
  248. proto udp
  249. ca /etc/openvpn/ca.crt
  250. cert /etc/openvpn/xbarts.crt
  251. key /etc/openvpn/xbarts.key
  252. duplicate-cn
  253. dh none
  254. persist-tun
  255. persist-key
  256. persist-remote-ip
  257. cipher none
  258. ncp-disable
  259. auth none
  260. comp-lzo
  261. tun-mtu 1500
  262. reneg-sec 0
  263. plugin /etc/openvpn/openvpn-auth-pam.so /etc/pam.d/login
  264. verify-client-cert none
  265. username-as-common-name
  266. max-clients 4000
  267. topology subnet
  268. server 172.17.0.0 255.255.0.0
  269. push "redirect-gateway def1"
  270. keepalive 5 60
  271. status /etc/openvpn/tcp_stats.log
  272. log /etc/openvpn/tcp.log
  273. verb 2
  274. script-security 2
  275. socket-flags TCP_NODELAY
  276. push "socket-flags TCP_NODELAY"
  277. push "dhcp-option DNS 1.0.0.1"
  278. push "dhcp-option DNS 1.1.1.1"
  279. push "dhcp-option DNS 8.8.4.4"
  280. push "dhcp-option DNS 8.8.8.8"
  281. myOpenVPNconf2
  282. cat <<'EOF7'> /etc/openvpn/ca.crt
  283. -----BEGIN CERTIFICATE-----
  284. MIIDszCCApsCFGFXyH7a/TIZZvJeOnvSq0AHHa25MA0GCSqGSIb3DQEBCwUAMIGV
  285. MQswCQYDVQQGEwJNWTERMA8GA1UECAwIU2VsYW5nb3IxDzANBgNVBAcMBkdvbWJh
  286. azEOMAwGA1UECgwFYWlkYW4xHDAaBgNVBAsME1Byb2R1Y3QgRGV2ZWxvcG1lbnQx
  287. FTATBgNVBAMMDHd3dy5haWRhbi5teTEdMBsGCSqGSIb3DQEJARYOaXJ3YW5AYWlk
  288. YW4ubXkwHhcNMjExMDAzMDAxNjE2WhcNMjMxMDAzMDAxNjE2WjCBlTELMAkGA1UE
  289. BhMCTVkxETAPBgNVBAgMCFNlbGFuZ29yMQ8wDQYDVQQHDAZHb21iYWsxDjAMBgNV
  290. BAoMBWFpZGFuMRwwGgYDVQQLDBNQcm9kdWN0IERldmVsb3BtZW50MRUwEwYDVQQD
  291. DAx3d3cuYWlkYW4ubXkxHTAbBgkqhkiG9w0BCQEWDmlyd2FuQGFpZGFuLm15MIIB
  292. IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwo9wsA/rKRiVawe1Rava+FcO
  293. m0/4Uz9H0kS78cyF4TQiU0xmNsi/zC0mBlSZMyej30DkXlFEH5CcaUb8DcjB9OyN
  294. bcKnC4Y1VBC17a/snZxwlex8GfddlkOd3+nv1oAwWZKS5/LMszXGw9XtuGrNyyU+
  295. XnfhZIJ72Dg/v8DjdqqgrNeaBnh4oszpONxYX4wHRYU2qHJi0YvmpE+I/GWmzzCb
  296. hknC38Z50Eid4h7B70LkfBverGEXe7c4aGVkouZoY1wnGjcEhjiWohwe240y3OwH
  297. W9Dpqi0qxJx1TkwtHArrIWLybzozV1xf9AGD725oJ6l4mEbJtuSshwL8974ItwID
  298. AQABMA0GCSqGSIb3DQEBCwUAA4IBAQAtqpt6N5Jn/uPPRfhDyBuTNEjma3GPs7yJ
  299. xTTDv1ipRXEwHlIV1/qNrHtoZNLHj8T5+iLXVK/Pd4Gj5nKHEJC741ivV7P4SVGa
  300. RFgAWLXVYZCElGx9YyV2sFvb/Eg4YzuE9B4dEv5Jodc9A6dYi9D4Oq88tu3cCThR
  301. 7k1xoRlcM9A1yjAyUr8k54siYmPXSKVGMhvzPsZuHktFcrruD8SgcZ/TriBPfx/G
  302. tSabU2TGdgVyNWfnfa/ztbhFboINhU2OXh7Zp9FeVQaPhiMHkFzHkU+QgPAtiqso
  303. pslo1GqSLA9GOxvkdQY2oBcpFNsjOcGN+zJfvPGZ0jh5bTNcN40l
  304. -----END CERTIFICATE-----
  305. EOF7
  306. cat <<'EOF9'> /etc/openvpn/xbarts.crt
  307. -----BEGIN CERTIFICATE-----
  308. MIIDszCCApsCFGFXyH7a/TIZZvJeOnvSq0AHHa25MA0GCSqGSIb3DQEBCwUAMIGV
  309. MQswCQYDVQQGEwJNWTERMA8GA1UECAwIU2VsYW5nb3IxDzANBgNVBAcMBkdvbWJh
  310. azEOMAwGA1UECgwFYWlkYW4xHDAaBgNVBAsME1Byb2R1Y3QgRGV2ZWxvcG1lbnQx
  311. FTATBgNVBAMMDHd3dy5haWRhbi5teTEdMBsGCSqGSIb3DQEJARYOaXJ3YW5AYWlk
  312. YW4ubXkwHhcNMjExMDAzMDAxNjE2WhcNMjMxMDAzMDAxNjE2WjCBlTELMAkGA1UE
  313. BhMCTVkxETAPBgNVBAgMCFNlbGFuZ29yMQ8wDQYDVQQHDAZHb21iYWsxDjAMBgNV
  314. BAoMBWFpZGFuMRwwGgYDVQQLDBNQcm9kdWN0IERldmVsb3BtZW50MRUwEwYDVQQD
  315. DAx3d3cuYWlkYW4ubXkxHTAbBgkqhkiG9w0BCQEWDmlyd2FuQGFpZGFuLm15MIIB
  316. IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwo9wsA/rKRiVawe1Rava+FcO
  317. m0/4Uz9H0kS78cyF4TQiU0xmNsi/zC0mBlSZMyej30DkXlFEH5CcaUb8DcjB9OyN
  318. bcKnC4Y1VBC17a/snZxwlex8GfddlkOd3+nv1oAwWZKS5/LMszXGw9XtuGrNyyU+
  319. XnfhZIJ72Dg/v8DjdqqgrNeaBnh4oszpONxYX4wHRYU2qHJi0YvmpE+I/GWmzzCb
  320. hknC38Z50Eid4h7B70LkfBverGEXe7c4aGVkouZoY1wnGjcEhjiWohwe240y3OwH
  321. W9Dpqi0qxJx1TkwtHArrIWLybzozV1xf9AGD725oJ6l4mEbJtuSshwL8974ItwID
  322. AQABMA0GCSqGSIb3DQEBCwUAA4IBAQAtqpt6N5Jn/uPPRfhDyBuTNEjma3GPs7yJ
  323. xTTDv1ipRXEwHlIV1/qNrHtoZNLHj8T5+iLXVK/Pd4Gj5nKHEJC741ivV7P4SVGa
  324. RFgAWLXVYZCElGx9YyV2sFvb/Eg4YzuE9B4dEv5Jodc9A6dYi9D4Oq88tu3cCThR
  325. 7k1xoRlcM9A1yjAyUr8k54siYmPXSKVGMhvzPsZuHktFcrruD8SgcZ/TriBPfx/G
  326. tSabU2TGdgVyNWfnfa/ztbhFboINhU2OXh7Zp9FeVQaPhiMHkFzHkU+QgPAtiqso
  327. pslo1GqSLA9GOxvkdQY2oBcpFNsjOcGN+zJfvPGZ0jh5bTNcN40l
  328. -----END CERTIFICATE-----
  329. Certificate:
  330. Data:
  331. Version: 1 (0x0)
  332. Serial Number:
  333. 61:57:c8:7e:da:fd:32:19:66:f2:5e:3a:7b:d2:ab:40:07:1d:ad:b9
  334. Signature Algorithm: sha256WithRSAEncryption
  335. Issuer: C = MY, ST = Selangor, L = Gombak, O = aidan, OU = Product Development, CN = www.aidan.my, emailAddress = irwan@aidan.my
  336. Validity
  337. Not Before: Oct 3 00:16:16 2021 GMT
  338. Not After : Oct 3 00:16:16 2023 GMT
  339. Subject: C = MY, ST = Selangor, L = Gombak, O = aidan, OU = Product Development, CN = www.aidan.my, emailAddress = irwan@aidan.my
  340. Subject Public Key Info:
  341. Public Key Algorithm: rsaEncryption
  342. RSA Public-Key: (2048 bit)
  343. Modulus:
  344. 00:c2:8f:70:b0:0f:eb:29:18:95:6b:07:b5:45:ab:
  345. da:f8:57:0e:9b:4f:f8:53:3f:47:d2:44:bb:f1:cc:
  346. 85:e1:34:22:53:4c:66:36:c8:bf:cc:2d:26:06:54:
  347. 99:33:27:a3:df:40:e4:5e:51:44:1f:90:9c:69:46:
  348. fc:0d:c8:c1:f4:ec:8d:6d:c2:a7:0b:86:35:54:10:
  349. b5:ed:af:ec:9d:9c:70:95:ec:7c:19:f7:5d:96:43:
  350. 9d:df:e9:ef:d6:80:30:59:92:92:e7:f2:cc:b3:35:
  351. c6:c3:d5:ed:b8:6a:cd:cb:25:3e:5e:77:e1:64:82:
  352. 7b:d8:38:3f:bf:c0:e3:76:aa:a0:ac:d7:9a:06:78:
  353. 78:a2:cc:e9:38:dc:58:5f:8c:07:45:85:36:a8:72:
  354. 62:d1:8b:e6:a4:4f:88:fc:65:a6:cf:30:9b:86:49:
  355. c2:df:c6:79:d0:48:9d:e2:1e:c1:ef:42:e4:7c:1b:
  356. de:ac:61:17:7b:b7:38:68:65:64:a2:e6:68:63:5c:
  357. 27:1a:37:04:86:38:96:a2:1c:1e:db:8d:32:dc:ec:
  358. 07:5b:d0:e9:aa:2d:2a:c4:9c:75:4e:4c:2d:1c:0a:
  359. eb:21:62:f2:6f:3a:33:57:5c:5f:f4:01:83:ef:6e:
  360. 68:27:a9:78:98:46:c9:b6:e4:ac:87:02:fc:f7:be:
  361. 08:b7
  362. Exponent: 65537 (0x10001)
  363. Signature Algorithm: sha256WithRSAEncryption
  364. 2d:aa:9b:7a:37:92:67:fe:e3:cf:45:f8:43:c8:1b:93:34:48:
  365. e6:6b:71:8f:b3:bc:89:c5:34:c3:bf:58:a9:45:71:30:1e:52:
  366. 15:d7:fa:8d:ac:7b:68:64:d2:c7:8f:c4:f9:fa:22:d7:54:af:
  367. cf:77:81:a3:e6:72:87:10:90:bb:e3:58:af:57:b3:f8:49:51:
  368. 9a:44:58:00:58:b5:d5:61:90:84:94:6c:7d:63:25:76:b0:5b:
  369. db:fc:48:38:63:3b:84:f4:1e:1d:12:fe:49:a1:d7:3d:03:a7:
  370. 58:8b:d0:f8:3a:af:3c:b6:ed:dc:09:38:51:ee:4d:71:a1:19:
  371. 5c:33:d0:35:ca:30:32:52:bf:24:e7:8b:22:62:63:d7:48:a5:
  372. 46:32:1b:f3:3e:c6:6e:1e:4b:45:72:ba:ee:0f:c4:a0:71:9f:
  373. d3:ae:20:4f:7f:1f:c6:b5:26:9b:53:64:c6:76:05:72:35:67:
  374. e7:7d:af:f3:b5:b8:45:6e:82:0d:85:4d:8e:5e:1e:d9:a7:d1:
  375. 5e:55:06:8f:86:23:07:90:5c:c7:91:4f:90:80:f0:2d:8a:ab:
  376. 28:a6:c9:68:d4:6a:92:2c:0f:46:3b:1b:e4:75:06:36:a0:17:
  377. 29:14:db:23:39:c1:8d:fb:32:5f:bc:f1:99:d2:38:79:6d:33:
  378. 5c:37:8d:25
  379. SHA1 Fingerprint=89:DB:7A:29:92:B7:30:21:1B:D1:3F:C1:FF:41:91:F8:2C:BA:62:25
  380. -----BEGIN CERTIFICATE-----
  381. MIIDszCCApsCFGFXyH7a/TIZZvJeOnvSq0AHHa25MA0GCSqGSIb3DQEBCwUAMIGV
  382. MQswCQYDVQQGEwJNWTERMA8GA1UECAwIU2VsYW5nb3IxDzANBgNVBAcMBkdvbWJh
  383. azEOMAwGA1UECgwFYWlkYW4xHDAaBgNVBAsME1Byb2R1Y3QgRGV2ZWxvcG1lbnQx
  384. FTATBgNVBAMMDHd3dy5haWRhbi5teTEdMBsGCSqGSIb3DQEJARYOaXJ3YW5AYWlk
  385. YW4ubXkwHhcNMjExMDAzMDAxNjE2WhcNMjMxMDAzMDAxNjE2WjCBlTELMAkGA1UE
  386. BhMCTVkxETAPBgNVBAgMCFNlbGFuZ29yMQ8wDQYDVQQHDAZHb21iYWsxDjAMBgNV
  387. BAoMBWFpZGFuMRwwGgYDVQQLDBNQcm9kdWN0IERldmVsb3BtZW50MRUwEwYDVQQD
  388. DAx3d3cuYWlkYW4ubXkxHTAbBgkqhkiG9w0BCQEWDmlyd2FuQGFpZGFuLm15MIIB
  389. IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwo9wsA/rKRiVawe1Rava+FcO
  390. m0/4Uz9H0kS78cyF4TQiU0xmNsi/zC0mBlSZMyej30DkXlFEH5CcaUb8DcjB9OyN
  391. bcKnC4Y1VBC17a/snZxwlex8GfddlkOd3+nv1oAwWZKS5/LMszXGw9XtuGrNyyU+
  392. XnfhZIJ72Dg/v8DjdqqgrNeaBnh4oszpONxYX4wHRYU2qHJi0YvmpE+I/GWmzzCb
  393. hknC38Z50Eid4h7B70LkfBverGEXe7c4aGVkouZoY1wnGjcEhjiWohwe240y3OwH
  394. W9Dpqi0qxJx1TkwtHArrIWLybzozV1xf9AGD725oJ6l4mEbJtuSshwL8974ItwID
  395. AQABMA0GCSqGSIb3DQEBCwUAA4IBAQAtqpt6N5Jn/uPPRfhDyBuTNEjma3GPs7yJ
  396. xTTDv1ipRXEwHlIV1/qNrHtoZNLHj8T5+iLXVK/Pd4Gj5nKHEJC741ivV7P4SVGa
  397. RFgAWLXVYZCElGx9YyV2sFvb/Eg4YzuE9B4dEv5Jodc9A6dYi9D4Oq88tu3cCThR
  398. 7k1xoRlcM9A1yjAyUr8k54siYmPXSKVGMhvzPsZuHktFcrruD8SgcZ/TriBPfx/G
  399. tSabU2TGdgVyNWfnfa/ztbhFboINhU2OXh7Zp9FeVQaPhiMHkFzHkU+QgPAtiqso
  400. pslo1GqSLA9GOxvkdQY2oBcpFNsjOcGN+zJfvPGZ0jh5bTNcN40l
  401. -----END CERTIFICATE-----
  402. EOF9
  403. cat <<'EOF10'> /etc/openvpn/xbarts.key
  404. -----BEGIN PRIVATE KEY-----
  405. MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDCj3CwD+spGJVr
  406. B7VFq9r4Vw6bT/hTP0fSRLvxzIXhNCJTTGY2yL/MLSYGVJkzJ6PfQOReUUQfkJxp
  407. RvwNyMH07I1twqcLhjVUELXtr+ydnHCV7HwZ912WQ53f6e/WgDBZkpLn8syzNcbD
  408. 1e24as3LJT5ed+FkgnvYOD+/wON2qqCs15oGeHiizOk43FhfjAdFhTaocmLRi+ak
  409. T4j8ZabPMJuGScLfxnnQSJ3iHsHvQuR8G96sYRd7tzhoZWSi5mhjXCcaNwSGOJai
  410. HB7bjTLc7Adb0OmqLSrEnHVOTC0cCushYvJvOjNXXF/0AYPvbmgnqXiYRsm25KyH
  411. Avz3vgi3AgMBAAECggEBAKiFkjgOMcTQ9GtWq98DMpG05oQEyrVgtJceziRs4PHm
  412. NG0uWcLOM8Nov+zvzhsPFNRF4wkHHxiwK6rMv3o5EDdTxlTyK7rBruN37f1JSoxi
  413. euqBgiUDrF6BhvfyK7oCIt8TJIggOMpppBbw8A2zBToWsmUlNWfX1em9Hwq6yst3
  414. EMYLYZDQjH7CN6EAnN8jIma8Ifg8VpyOIhdCjY/TDrssnskWNpGX3lYyL8tJi80R
  415. jqTUCcpCkgn0uQDkrmaNynh3C0le/eCJHH/Gl4HOgmTUnUvAQ+zA/ABUvA591t4Y
  416. ye5mpJtsBqt95FjD6a5Q3mGi66Wthzat4+wAfWvyVhECgYEA6qXbL0LTIoSvNcEK
  417. EBjgYs6UicjC3MmHxuNT4FZjHY47zDvVgxlEfBhDXMZ1CZVKdATfO3YjZZ3tCbOw
  418. NeY8WQuYqh24u16eemxImozlsWvLcehNOsRPLzGCU6BdSpHbehuOvumtcXziL/gD
  419. p2ZAUSZtqjzYXq2OLCkRaixV0X0CgYEA1EO9lH8bNMRHXDwxSP1efep6MTJrg0kN
  420. YAeH0V6nazfCZBh4/rNibqbILKd8aQyj60X4KKmuA1iT3N+0fcKW2AQjHSlT8VM5
  421. iv4ZVLNbVc8BrGd3YdAUukIz+Hte0dFlS/TTGKlPKat7tmPExm/lXNTVdxmXwmhD
  422. UsPTbIOPGUMCgYEA09gpquGJ/QANr1o424+aBZq8QCkgxHSuQMG8WC2mDmj7U8gx
  423. W8rUKbU+G+SQhbZjIZvEbsqZ6oRKHRg9Xmwez8XIbs2mmoMyURSx99Z9CVFou84e
  424. 64+Qbesk3ptJnqlQnU2D8pjGHk/BZc1kfx2xs5IeMDP+pHvMf9IUBudAE4ECgYA8
  425. t//0CYQDzR3IoaNLiMbN6BP6HL0qeewsixrr5lKn1fRyY5nA6hl/I5BhTavF9Qqy
  426. 03oQT7FqXZ02cnuT+eTieBR/VAIiJzdvrg4a749x9Vw6MAKzZS14tlVdgBT4mhiK
  427. 6Ma16ECv39DstI9mYD3RF0TU4+pIf0C63S+Oe/ekNwKBgQCS15lZ3hO56wq1mvF2
  428. KE9WtjuJ0odReUu2BEkeyUI7vgRFrhahY57fchmgxszA8GzVQtaRElO5I1DBLfDQ
  429. wnxITvjSRsizBykQEom4G4nQ06VtRp+tyw9xHtg6AVTsjdGfbL2rOoKB5Y7moQjI
  430. Xow5b6i2ObHdZZ3TLNtYvktUxQ==
  431. -----END PRIVATE KEY-----
  432. EOF10
  433. # Getting all dns inside resolv.conf then use as Default DNS for our openvpn server
  434. #grep -v '#' /etc/resolv.conf | grep 'nameserver' | grep -E -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | while read -r line; do
  435. #echo "push \"dhcp-option DNS $line\"" >> /etc/openvpn/server_tcp.conf
  436. #done
  437. #grep -v '#' /etc/resolv.conf | grep 'nameserver' | grep -E -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | while read -r line; do
  438. #echo "push \"dhcp-option DNS $line\"" >> /etc/openvpn/server_udp.conf
  439. #done
  440. # setting openvpn server port
  441. sed -i "s|MyOvpnPort1|$OpenVPN_Port1|g" /etc/openvpn/server_tcp.conf
  442. sed -i "s|MyOvpnPort2|$OpenVPN_Port2|g" /etc/openvpn/server_udp.conf
  443. # Generating openvpn dh.pem file using openssl
  444. #openssl dhparam -out /etc/openvpn/dh.pem 1024
  445. # Getting some OpenVPN plugins for unix authentication
  446. wget -qO /etc/openvpn/b.zip 'https://raw.githubusercontent.com/Bonveio/BonvScripts/master/openvpn_plugin64'
  447. unzip -qq /etc/openvpn/b.zip -d /etc/openvpn
  448. rm -f /etc/openvpn/b.zip
  449. # Some workaround for OpenVZ machines for "Startup error" openvpn service
  450. if [[ "$(hostnamectl | grep -i Virtualization | awk '{print $2}' | head -n1)" == 'openvz' ]]; then
  451. sed -i 's|LimitNPROC|#LimitNPROC|g' /lib/systemd/system/openvpn*
  452. systemctl daemon-reload
  453. fi
  454. # Allow IPv4 Forwarding
  455. echo 'net.ipv4.ip_forward=1' > /etc/sysctl.d/20-openvpn.conf && sysctl --system &> /dev/null && echo 1 > /proc/sys/net/ipv4/ip_forward
  456. # Iptables Rule for OpenVPN server
  457. #PUBLIC_INET="$(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)' | head -1)"
  458. #IPCIDR='10.200.0.0/16'
  459. #iptables -I FORWARD -s $IPCIDR -j ACCEPT
  460. #iptables -t nat -A POSTROUTING -o $PUBLIC_INET -j MASQUERADE
  461. #iptables -t nat -A POSTROUTING -s $IPCIDR -o $PUBLIC_INET -j MASQUERADE
  462. # Installing Firewalld
  463. apt install firewalld -y
  464. systemctl start firewalld
  465. systemctl enable firewalld
  466. firewall-cmd --quiet --set-default-zone=public
  467. firewall-cmd --quiet --zone=public --permanent --add-port=1-65534/tcp
  468. firewall-cmd --quiet --zone=public --permanent --add-port=1-65534/udp
  469. firewall-cmd --quiet --reload
  470. firewall-cmd --quiet --add-masquerade
  471. firewall-cmd --quiet --permanent --add-masquerade
  472. firewall-cmd --quiet --permanent --add-service=ssh
  473. firewall-cmd --quiet --permanent --add-service=openvpn
  474. firewall-cmd --quiet --permanent --add-service=http
  475. firewall-cmd --quiet --permanent --add-service=https
  476. firewall-cmd --quiet --permanent --add-service=privoxy
  477. firewall-cmd --quiet --permanent --add-service=squid
  478. firewall-cmd --quiet --reload
  479. # Enabling IPv4 Forwarding
  480. echo 1 > /proc/sys/net/ipv4/ip_forward
  481. # Starting OpenVPN server
  482. systemctl start openvpn@server_tcp
  483. systemctl start openvpn@server_udp
  484. systemctl enable openvpn@server_tcp
  485. systemctl enable openvpn@server_udp
  486. systemctl restart openvpn@server_tcp
  487. systemctl restart openvpn@server_udp
  488. # Pulling OpenVPN no internet fixer script
  489. #wget -qO /etc/openvpn/openvpn.bash "https://raw.githubusercontent.com/Bonveio/BonvScripts/master/openvpn.bash"
  490. #0chmod +x /etc/openvpn/openvpn.bash
  491. }
  492. function InsProxy(){
  493. # Removing Duplicate privoxy config
  494. rm -rf /etc/privoxy/config*
  495. # Creating Privoxy server config using cat eof tricks
  496. cat <<'myPrivoxy' > /etc/privoxy/config
  497. # My Privoxy Server Config
  498. user-manual /usr/share/doc/privoxy/user-manual
  499. confdir /etc/privoxy
  500. logdir /var/log/privoxy
  501. filterfile default.filter
  502. logfile logfile
  503. listen-address 0.0.0.0:Privoxy_Port1
  504. listen-address 0.0.0.0:Privoxy_Port2
  505. toggle 1
  506. enable-remote-toggle 0
  507. enable-remote-http-toggle 0
  508. enable-edit-actions 0
  509. enforce-blocks 0
  510. buffer-limit 4096
  511. enable-proxy-authentication-forwarding 1
  512. forwarded-connect-retries 1
  513. accept-intercepted-requests 1
  514. allow-cgi-request-crunching 1
  515. split-large-forms 0
  516. keep-alive-timeout 5
  517. tolerate-pipelining 1
  518. socket-timeout 300
  519. permit-access 0.0.0.0/0 IP-ADDRESS
  520. myPrivoxy
  521. # Setting machine's IP Address inside of our privoxy config(security that only allows this machine to use this proxy server)
  522. sed -i "s|IP-ADDRESS|$IPADDR|g" /etc/privoxy/config
  523. # Setting privoxy ports
  524. sed -i "s|Privoxy_Port1|$Privoxy_Port1|g" /etc/privoxy/config
  525. sed -i "s|Privoxy_Port2|$Privoxy_Port2|g" /etc/privoxy/config
  526. # I'm setting Some Squid workarounds to prevent Privoxy's overflowing file descriptors that causing 50X error when clients trying to connect to your proxy server(thanks for this trick @homer_simpsons)
  527. apt remove --purge squid -y
  528. rm -rf /etc/squid/sq*
  529. apt install squid -y
  530. # Squid Ports (must be 1024 or higher)
  531. Proxy_Port1='8080'
  532. Proxy_Port2='8000'
  533. cat <<mySquid > /etc/squid/squid.conf
  534. acl VPN dst $(wget -4qO- http://ipinfo.io/ip)/32
  535. http_access allow VPN
  536. http_access deny all
  537. http_port 0.0.0.0:$Proxy_Port1
  538. http_port 0.0.0.0:$Proxy_Port2
  539. coredump_dir /var/spool/squid
  540. dns_nameservers 1.1.1.1 1.0.0.1
  541. refresh_pattern ^ftp: 1440 20% 10080
  542. refresh_pattern ^gopher: 1440 0% 1440
  543. refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
  544. refresh_pattern . 0 20% 4320
  545. visible_hostname localhost
  546. mySquid
  547. sed -i "s|SquidCacheHelper|$Privoxy_Port1|g" /etc/squid/squid.conf
  548. # Starting Proxy server
  549. echo -e "Restarting proxy server.."
  550. systemctl restart privoxy
  551. systemctl restart squid
  552. }
  553. function OvpnConfigs(){
  554. # Creating nginx config for our ovpn config downloads webserver
  555. cat <<'myNginxC' > /etc/nginx/conf.d/bonveio-ovpn-config.conf
  556. # My OpenVPN Config Download Directory
  557. server {
  558. listen 0.0.0.0:myNginx;
  559. server_name localhost;
  560. root /var/www/openvpn;
  561. index index.html;
  562. }
  563. myNginxC
  564. # Setting our nginx config port for .ovpn download site
  565. sed -i "s|myNginx|$OvpnDownload_Port|g" /etc/nginx/conf.d/bonveio-ovpn-config.conf
  566. # Removing Default nginx page(port 80)
  567. rm -rf /etc/nginx/sites-*
  568. # Creating our root directory for all of our .ovpn configs
  569. rm -rf /var/www/openvpn
  570. mkdir -p /var/www/openvpn
  571. # Now creating all of our OpenVPN Configs
  572. cat <<EOF152> /var/www/openvpn/GTMConfig.ovpn
  573. # Credits to LODIxyruss
  574. client
  575. dev tun
  576. proto tcp
  577. remote $IPADDR $OpenVPN_Port1
  578. remote-cert-tls server
  579. resolv-retry infinite
  580. nobind
  581. tun-mtu 1500
  582. tun-mtu-extra 32
  583. mssfix 1450
  584. persist-key
  585. persist-tun
  586. auth-user-pass
  587. auth none
  588. auth-nocache
  589. cipher none
  590. keysize 0
  591. comp-lzo
  592. setenv CLIENT_CERT 0
  593. reneg-sec 0
  594. verb 1
  595. http-proxy $(curl -s http://ipinfo.io/ip || wget -q http://ipinfo.io/ip) $Proxy_Port2
  596. http-proxy-option CUSTOM-HEADER Host redirect.googlevideo.com
  597. http-proxy-option CUSTOM-HEADER X-Forwarded-For redirect.googlevideo.com
  598. <ca>
  599. $(cat /etc/openvpn/ca.crt)
  600. </ca>
  601. EOF152
  602. cat <<EOF16> /var/www/openvpn/SunConfig.ovpn
  603. # Credits to LODIxyruss
  604. client
  605. dev tun
  606. proto udp
  607. remote $IPADDR $OpenVPN_Port2
  608. remote-cert-tls server
  609. resolv-retry infinite
  610. nobind
  611. tun-mtu 1500
  612. tun-mtu-extra 32
  613. mssfix 1450
  614. persist-key
  615. persist-tun
  616. auth-user-pass
  617. auth none
  618. auth-nocache
  619. cipher none
  620. keysize 0
  621. comp-lzo
  622. setenv CLIENT_CERT 0
  623. reneg-sec 0
  624. verb 1
  625. <ca>
  626. $(cat /etc/openvpn/ca.crt)
  627. </ca>
  628. EOF16
  629. cat <<EOF160> /var/www/openvpn/GStories.ovpn
  630. # Credits to LODIxyruss
  631. client
  632. dev tun
  633. proto tcp
  634. remote $IPADDR $OpenVPN_Port1
  635. remote-cert-tls server
  636. resolv-retry infinite
  637. nobind
  638. tun-mtu 1500
  639. tun-mtu-extra 32
  640. mssfix 1450
  641. persist-key
  642. persist-tun
  643. auth-user-pass
  644. auth none
  645. auth-nocache
  646. cipher none
  647. keysize 0
  648. comp-lzo
  649. setenv CLIENT_CERT 0
  650. reneg-sec 0
  651. verb 1
  652. http-proxy $(curl -s http://ipinfo.io/ip || wget -q http://ipinfo.io/ip) $Proxy_Port2
  653. http-proxy-option CUSTOM-HEADER Host tweetdeck.twitter.com
  654. http-proxy-option CUSTOM-HEADER X-Forwarded-For tweetdeck.twitter.com
  655. <ca>
  656. $(cat /etc/openvpn/ca.crt)
  657. </ca>
  658. EOF160
  659. cat <<EOF17> /var/www/openvpn/SunNoloadConfig.ovpn
  660. # Credits to LODIxyruss
  661. client
  662. dev tun
  663. proto tcp-client
  664. remote $IPADDR $OpenVPN_Port1
  665. remote-cert-tls server
  666. bind
  667. float
  668. tun-mtu 1500
  669. tun-mtu-extra 32
  670. mssfix 1450
  671. mute-replay-warnings
  672. connect-retry-max 9999
  673. redirect-gateway def1
  674. connect-retry 0 1
  675. resolv-retry infinite
  676. setenv CLIENT_CERT 0
  677. persist-tun
  678. persist-key
  679. auth-user-pass
  680. auth none
  681. auth-nocache
  682. auth-retry interact
  683. cipher none
  684. keysize 0
  685. comp-lzo
  686. reneg-sec 0
  687. verb 0
  688. nice -20
  689. log /dev/null
  690. <ca>
  691. $(cat /etc/openvpn/ca.crt)
  692. </ca>
  693. EOF17
  694. # Creating OVPN download site index.html
  695. cat <<'mySiteOvpn' > /var/www/openvpn/index.html
  696. <!DOCTYPE html>
  697. <html lang="en">
  698. <!-- OVPN Download site by LODIxyruss -->
  699. <head><meta charset="utf-8" /><title>MyScriptName OVPN Config Download</title><meta name="description" content="MyScriptName 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"><li class="list-group-item justify-content-between align-items-center" style="margin-bottom:1em;"><p>For Globe/TM <span class="badge light-blue darken-4">Android/iOS</span><br /><small> For EZ/GS Promo with WNP freebies</small></p><a class="btn btn-outline-success waves-effect btn-sm" href="http://IP-ADDRESS:NGINXPORT/GTMConfig.ovpn" style="float:right;"><i class="fa fa-download"></i> Download</a></li><li class="list-group-item justify-content-between align-items-center" style="margin-bottom:1em;"><p>For Sun <span class="badge light-blue darken-4">Android/iOS/PC/Modem</span><br /><small> For TU/CTC UDP Promos</small></p><a class="btn btn-outline-success waves-effect btn-sm" href="http://IP-ADDRESS:NGINXPORT/SunConfig.ovpn" style="float:right;"><i class="fa fa-download"></i> Download</a></li><li class="list-group-item justify-content-between align-items-center" style="margin-bottom:1em;"><p>For Sun <span class="badge light-blue darken-4">Android/iOS/PC/MODEM</span><br /><small> TNT GIGASTORIES</small></p><a class="btn btn-outline-success waves-effect btn-sm" href="http://IP-ADDRESS:NGINXPORT/GStories.ovpn" style="float:right;"><i class="fa fa-download"></i> Download</a></li></ul></div></div></div></div></body></html>
  700. mySiteOvpn
  701. # Setting template's correct name,IP address and nginx Port
  702. sed -i "s|MyScriptName|$MyScriptName|g" /var/www/openvpn/index.html
  703. sed -i "s|NGINXPORT|$OvpnDownload_Port|g" /var/www/openvpn/index.html
  704. sed -i "s|IP-ADDRESS|$IPADDR|g" /var/www/openvpn/index.html
  705. # Restarting nginx service
  706. systemctl restart nginx
  707. # Creating all .ovpn config archives
  708. cd /var/www/openvpn
  709. zip -qq -r Configs.zip *.ovpn
  710. cd
  711. }
  712. function ip_address(){
  713. local IP="$( ip addr | egrep -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | egrep -v "^192\.168|^172\.1[6-9]\.|^172\.2[0-9]\.|^172\.3[0-2]\.|^10\.|^127\.|^255\.|^0\." | head -n 1 )"
  714. [ -z "${IP}" ] && IP="$( wget -qO- -t1 -T2 ipv4.icanhazip.com )"
  715. [ -z "${IP}" ] && IP="$( wget -qO- -t1 -T2 ipinfo.io/ip )"
  716. [ ! -z "${IP}" ] && echo "${IP}" || echo
  717. }
  718. IPADDR="$(ip_address)"
  719. function ConfStartup(){
  720. # Daily reboot time of our machine
  721. # For cron commands, visit https://crontab.guru
  722. echo -e "0 4\t* * *\troot\treboot" > /etc/cron.d/b_reboot_job
  723. # Creating directory for startup script
  724. rm -rf /etc/barts
  725. mkdir -p /etc/barts
  726. chmod -R 755 /etc/barts
  727. # Creating startup script using cat eof tricks
  728. cat <<'EOFSH' > /etc/barts/startup.sh
  729. #!/bin/bash
  730. # Setting server local time
  731. ln -fs /usr/share/zoneinfo/MyVPS_Time /etc/localtime
  732. # Prevent DOS-like UI when installing using APT (Disabling APT interactive dialog)
  733. export DEBIAN_FRONTEND=noninteractive
  734. # Allowing ALL TCP ports for our machine (Simple workaround for policy-based VPS)
  735. iptables -A INPUT -s $(wget -4qO- http://ipinfo.io/ip) -p tcp -m multiport --dport 1:65535 -j ACCEPT
  736. # Allowing OpenVPN to Forward traffic
  737. /bin/bash /etc/openvpn/openvpn.bash
  738. # Deleting Expired SSH Accounts
  739. /usr/local/sbin/delete_expired &> /dev/null
  740. EOFSH
  741. chmod +x /etc/barts/startup.sh
  742. # Setting server local time every time this machine reboots
  743. sed -i "s|MyVPS_Time|$MyVPS_Time|g" /etc/barts/startup.sh
  744. #
  745. rm -rf /etc/sysctl.d/99*
  746. # Setting our startup script to run every machine boots
  747. echo "[Unit]
  748. Description=Barts Startup Script
  749. Before=network-online.target
  750. Wants=network-online.target
  751. [Service]
  752. Type=oneshot
  753. ExecStart=/bin/bash /etc/barts/startup.sh
  754. RemainAfterExit=yes
  755. [Install]
  756. WantedBy=multi-user.target" > /etc/systemd/system/barts.service
  757. chmod +x /etc/systemd/system/barts.service
  758. systemctl daemon-reload
  759. systemctl start barts
  760. systemctl enable barts &> /dev/null
  761. # Rebooting cron service
  762. systemctl restart cron
  763. systemctl enable cron
  764. }
  765. function ConfMenu(){
  766. echo -e " Creating Menu scripts.."
  767. cd /usr/local/sbin/
  768. rm -rf {accounts,base-ports,base-ports-wc,base-script,bench-network,clearcache,connections,create,create_random,create_trial,delete_expired,diagnose,edit_dropbear,edit_openssh,edit_openvpn,edit_ports,edit_squid3,edit_stunnel4,locked_list,menu,options,ram,reboot_sys,reboot_sys_auto,restart_services,server,set_multilogin_autokill,set_multilogin_autokill_lib,show_ports,speedtest,user_delete,user_details,user_details_lib,user_extend,user_list,user_lock,user_unlock}
  769. wget -q 'https://raw.githubusercontent.com/Barts-23/menu1/master/menu.zip'
  770. unzip -qq menu.zip
  771. rm -f menu.zip
  772. chmod +x ./*
  773. dos2unix ./* &> /dev/null
  774. sed -i 's|/etc/squid/squid.conf|/etc/privoxy/config|g' ./*
  775. sed -i 's|http_port|listen-address|g' ./*
  776. cd ~
  777. echo 'clear' > /etc/profile.d/barts.sh
  778. echo 'echo '' > /var/log/syslog' >> /etc/profile.d/barts.sh
  779. echo 'screenfetch -p -A Android' >> /etc/profile.d/barts.sh
  780. chmod +x /etc/profile.d/barts.sh
  781. }
  782. function ScriptMessage(){
  783. echo -e " (。◕‿◕。) $MyScriptName Ubuntu VPS Installer"
  784. echo -e " Open release version"
  785. echo -e ""
  786. echo -e " Script created by Bonveio"
  787. echo -e " Edited by LODIxyruss"
  788. }
  789. #############################
  790. #############################
  791. ## Installation Process
  792. #############################
  793. ## WARNING: Do not modify or edit anything
  794. ## if you did'nt know what to do.
  795. ## This part is too sensitive.
  796. #############################
  797. #############################
  798. # First thing to do is check if this machine is Debian
  799. source /etc/os-release
  800. if [[ "$ID" != 'ubuntu' ]]; then
  801. ScriptMessage
  802. echo -e "[\e[1;31mError\e[0m] This script is for Ubuntu only, exting..."
  803. exit 1
  804. fi
  805. # Now check if our machine is in root user, if not, this script exits
  806. # If you're on sudo user, run `sudo su -` first before running this script
  807. if [[ $EUID -ne 0 ]];then
  808. ScriptMessage
  809. echo -e "[\e[1;31mError\e[0m] This script must be run as root, exiting..."
  810. exit 1
  811. fi
  812. # (For OpenVPN) Checking it this machine have TUN Module, this is the tunneling interface of OpenVPN server
  813. if [[ ! -e /dev/net/tun ]]; then
  814. echo -e "[\e[1;31m×\e[0m] You cant use this script without TUN Module installed/embedded in your machine, file a support ticket to your machine admin about this matter"
  815. echo -e "[\e[1;31m-\e[0m] Script is now exiting..."
  816. exit 1
  817. fi
  818. # Begin Installation by Updating and Upgrading machine and then Installing all our wanted packages/services to be install.
  819. ScriptMessage
  820. sleep 2
  821. # Configure OpenSSH and Dropbear
  822. echo -e "Configuring ssh..."
  823. InstSSH
  824. # Configure Stunnel
  825. echo -e "Configuring stunnel..."
  826. InsStunnel
  827. # Configure Webmin
  828. echo -e "Configuring webmin..."
  829. InstWebmin
  830. # Configure Privoxy and Squid
  831. echo -e "Configuring proxy..."
  832. InsProxy
  833. # Configure OpenVPN
  834. echo -e "Configuring OpenVPN..."
  835. InsOpenVPN
  836. # Configuring Nginx OVPN config download site
  837. OvpnConfigs
  838. # Some assistance and startup scripts
  839. ConfStartup
  840. # VPS Menu script v1.0
  841. ConfMenu
  842. # Setting server local time
  843. ln -fs /usr/share/zoneinfo/$MyVPS_Time /etc/localtime
  844. clear
  845. cd ~
  846. # Running sysinfo
  847. bash /etc/profile.d/barts.sh
  848. # Showing script's banner message
  849. ScriptMessage
  850. # Showing additional information from installating this script
  851. echo -e ""
  852. echo -e " Success Installation"
  853. echo -e ""
  854. echo -e " Service Ports: "
  855. echo -e " OpenSSH: $SSH_Port1, $SSH_Port2"
  856. echo -e " Stunnel: $Stunnel_Port1, $Stunnel_Port2"
  857. echo -e " DropbearSSH: $Dropbear_Port1, $Dropbear_Port2"
  858. echo -e " Privoxy: $Privoxy_Port1, $Privoxy_Port2"
  859. echo -e " Squid: $Proxy_Port1, $Proxy_Port2"
  860. echo -e " OpenVPN: $OpenVPN_Port1, $OpenVPN_Port2"
  861. echo -e " OpenVPN SSL: $Stunnel_Port3"
  862. echo -e " NGiNX: $OvpnDownload_Port"
  863. echo -e " Webmin: 10000"
  864. echo -e " L2tp IPSec Key: fakenetvpn101"
  865. echo -e ""
  866. echo -e ""
  867. echo -e " OpenVPN Configs Download site"
  868. echo -e " http://$IPADDR:$OvpnDownload_Port"
  869. echo -e ""
  870. echo -e " All OpenVPN Configs Archive"
  871. echo -e " http://$IPADDR:$OvpnDownload_Port/Configs.zip"
  872. echo -e ""
  873. echo -e ""
  874. echo -e " [Note] DO NOT RESELL THIS SCRIPT"
  875. # Clearing all logs from installation
  876. rm -rf /root/.bash_history && history -c && echo '' > /var/log/syslog
  877. rm -f Ubuntu-VPS-Installer*
  878. exit 1