Debian9-10 35 KB

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