Advertisement
Guest User

Untitled

a guest
Feb 27th, 2020
2,634
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 35.02 KB | None | 0 0
  1. #!/bin/bash
  2. # Debian 9 and 10 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. # Big shoutout nga pala kay 'Simon Gucaban' for maliciously decrypting some of my public scripts(kasama itong debian ko), Since the encryptor itself cant be redone this script securely, plus hindi sya nakipag cooperate about encryption process ng script to prevent malicious decryption again, i've decided to end this script open source(baka ung iba i oopen source ko nadin), wag nyo ko sisihin kapag dumami script resellers(why i hate some script resellers? they just remodifying/templating public scripts with shitty features then adding a price on it), di ko na kasalanan yan, kasalanan yan nung nagbanta sa security ng script at hindi nakipagcooperate sana for encryption improvement. Dami ko pa naman sana gusto pang idagdag sa script na to and kahit ung sa iba(kahit kapos ako sa time, pinipilit ko parin gumawa). Until today, this script is `not ensurely` providing updates and upgrades (maybe im not updating this anymore), after the decrypting incident, tinamad nako gumawa ng bash script, i think bash scripting is a waste of time dahil sa mga taong kagaya ni 'Simon Gucaban' na everytime pwede silip silipin ung codes inside the shell scripts then experimenting himself to reproduce or either use ung nakita nya as advantage of his own script(kumbaga may laging nagmamasid sayo). I know bash is not secure itself but the time-consuming i've used to research "bug fixes/workaround codes" is a big deal to me. Sa kabila ng nakakapanghinayang na incident na to, im still contributing to any 'linux related/script related' discussions inside PHCorner. And trying to guide sa mga vps user na nahihirapan about vps'es nila for configuration.
  11. #
  12.  
  13. #############################
  14. #############################
  15. # Variables (Can be changed depends on your preferred values)
  16. # Script name
  17. MyScriptName='Bonveio'
  18.  
  19. # OpenSSH Ports
  20. SSH_Port1='22'
  21. SSH_Port2='225'
  22.  
  23. # Your SSH Banner
  24. SSH_Banner='https://pastebin.com/raw/LUHJuPmr'
  25.  
  26. # Dropbear Ports
  27. Dropbear_Port1='550'
  28. Dropbear_Port2='555'
  29.  
  30. # Stunnel Ports
  31. Stunnel_Port1='443' # through Dropbear
  32. Stunnel_Port2='444' # through OpenSSH
  33.  
  34. # OpenVPN Ports
  35. OpenVPN_Port1='110' # take note when you change this port, openvpn sun noload config will not work
  36.  
  37. # Privoxy Ports (must be 1024 or higher)
  38. Privoxy_Port1='8000'
  39. Privoxy_Port2='8080'
  40.  
  41. # OpenVPN Config Download Port
  42. 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
  43.  
  44. # Server local time
  45. MyVPS_Time='Asia/Manila'
  46. #############################
  47.  
  48.  
  49. #############################
  50. #############################
  51. ## All function used for this script
  52. #############################
  53. ## WARNING: Do not modify or edit anything
  54. ## if you did'nt know what to do.
  55. ## This part is too sensitive.
  56. #############################
  57. #############################
  58.  
  59. function InstUpdates(){
  60. export DEBIAN_FRONTEND=noninteractive
  61. apt-get update
  62. apt-get upgrade -y
  63.  
  64. # Removing some firewall tools that may affect other services
  65. apt-get remove --purge ufw firewalld -y
  66.  
  67.  
  68. # Installing some important machine essentials
  69. apt-get install nano wget curl zip unzip tar gzip p7zip-full bc rc openssl cron net-tools dnsutils dos2unix screen bzip2 ccrypt -y
  70.  
  71. # Now installing all our wanted services
  72. apt-get install dropbear stunnel4 privoxy ca-certificates nginx ruby apt-transport-https lsb-release squid screenfetch -y
  73.  
  74. # Installing all required packages to install Webmin
  75. 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
  76. apt-get install shared-mime-info jq -y
  77.  
  78. # Installing a text colorizer
  79. gem install lolcat
  80.  
  81. # Trying to remove obsolette packages after installation
  82. apt-get autoremove -y
  83.  
  84. # Installing OpenVPN by pulling its repository inside sources.list file
  85. rm -rf /etc/apt/sources.list.d/openvpn*
  86. echo "deb http://build.openvpn.net/debian/openvpn/stable $(lsb_release -sc) main" > /etc/apt/sources.list.d/openvpn.list
  87. wget -qO - http://build.openvpn.net/debian/openvpn/stable/pubkey.gpg|apt-key add -
  88. apt-get update
  89. apt-get install openvpn -y
  90. }
  91.  
  92. function InstWebmin(){
  93. # Download the webmin .deb package
  94. # 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):
  95. WebminFile='http://prdownloads.sourceforge.net/webadmin/webmin_1.910_all.deb'
  96. wget -qO webmin.deb "$WebminFile"
  97.  
  98. # Installing .deb package for webmin
  99. dpkg --install webmin.deb
  100.  
  101. rm -rf webmin.deb
  102.  
  103. # Configuring webmin server config to use only http instead of https
  104. sed -i 's|ssl=1|ssl=0|g' /etc/webmin/miniserv.conf
  105.  
  106. # Then restart to take effect
  107. systemctl restart webmin
  108. }
  109.  
  110. function InstSSH(){
  111. # Removing some duplicated sshd server configs
  112. rm -f /etc/ssh/sshd_config*
  113.  
  114. # Creating a SSH server config using cat eof tricks
  115. cat <<'MySSHConfig' > /etc/ssh/sshd_config
  116. # My OpenSSH Server config
  117. Port myPORT1
  118. Port myPORT2
  119. AddressFamily inet
  120. ListenAddress 0.0.0.0
  121. HostKey /etc/ssh/ssh_host_rsa_key
  122. HostKey /etc/ssh/ssh_host_ecdsa_key
  123. HostKey /etc/ssh/ssh_host_ed25519_key
  124. PermitRootLogin yes
  125. MaxSessions 1024
  126. PubkeyAuthentication yes
  127. PasswordAuthentication yes
  128. PermitEmptyPasswords no
  129. ChallengeResponseAuthentication no
  130. UsePAM yes
  131. X11Forwarding yes
  132. PrintMotd no
  133. ClientAliveInterval 240
  134. ClientAliveCountMax 2
  135. UseDNS no
  136. Banner /etc/banner
  137. AcceptEnv LANG LC_*
  138. Subsystem sftp /usr/lib/openssh/sftp-server
  139. MySSHConfig
  140.  
  141. # Now we'll put our ssh ports inside of sshd_config
  142. sed -i "s|myPORT1|$SSH_Port1|g" /etc/ssh/sshd_config
  143. sed -i "s|myPORT2|$SSH_Port2|g" /etc/ssh/sshd_config
  144.  
  145. # Download our SSH Banner
  146. rm -f /etc/banner
  147. wget -qO /etc/banner "$SSH_Banner"
  148. dos2unix -q /etc/banner
  149.  
  150. # My workaround code to remove `BAD Password error` from passwd command, it will fix password-related error on their ssh accounts.
  151. sed -i '/password\s*requisite\s*pam_cracklib.s.*/d' /etc/pam.d/common-password
  152. sed -i 's/use_authtok //g' /etc/pam.d/common-password
  153.  
  154. # 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.
  155. sed -i '/\/bin\/false/d' /etc/shells
  156. sed -i '/\/usr\/sbin\/nologin/d' /etc/shells
  157. echo '/bin/false' >> /etc/shells
  158. echo '/usr/sbin/nologin' >> /etc/shells
  159.  
  160. # Restarting openssh service
  161. systemctl restart ssh
  162.  
  163. # Removing some duplicate config file
  164. rm -rf /etc/default/dropbear*
  165.  
  166. # creating dropbear config using cat eof tricks
  167. cat <<'MyDropbear' > /etc/default/dropbear
  168. # My Dropbear Config
  169. NO_START=0
  170. DROPBEAR_PORT=PORT01
  171. DROPBEAR_EXTRA_ARGS="-p PORT02"
  172. DROPBEAR_BANNER="/etc/banner"
  173. DROPBEAR_RSAKEY="/etc/dropbear/dropbear_rsa_host_key"
  174. DROPBEAR_DSSKEY="/etc/dropbear/dropbear_dss_host_key"
  175. DROPBEAR_ECDSAKEY="/etc/dropbear/dropbear_ecdsa_host_key"
  176. DROPBEAR_RECEIVE_WINDOW=65536
  177. MyDropbear
  178.  
  179. # Now changing our desired dropbear ports
  180. sed -i "s|PORT01|$Dropbear_Port1|g" /etc/default/dropbear
  181. sed -i "s|PORT02|$Dropbear_Port2|g" /etc/default/dropbear
  182.  
  183. # Restarting dropbear service
  184. systemctl restart dropbear
  185. }
  186.  
  187. function InsStunnel(){
  188. StunnelDir=$(ls /etc/default | grep stunnel | head -n1)
  189.  
  190. # Creating stunnel startup config using cat eof tricks
  191. cat <<'MyStunnelD' > /etc/default/$StunnelDir
  192. # My Stunnel Config
  193. ENABLED=1
  194. FILES="/etc/stunnel/*.conf"
  195. OPTIONS=""
  196. BANNER="/etc/banner"
  197. PPP_RESTART=0
  198. # RLIMITS="-n 4096 -d unlimited"
  199. RLIMITS=""
  200. MyStunnelD
  201.  
  202. # Removing all stunnel folder contents
  203. rm -rf /etc/stunnel/*
  204.  
  205. # Creating stunnel certifcate using openssl
  206. 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
  207. ## > /dev/null 2>&1
  208.  
  209. # Creating stunnel server config
  210. cat <<'MyStunnelC' > /etc/stunnel/stunnel.conf
  211. # My Stunnel Config
  212. pid = /var/run/stunnel.pid
  213. cert = /etc/stunnel/stunnel.pem
  214. client = no
  215. socket = l:TCP_NODELAY=1
  216. socket = r:TCP_NODELAY=1
  217. TIMEOUTclose = 0
  218.  
  219. [dropbear]
  220. accept = Stunnel_Port1
  221. connect = 127.0.0.1:dropbear_port_c
  222.  
  223. [openssh]
  224. accept = Stunnel_Port2
  225. connect = 127.0.0.1:openssh_port_c
  226. MyStunnelC
  227.  
  228. # setting stunnel ports
  229. sed -i "s|Stunnel_Port1|$Stunnel_Port1|g" /etc/stunnel/stunnel.conf
  230. 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
  231. sed -i "s|Stunnel_Port2|$Stunnel_Port2|g" /etc/stunnel/stunnel.conf
  232. 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
  233.  
  234. # Restarting stunnel service
  235. systemctl restart $StunnelDir
  236.  
  237. }
  238.  
  239. function InsOpenVPN(){
  240. # Checking if openvpn folder is accidentally deleted or purged
  241. if [[ ! -e /etc/openvpn ]]; then
  242. mkdir -p /etc/openvpn
  243. fi
  244.  
  245. # Removing all existing openvpn server files
  246. rm -rf /etc/openvpn/*
  247.  
  248. # Creating server.conf, ca.crt, server.crt and server.key
  249. cat <<'myOpenVPNconf' > /etc/openvpn/server.conf
  250. # My OpenVPN
  251. port MyOvpnPort
  252. dev tun
  253. proto tcp
  254. ca /etc/openvpn/ca.crt
  255. cert /etc/openvpn/server.crt
  256. key /etc/openvpn/server.key
  257. dh /etc/openvpn/dh.pem
  258. duplicate-cn
  259. cipher none
  260. ncp-disable
  261. auth none
  262. comp-lzo
  263. plugin /etc/openvpn/openvpn-auth-pam.so login
  264. verify-client-cert none
  265. username-as-common-name
  266. max-clients 4000
  267. server 10.200.0.0 255.255.0.0
  268. tun-mtu 1500
  269. tun-mtu-extra 32
  270. mssfix 1400
  271. reneg-sec 0
  272. sndbuf 0
  273. rcvbuf 0
  274. push "sndbuf 393216"
  275. push "rcvbuf 393216"
  276. push "redirect-gateway def1"
  277. push "route-method exe"
  278. push "route-delay 2"
  279. client-to-client
  280. keepalive 10 120
  281. persist-tun
  282. persist-key
  283. persist-remote-ip
  284. status /etc/openvpn/stats.txt
  285. log /etc/openvpn/openvpn.log
  286. verb 2
  287. script-security 2
  288. socket-flags TCP_NODELAY
  289. push "socket-flags TCP_NODELAY"
  290. myOpenVPNconf
  291. cat <<'EOF7'> /etc/openvpn/ca.crt
  292. -----BEGIN CERTIFICATE-----
  293. MIIEATCCA2qgAwIBAgIJAOCyX0XMJp/pMA0GCSqGSIb3DQEBCwUAMIGyMQswCQYD
  294. VQQGEwJQSDEMMAoGA1UECBMDTkNSMQ8wDQYDVQQHEwZNYW5pbGExFTATBgNVBAoT
  295. DFBIQ29ybmVyLk5FVDEbMBkGA1UECxMSQm9udmVpbyBBdXRvc2NyaXB0MRgwFgYD
  296. VQQDEw9QSENvcm5lci5ORVQgQ0ExETAPBgNVBCkTCEJvbi1jaGFuMSMwIQYJKoZI
  297. hvcNAQkBFhRvcGVudnBuQHBoY29ybmVyLm5ldDAeFw0xOTA2MDgyMDIzMTRaFw00
  298. NjEwMTQyMDIzMTRaMIGyMQswCQYDVQQGEwJQSDEMMAoGA1UECBMDTkNSMQ8wDQYD
  299. VQQHEwZNYW5pbGExFTATBgNVBAoTDFBIQ29ybmVyLk5FVDEbMBkGA1UECxMSQm9u
  300. dmVpbyBBdXRvc2NyaXB0MRgwFgYDVQQDEw9QSENvcm5lci5ORVQgQ0ExETAPBgNV
  301. BCkTCEJvbi1jaGFuMSMwIQYJKoZIhvcNAQkBFhRvcGVudnBuQHBoY29ybmVyLm5l
  302. dDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAxKyzeWAALqWhZx0d6jM2H/WB
  303. AJTzq30+7XyfsJZ1E05bvQ/iVpTEISU4mSg/bJyW6yoVeuR5sdULAwNTswGnqoYF
  304. V9VW36p0OJklTxgGQpy92b89UeUTxfoGFYRYd6JDqMp+eZLLDdf2JraKUD53gbDz
  305. HbMtVNmP00X4UT2p2S0CAwEAAaOCARswggEXMB0GA1UdDgQWBBRECIKLevT/AZM+
  306. 5r1ixF2iGN+BzTCB5wYDVR0jBIHfMIHcgBRECIKLevT/AZM+5r1ixF2iGN+BzaGB
  307. uKSBtTCBsjELMAkGA1UEBhMCUEgxDDAKBgNVBAgTA05DUjEPMA0GA1UEBxMGTWFu
  308. aWxhMRUwEwYDVQQKEwxQSENvcm5lci5ORVQxGzAZBgNVBAsTEkJvbnZlaW8gQXV0
  309. b3NjcmlwdDEYMBYGA1UEAxMPUEhDb3JuZXIuTkVUIENBMREwDwYDVQQpEwhCb24t
  310. Y2hhbjEjMCEGCSqGSIb3DQEJARYUb3BlbnZwbkBwaGNvcm5lci5uZXSCCQDgsl9F
  311. zCaf6TAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBCwUAA4GBAICs6tRpZWpgHWUC
  312. DMkWedUD+cDYVlDTP2dwRY0Xi0FuNVlsRdEOWsBfVaXj+wpc2qn6fKt/sUVBQWof
  313. mKQlDlHY3rj0EqEPq+9VUMjxB2OMXMbtumK2usZ30O7nKcKSsLJsRhcaY6LghHkq
  314. BEUv/Z1/AWr7BLBIQCtMUZkmYVGJ
  315. -----END CERTIFICATE-----
  316. EOF7
  317. cat <<'EOF9'> /etc/openvpn/server.crt
  318. Certificate:
  319. Data:
  320. Version: 3 (0x2)
  321. Serial Number: 1 (0x1)
  322. Signature Algorithm: sha256WithRSAEncryption
  323. Issuer: C=PH, ST=NCR, L=Manila, O=PHCorner.NET, OU=Bonveio Autoscript, CN=PHCorner.NET CA/name=Bon-chan/emailAddress=openvpn@phcorner.net
  324. Validity
  325. Not Before: Jun 8 20:24:02 2019 GMT
  326. Not After : Oct 14 20:24:02 2046 GMT
  327. Subject: C=PH, ST=NCR, L=Manila, O=PHCorner.NET, OU=Bonveio Autoscript, CN=server/name=Bon-chan/emailAddress=openvpn@phcorner.net
  328. Subject Public Key Info:
  329. Public Key Algorithm: rsaEncryption
  330. Public-Key: (1024 bit)
  331. Modulus:
  332. 00:be:89:b8:c7:5a:52:2f:96:5b:3e:fd:7d:25:1f:
  333. 2e:3c:83:ab:5d:25:cc:97:4e:c7:3f:01:ab:43:03:
  334. 7e:3c:dd:83:6a:e1:c3:6e:ff:32:80:65:d2:29:27:
  335. a0:ae:0f:fd:53:f9:ce:82:10:b9:af:83:8e:79:f8:
  336. 20:4f:41:ec:e5:66:70:85:63:5b:5b:89:0b:05:ca:
  337. b6:57:17:ac:e1:2d:67:85:b4:66:a4:51:97:19:86:
  338. 11:b2:f0:c7:af:96:a3:00:ec:c5:bb:5d:00:8f:79:
  339. b9:23:e1:47:43:ee:8a:a1:bc:cc:62:71:f9:12:51:
  340. 28:6d:7f:2c:79:35:c7:a9:89
  341. Exponent: 65537 (0x10001)
  342. X509v3 extensions:
  343. X509v3 Basic Constraints:
  344. CA:FALSE
  345. Netscape Cert Type:
  346. SSL Server
  347. Netscape Comment:
  348. Easy-RSA Generated Server Certificate
  349. X509v3 Subject Key Identifier:
  350. 26:C9:39:A0:F9:75:73:1B:5A:29:D5:8C:80:35:71:23:44:56:00:14
  351. X509v3 Authority Key Identifier:
  352. keyid:44:08:82:8B:7A:F4:FF:01:93:3E:E6:BD:62:C4:5D:A2:18:DF:81:CD
  353. DirName:/C=PH/ST=NCR/L=Manila/O=PHCorner.NET/OU=Bonveio Autoscript/CN=PHCorner.NET CA/name=Bon-chan/emailAddress=openvpn@phcorner.net
  354. serial:E0:B2:5F:45:CC:26:9F:E9
  355.  
  356. X509v3 Extended Key Usage:
  357. TLS Web Server Authentication
  358. X509v3 Key Usage:
  359. Digital Signature, Key Encipherment
  360. X509v3 Subject Alternative Name:
  361. DNS:server
  362. Signature Algorithm: sha256WithRSAEncryption
  363. a6:46:e3:8d:8d:16:42:85:d2:c7:99:87:a6:66:c7:1b:36:af:
  364. f9:37:3a:a8:d9:6f:e3:1e:2d:93:1c:bf:52:9f:01:88:82:bc:
  365. 39:07:1d:e1:62:ff:65:a7:74:31:2b:32:37:d0:d7:e0:5c:2d:
  366. 4e:9a:c2:01:cb:6a:e2:69:f8:1b:f7:df:15:5c:3e:30:84:ca:
  367. 6e:2d:18:be:bc:f7:fa:a2:af:70:26:ae:3e:e1:a0:75:92:a3:
  368. 91:94:52:5f:21:ce:e0:38:97:c5:c6:55:1e:42:d7:f5:38:7f:
  369. e1:ef:2c:b4:5c:32:5c:74:6e:a8:08:ab:6c:a7:72:ba:7e:b5:
  370. b5:74
  371. -----BEGIN CERTIFICATE-----
  372. MIIEazCCA9SgAwIBAgIBATANBgkqhkiG9w0BAQsFADCBsjELMAkGA1UEBhMCUEgx
  373. DDAKBgNVBAgTA05DUjEPMA0GA1UEBxMGTWFuaWxhMRUwEwYDVQQKEwxQSENvcm5l
  374. ci5ORVQxGzAZBgNVBAsTEkJvbnZlaW8gQXV0b3NjcmlwdDEYMBYGA1UEAxMPUEhD
  375. b3JuZXIuTkVUIENBMREwDwYDVQQpEwhCb24tY2hhbjEjMCEGCSqGSIb3DQEJARYU
  376. b3BlbnZwbkBwaGNvcm5lci5uZXQwHhcNMTkwNjA4MjAyNDAyWhcNNDYxMDE0MjAy
  377. NDAyWjCBqTELMAkGA1UEBhMCUEgxDDAKBgNVBAgTA05DUjEPMA0GA1UEBxMGTWFu
  378. aWxhMRUwEwYDVQQKEwxQSENvcm5lci5ORVQxGzAZBgNVBAsTEkJvbnZlaW8gQXV0
  379. b3NjcmlwdDEPMA0GA1UEAxMGc2VydmVyMREwDwYDVQQpEwhCb24tY2hhbjEjMCEG
  380. CSqGSIb3DQEJARYUb3BlbnZwbkBwaGNvcm5lci5uZXQwgZ8wDQYJKoZIhvcNAQEB
  381. BQADgY0AMIGJAoGBAL6JuMdaUi+WWz79fSUfLjyDq10lzJdOxz8Bq0MDfjzdg2rh
  382. w27/MoBl0iknoK4P/VP5zoIQua+Djnn4IE9B7OVmcIVjW1uJCwXKtlcXrOEtZ4W0
  383. ZqRRlxmGEbLwx6+WowDsxbtdAI95uSPhR0PuiqG8zGJx+RJRKG1/LHk1x6mJAgMB
  384. AAGjggGWMIIBkjAJBgNVHRMEAjAAMBEGCWCGSAGG+EIBAQQEAwIGQDA0BglghkgB
  385. hvhCAQ0EJxYlRWFzeS1SU0EgR2VuZXJhdGVkIFNlcnZlciBDZXJ0aWZpY2F0ZTAd
  386. BgNVHQ4EFgQUJsk5oPl1cxtaKdWMgDVxI0RWABQwgecGA1UdIwSB3zCB3IAURAiC
  387. i3r0/wGTPua9YsRdohjfgc2hgbikgbUwgbIxCzAJBgNVBAYTAlBIMQwwCgYDVQQI
  388. EwNOQ1IxDzANBgNVBAcTBk1hbmlsYTEVMBMGA1UEChMMUEhDb3JuZXIuTkVUMRsw
  389. GQYDVQQLExJCb252ZWlvIEF1dG9zY3JpcHQxGDAWBgNVBAMTD1BIQ29ybmVyLk5F
  390. VCBDQTERMA8GA1UEKRMIQm9uLWNoYW4xIzAhBgkqhkiG9w0BCQEWFG9wZW52cG5A
  391. cGhjb3JuZXIubmV0ggkA4LJfRcwmn+kwEwYDVR0lBAwwCgYIKwYBBQUHAwEwCwYD
  392. VR0PBAQDAgWgMBEGA1UdEQQKMAiCBnNlcnZlcjANBgkqhkiG9w0BAQsFAAOBgQCm
  393. RuONjRZChdLHmYemZscbNq/5Nzqo2W/jHi2THL9SnwGIgrw5Bx3hYv9lp3QxKzI3
  394. 0NfgXC1OmsIBy2riafgb998VXD4whMpuLRi+vPf6oq9wJq4+4aB1kqORlFJfIc7g
  395. OJfFxlUeQtf1OH/h7yy0XDJcdG6oCKtsp3K6frW1dA==
  396. -----END CERTIFICATE-----
  397. EOF9
  398. cat <<'EOF10'> /etc/openvpn/server.key
  399. -----BEGIN PRIVATE KEY-----
  400. MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBAL6JuMdaUi+WWz79
  401. fSUfLjyDq10lzJdOxz8Bq0MDfjzdg2rhw27/MoBl0iknoK4P/VP5zoIQua+Djnn4
  402. IE9B7OVmcIVjW1uJCwXKtlcXrOEtZ4W0ZqRRlxmGEbLwx6+WowDsxbtdAI95uSPh
  403. R0PuiqG8zGJx+RJRKG1/LHk1x6mJAgMBAAECgYEAiuUeW8RNsP7sGSj0N0FZlSdu
  404. ngJV996nhBiVXc6IEZpwmFNnAdzqVYrj/rgye3CQfMzXax0CHx3JmMP12ZD3PKY9
  405. P2NBwJE0D1CloVNsOmvdQdLMR/aBkSCFBYkNwMgBNsLLkVfObLAknXzFBsSjD/TW
  406. CorMbGvxQsPCJThX9lkCQQD6Yc7C8WrHH36+YqU9drZdM49opjoyQDqyb0Y8C7Zw
  407. XUG973ZN1L5HdJmW1pE0Hgp1GeGfBuMbNOusCXsZGHT3AkEAwtArlHVHtg2E/JbQ
  408. 9WSCSTY24IP3Q0QCnxZtMBebBbQAIPIiMGf9vpHCUr5FbRGhql6wGn0HaoU5Xxuz
  409. IeW1fwJALqTj8NsqqjfK08rqv52K8af2UmeNNelTRgSG0A7aiOpGogynPG6imAs3
  410. xarpWA00o4YTyx1sV5gvQ1hsz0sIFwJBAJfczxwbkJtKTrDYoGuqviV0LbM3LDkz
  411. exeo09T5kc8QUklcd2pkplk4JtN5n4U2iV/WEFGVxYIz+FU7sphqCOECQQDTJ2f+
  412. rwgQgPRpoZeg8kAl6Uqik0+vLOM/ZtIwcrEowIGKfmBp79VUKoqpW7tJXtkWK8QM
  413. hWiu9+O4+dQNTcOm
  414. -----END PRIVATE KEY-----
  415. EOF10
  416.  
  417. # Getting all dns inside resolv.conf then use as Default DNS for our openvpn server
  418. 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
  419. echo "push \"dhcp-option DNS $line\"" >> /etc/openvpn/server.conf
  420. done
  421.  
  422. # setting openvpn server port
  423. sed -i "s|MyOvpnPort|$OpenVPN_Port1|g" /etc/openvpn/server.conf
  424.  
  425. # Generating openvpn dh.pem file using openssl
  426. openssl dhparam -out /etc/openvpn/dh.pem 1024
  427.  
  428. # Getting some OpenVPN plugins for unix authentication
  429. wget -qO /etc/openvpn/b.zip 'https://raw.githubusercontent.com/Bonveio/BonvScripts/master/openvpn_plugin64'
  430. unzip -qq /etc/openvpn/b.zip -d /etc/openvpn
  431. rm -f /etc/openvpn/b.zip
  432.  
  433. # Some workaround for OpenVZ machines for "Startup error" openvpn service
  434. if [[ "$(hostnamectl | grep -i Virtualization | awk '{print $2}' | head -n1)" == 'openvz' ]]; then
  435. sed -i 's|LimitNPROC|#LimitNPROC|g' /lib/systemd/system/openvpn*
  436. systemctl daemon-reload
  437. fi
  438.  
  439. # Allow IPv4 Forwarding
  440. sed -i '/net.ipv4.ip_forward.*/d' /etc/sysctl.conf
  441. echo 'net.ipv4.ip_forward=1' > /etc/sysctl.d/20-openvpn.conf
  442. sysctl --system &> /dev/null
  443.  
  444. # Iptables Rule for OpenVPN server
  445. PUBLIC_INET="$(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)' | head -1)"
  446. IPCIDR='10.200.0.0/16'
  447. iptables -I FORWARD -s $IPCIDR -j ACCEPT
  448. iptables -t nat -A POSTROUTING -o $PUBLIC_INET -j MASQUERADE
  449. iptables -t nat -A POSTROUTING -s $IPCIDR -o $PUBLIC_INET -j MASQUERADE
  450.  
  451. # Enabling IPv4 Forwarding
  452. echo 1 > /proc/sys/net/ipv4/ip_forward
  453.  
  454. # Starting OpenVPN server
  455. systemctl start openvpn@server
  456. systemctl enable openvpn@server
  457.  
  458. # Pulling OpenVPN no internet fixer script
  459. wget -qO /etc/openvpn/openvpn.bash "https://raw.githubusercontent.com/Bonveio/BonvScripts/master/openvpn.bash"
  460. chmod +x /etc/openvpn/openvpn.bash
  461. }
  462.  
  463. function InsProxy(){
  464. # Removing Duplicate privoxy config
  465. rm -rf /etc/privoxy/config*
  466.  
  467. # Creating Privoxy server config using cat eof tricks
  468. cat <<'myPrivoxy' > /etc/privoxy/config
  469. # My Privoxy Server Config
  470. user-manual /usr/share/doc/privoxy/user-manual
  471. confdir /etc/privoxy
  472. logdir /var/log/privoxy
  473. filterfile default.filter
  474. logfile logfile
  475. listen-address 0.0.0.0:Privoxy_Port1
  476. listen-address 0.0.0.0:Privoxy_Port2
  477. toggle 1
  478. enable-remote-toggle 0
  479. enable-remote-http-toggle 0
  480. enable-edit-actions 0
  481. enforce-blocks 0
  482. buffer-limit 4096
  483. enable-proxy-authentication-forwarding 1
  484. forwarded-connect-retries 1
  485. accept-intercepted-requests 1
  486. allow-cgi-request-crunching 1
  487. split-large-forms 0
  488. keep-alive-timeout 5
  489. tolerate-pipelining 1
  490. socket-timeout 300
  491. permit-access 0.0.0.0/0 IP-ADDRESS
  492. myPrivoxy
  493.  
  494. # Setting machine's IP Address inside of our privoxy config(security that only allows this machine to use this proxy server)
  495. sed -i "s|IP-ADDRESS|$IPADDR|g" /etc/privoxy/config
  496.  
  497. # Setting privoxy ports
  498. sed -i "s|Privoxy_Port1|$Privoxy_Port1|g" /etc/privoxy/config
  499. sed -i "s|Privoxy_Port2|$Privoxy_Port2|g" /etc/privoxy/config
  500.  
  501. # 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)
  502. rm -rf /etc/squid/sq*
  503. cat <<'mySquid' > /etc/squid/squid.conf
  504. via off
  505. forwarded_for delete
  506. request_header_access Authorization allow all
  507. request_header_access Proxy-Authorization allow all
  508. request_header_access Cache-Control allow all
  509. request_header_access Content-Length allow all
  510. request_header_access Content-Type allow all
  511. request_header_access Date allow all
  512. request_header_access Host allow all
  513. request_header_access If-Modified-Since allow all
  514. request_header_access Pragma allow all
  515. request_header_access Accept allow all
  516. request_header_access Accept-Charset allow all
  517. request_header_access Accept-Encoding allow all
  518. request_header_access Accept-Language allow all
  519. request_header_access Connection allow all
  520. request_header_access X-Forwarded-For deny all
  521. request_header_access Via deny all
  522. request_header_access Referer deny all
  523. request_header_access All deny all
  524. http_access allow localhost
  525. http_access deny all
  526. http_port 127.0.0.1:8989
  527. cache_peer 127.0.0.1 parent SquidCacheHelper 7 no-query no-digest default
  528. cache deny all
  529. mySquid
  530. sed -i "s|SquidCacheHelper|$Privoxy_Port1|g" /etc/squid/squid.conf
  531.  
  532. # Starting Proxy server
  533. echo -e "Restarting proxy server.."
  534. systemctl restart privoxy
  535. systemctl restart squid
  536. }
  537.  
  538. function OvpnConfigs(){
  539. # Creating nginx config for our ovpn config downloads webserver
  540. cat <<'myNginxC' > /etc/nginx/conf.d/bonveio-ovpn-config.conf
  541. # My OpenVPN Config Download Directory
  542. server {
  543. listen 0.0.0.0:myNginx;
  544. server_name localhost;
  545. root /var/www/openvpn;
  546. index index.html;
  547. }
  548. myNginxC
  549.  
  550. # Setting our nginx config port for .ovpn download site
  551. sed -i "s|myNginx|$OvpnDownload_Port|g" /etc/nginx/conf.d/bonveio-ovpn-config.conf
  552.  
  553. # Removing Default nginx page(port 80)
  554. rm -rf /etc/nginx/sites-*
  555.  
  556. # Creating our root directory for all of our .ovpn configs
  557. rm -rf /var/www/openvpn
  558. mkdir -p /var/www/openvpn
  559.  
  560. # Now creating all of our OpenVPN Configs
  561. cat <<EOF15> /var/www/openvpn/GTM-PC-Config.ovpn
  562. client
  563. dev tun
  564. proto tcp
  565. remote $IPADDR $OpenVPN_Port1
  566. remote-cert-tls server
  567. resolv-retry infinite
  568. nobind
  569. tun-mtu 1500
  570. tun-mtu-extra 32
  571. mssfix 1450
  572. persist-key
  573. persist-tun
  574. auth-user-pass
  575. auth none
  576. auth-nocache
  577. cipher none
  578. keysize 0
  579. comp-lzo
  580. setenv CLIENT_CERT 0
  581. reneg-sec 0
  582. verb 1
  583. http-proxy $IPADDR $Privoxy_Port1
  584. http-proxy-option VERSION 1.1
  585. http-proxy-option CUSTOM-HEADER ""
  586. http-proxy-option CUSTOM-HEADER "GET https://storage.googleapis.com HTTP/1.1"
  587. http-proxy-option CUSTOM-HEADER Host storage.googleapis.com
  588. http-proxy-option CUSTOM-HEADER X-Forward-Host storage.googleapis.com
  589. http-proxy-option CUSTOM-HEADER X-Forwarded-For storage.googleapis.com
  590. http-proxy-option CUSTOM-HEADER Referrer storage.googleapis.com
  591.  
  592. <ca>
  593. $(cat /etc/openvpn/ca.crt)
  594. </ca>
  595. EOF15
  596.  
  597. cat <<EOF152> /var/www/openvpn/GTMConfig.ovpn
  598. client
  599. dev tun
  600. proto tcp
  601. remote $IPADDR $OpenVPN_Port1
  602. remote-cert-tls server
  603. resolv-retry infinite
  604. nobind
  605. tun-mtu 1500
  606. tun-mtu-extra 32
  607. mssfix 1450
  608. persist-key
  609. persist-tun
  610. auth-user-pass
  611. auth none
  612. auth-nocache
  613. cipher none
  614. keysize 0
  615. comp-lzo
  616. setenv CLIENT_CERT 0
  617. reneg-sec 0
  618. verb 1
  619. http-proxy $IPADDR $Privoxy_Port1
  620. http-proxy-option VERSION 1.1
  621. http-proxy-option CUSTOM-HEADER Host www.googleapis.com
  622. http-proxy-option CUSTOM-HEADER X-Forwarded-For www.googleapis.com
  623.  
  624. <ca>
  625. $(cat /etc/openvpn/ca.crt)
  626. </ca>
  627. EOF152
  628.  
  629. cat <<EOF16> /var/www/openvpn/SunConfig.ovpn
  630. client
  631. dev tun
  632. proto tcp
  633. remote $IPADDR $OpenVPN_Port1
  634. remote-cert-tls server
  635. resolv-retry infinite
  636. nobind
  637. tun-mtu 1500
  638. tun-mtu-extra 32
  639. mssfix 1450
  640. persist-key
  641. persist-tun
  642. auth-user-pass
  643. auth none
  644. auth-nocache
  645. cipher none
  646. keysize 0
  647. comp-lzo
  648. setenv CLIENT_CERT 0
  649. reneg-sec 0
  650. verb 1
  651. http-proxy $IPADDR $Privoxy_Port1
  652. http-proxy-option CUSTOM-HEADER ""
  653. http-proxy-option CUSTOM-HEADER "POST https://viber.com HTTP/1.1"
  654. http-proxy-option CUSTOM-HEADER "X-Forwarded-For: viber.com"
  655.  
  656. <ca>
  657. $(cat /etc/openvpn/ca.crt)
  658. </ca>
  659. EOF16
  660.  
  661. cat <<EOF17> /var/www/openvpn/SunNoloadConfig.ovpn
  662. client
  663. dev tun
  664. proto tcp-client
  665. remote $IPADDR $OpenVPN_Port1
  666. remote-cert-tls server
  667. bind
  668. float
  669. tun-mtu 1500
  670. tun-mtu-extra 32
  671. mssfix 1450
  672. mute-replay-warnings
  673. connect-retry-max 9999
  674. redirect-gateway def1
  675. connect-retry 0 1
  676. resolv-retry infinite
  677. setenv CLIENT_CERT 0
  678. persist-tun
  679. persist-key
  680. auth-user-pass
  681. auth none
  682. auth-nocache
  683. auth-retry interact
  684. cipher none
  685. keysize 0
  686. comp-lzo
  687. reneg-sec 0
  688. verb 0
  689. nice -20
  690. log /dev/null
  691. <ca>
  692. $(cat /etc/openvpn/ca.crt)
  693. </ca>
  694. EOF17
  695.  
  696. # Creating OVPN download site index.html
  697. cat <<'mySiteOvpn' > /var/www/openvpn/index.html
  698. <!DOCTYPE html>
  699. <html lang="en">
  700.  
  701. <!-- Simple OVPN Download site by Bonveio Abitona -->
  702.  
  703. <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,SNS,FB and IG 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 Globe/TM <span class="badge light-blue darken-4">PC/Modem</span><br /><small> For EZ/GS Promo with WNP,SNS,FB and IG freebies</small></p><a class="btn btn-outline-success waves-effect btn-sm" href="http://IP-ADDRESS:NGINXPORT/GTM-PC-Config.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 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">Modem</span><br /><small> Without Promo/Noload</small></p><a class="btn btn-outline-success waves-effect btn-sm" href="http://IP-ADDRESS:NGINXPORT/SunNoloadConfig.ovpn" style="float:right;"><i class="fa fa-download"></i> Download</a></li></ul></div></div></div></div></body></html>
  704. mySiteOvpn
  705.  
  706. # Setting template's correct name,IP address and nginx Port
  707. sed -i "s|MyScriptName|$MyScriptName|g" /var/www/openvpn/index.html
  708. sed -i "s|NGINXPORT|$OvpnDownload_Port|g" /var/www/openvpn/index.html
  709. sed -i "s|IP-ADDRESS|$IPADDR|g" /var/www/openvpn/index.html
  710.  
  711. # Restarting nginx service
  712. systemctl restart nginx
  713.  
  714. # Creating all .ovpn config archives
  715. cd /var/www/openvpn
  716. zip -qq -r Configs.zip *.ovpn
  717. cd
  718. }
  719.  
  720. function ip_address(){
  721. 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 )"
  722. [ -z "${IP}" ] && IP="$( wget -qO- -t1 -T2 ipv4.icanhazip.com )"
  723. [ -z "${IP}" ] && IP="$( wget -qO- -t1 -T2 ipinfo.io/ip )"
  724. [ ! -z "${IP}" ] && echo "${IP}" || echo
  725. }
  726. IPADDR="$(ip_address)"
  727.  
  728. function ConfStartup(){
  729. # Daily reboot time of our machine
  730. # For cron commands, visit https://crontab.guru
  731. echo -e "0 4\t* * *\troot\treboot" > /etc/cron.d/b_reboot_job
  732.  
  733. # Creating directory for startup script
  734. rm -rf /etc/bonveio
  735. mkdir -p /etc/bonveio
  736. chmod -R 755 /etc/bonveio
  737.  
  738. # Creating startup script using cat eof tricks
  739. cat <<'EOFSH' > /etc/bonveio/startup.sh
  740. #!/bin/bash
  741. # Setting server local time
  742. ln -fs /usr/share/zoneinfo/MyVPS_Time /etc/localtime
  743.  
  744. # Prevent DOS-like UI when installing using APT (Disabling APT interactive dialog)
  745. export DEBIAN_FRONTEND=noninteractive
  746.  
  747. # Allowing ALL TCP ports for our machine (Simple workaround for policy-based VPS)
  748. iptables -A INPUT -s $(wget -4qO- http://ipinfo.io/ip) -p tcp -m multiport --dport 1:65535 -j ACCEPT
  749.  
  750. # Allowing OpenVPN to Forward traffic
  751. /bin/bash /etc/openvpn/openvpn.bash
  752.  
  753. # Deleting Expired SSH Accounts
  754. /usr/local/sbin/delete_expired &> /dev/null
  755. EOFSH
  756. chmod +x /etc/bonveio/startup.sh
  757.  
  758. # Setting server local time every time this machine reboots
  759. sed -i "s|MyVPS_Time|$MyVPS_Time|g" /etc/bonveio/startup.sh
  760.  
  761. #
  762. rm -rf /etc/sysctl.d/99*
  763.  
  764. # Setting our startup script to run every machine boots
  765. echo "[Unit]
  766. Description=Bonveio Startup Script
  767. Before=network-online.target
  768. Wants=network-online.target
  769.  
  770. [Service]
  771. Type=oneshot
  772. ExecStart=/bin/bash /etc/bonveio/startup.sh
  773. RemainAfterExit=yes
  774.  
  775. [Install]
  776. WantedBy=multi-user.target" > /etc/systemd/system/bonveio.service
  777. chmod +x /etc/systemd/system/bonveio.service
  778. systemctl daemon-reload
  779. systemctl start bonveio
  780. systemctl enable bonveio &> /dev/null
  781.  
  782. # Rebooting cron service
  783. systemctl restart cron
  784. systemctl enable cron
  785.  
  786. }
  787.  
  788. function ConfMenu(){
  789. echo -e " Creating Menu scripts.."
  790.  
  791. cd /usr/local/sbin/
  792. 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}
  793. wget -q 'https://raw.githubusercontent.com/Bonveio/BonvScripts/master/menu.zip'
  794. unzip -qq menu.zip
  795. rm -f menu.zip
  796. chmod +x ./*
  797. dos2unix ./* &> /dev/null
  798. sed -i 's|/etc/squid/squid.conf|/etc/privoxy/config|g' ./*
  799. sed -i 's|http_port|listen-address|g' ./*
  800. cd ~
  801.  
  802. echo 'clear' > /etc/profile.d/bonv.sh
  803. echo 'echo '' > /var/log/syslog' >> /etc/profile.d/bonv.sh
  804. echo 'screenfetch -p -A Android' >> /etc/profile.d/bonv.sh
  805. chmod +x /etc/profile.d/bonv.sh
  806. }
  807.  
  808. function ScriptMessage(){
  809. echo -e " (。◕‿◕。) $MyScriptName Debian VPS Installer"
  810. echo -e " Open release version"
  811. echo -e ""
  812. echo -e " Script created by Bonveio"
  813. echo -e ""
  814. }
  815.  
  816.  
  817. #############################
  818. #############################
  819. ## Installation Process
  820. #############################
  821. ## WARNING: Do not modify or edit anything
  822. ## if you did'nt know what to do.
  823. ## This part is too sensitive.
  824. #############################
  825. #############################
  826.  
  827. # First thing to do is check if this machine is Debian
  828. source /etc/os-release
  829. if [[ "$ID" != 'debian' ]]; then
  830. ScriptMessage
  831. echo -e "[\e[1;31mError\e[0m] This script is for Debian only, exting..."
  832. exit 1
  833. fi
  834.  
  835. # Now check if our machine is in root user, if not, this script exits
  836. # If you're on sudo user, run `sudo su -` first before running this script
  837. if [[ $EUID -ne 0 ]];then
  838. ScriptMessage
  839. echo -e "[\e[1;31mError\e[0m] This script must be run as root, exiting..."
  840. exit 1
  841. fi
  842.  
  843. # (For OpenVPN) Checking it this machine have TUN Module, this is the tunneling interface of OpenVPN server
  844. if [[ ! -e /dev/net/tun ]]; then
  845. 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"
  846. echo -e "[\e[1;31m-\e[0m] Script is now exiting..."
  847. exit 1
  848. fi
  849.  
  850. # Begin Installation by Updating and Upgrading machine and then Installing all our wanted packages/services to be install.
  851. ScriptMessage
  852. sleep 2
  853. InstUpdates
  854.  
  855. # Configure OpenSSH and Dropbear
  856. echo -e "Configuring ssh..."
  857. InstSSH
  858.  
  859. # Configure Stunnel
  860. echo -e "Configuring stunnel..."
  861. InsStunnel
  862.  
  863. # Configure Webmin
  864. echo -e "Configuring webmin..."
  865. InstWebmin
  866.  
  867. # Configure Privoxy and Squid
  868. echo -e "Configuring proxy..."
  869. InsProxy
  870.  
  871. # Configure OpenVPN
  872. echo -e "Configuring OpenVPN..."
  873. InsOpenVPN
  874.  
  875. # Configuring Nginx OVPN config download site
  876. OvpnConfigs
  877.  
  878. # Some assistance and startup scripts
  879. ConfStartup
  880.  
  881. ## DNS maker plugin for SUN users(for vps script usage only)
  882. wget -qO dnsmaker "https://raw.githubusercontent.com/Bonveio/BonvScripts/master/DNSMaster/debian"
  883. chmod +x dnsmaker
  884. ./dnsmaker
  885. rm -rf dnsmaker
  886. sed -i "s|http-proxy $IPADDR|http-proxy $(cat /tmp/abonv_mydns)|g" /var/www/openvpn/SunConfig.ovpn
  887. curl -4sSL "$(cat /tmp/abonv_mydns_domain)" &> /dev/null
  888. mv /tmp/abonv_mydns /etc/bonveio/my_domain_name
  889. mv /tmp/abonv_mydns_id /etc/bonveio/my_domain_id
  890. rm -rf /tmp/abonv*
  891.  
  892. # VPS Menu script v1.0
  893. ConfMenu
  894.  
  895. # Setting server local time
  896. ln -fs /usr/share/zoneinfo/$MyVPS_Time /etc/localtime
  897.  
  898. clear
  899. cd ~
  900.  
  901. # Running sysinfo
  902. bash /etc/profile.d/bonv.sh
  903.  
  904. # Showing script's banner message
  905. ScriptMessage
  906.  
  907. # Showing additional information from installating this script
  908. echo -e ""
  909. echo -e " Success Installation"
  910. echo -e ""
  911. echo -e " Service Ports: "
  912. echo -e " OpenSSH: $SSH_Port1, $SSH_Port2"
  913. echo -e " Stunnel: $Stunnel_Port1, $Stunnel_Port2"
  914. echo -e " DropbearSSH: $Dropbear_Port1, $Dropbear_Port2"
  915. echo -e " Privoxy: $Privoxy_Port1, $Privoxy_Port2"
  916. echo -e " OpenVPN: $OpenVPN_Port1"
  917. echo -e " NGiNX: $OvpnDownload_Port"
  918. echo -e " Webmin: 10000"
  919. echo -e ""
  920. echo -e ""
  921. echo -e " OpenVPN Configs Download site"
  922. echo -e " http://$IPADDR:$OvpnDownload_Port"
  923. echo -e ""
  924. echo -e " All OpenVPN Configs Archive"
  925. echo -e " http://$IPADDR:$OvpnDownload_Port/Configs.zip"
  926. echo -e ""
  927. echo -e " [For SUN Users]:"
  928. echo -e " Your DNS: $(cat /etc/bonveio/my_domain_name)"
  929. echo -e " Your DNS ID: $(cat /etc/bonveio/my_domain_id)"
  930. echo -e " * Keep your DNS ID in private, do not share your ID to anyone"
  931. echo -e ""
  932. echo -e ""
  933. echo -e " ©BonvScripts"
  934. echo -e " Official Update link: https://phcorner.net/threads/739298"
  935. echo -e ""
  936. echo -e " [Note] DO NOT RESELL THIS SCRIPT"
  937. echo -e " This script is under project of\n https://github.com/Bonveio/BonvScripts\n"
  938.  
  939. # Clearing all logs from installation
  940. rm -rf /root/.bash_history && history -c && echo '' > /var/log/syslog
  941.  
  942. rm -f DebianVPS-Installer*
  943. exit 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement