xray.sh 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. #!/bin/bash
  2. clear
  3. if [[ "$EUID" -ne 0 ]]; then
  4. echo -e "\033[1;31mScript need to be run as root!\033[0m"; exit 1
  5. fi
  6. apt-get -qq update
  7. wget -q -O - https://raw.githubusercontent.com/XTLS/Xray-install/main/install-release.sh | bash
  8. touch /usr/local/etc/xray/.xray
  9. cp /etc/letsencrypt/live/vpn.aidan.my/fullchain.pem /usr/local/etc/xray/xray.crt
  10. cp /etc/letsencrypt/live/vpn.aidan.my/privkey.pem /usr/local/etc/xray/xray.key
  11. chmod 644 /usr/local/etc/xray/xray.crt; chmod 644 /usr/local/etc/xray/xray.key
  12. alamat_ip=$(wget -qO- ipv4.icanhazip.com)
  13. alamat_port=$(shuf -i 1025-9999 -n 1)
  14. alamat_hos=$(cat /etc/environment | grep 'DOMAIN' | cut -d '=' -f 2 | head -n 1)
  15. alamat_emel=$(cat /etc/environment | grep 'EMAIL' | cut -d '=' -f 2)
  16. user_uid="$(cat '/proc/sys/kernel/random/uuid')"
  17. user_aid=$(shuf -i 1-254 -n 1)
  18. cat > xray-xtls.json <<-xray-xtls
  19. {
  20. "log": {
  21. "loglevel": "warning"
  22. },
  23. "inbounds": [
  24. {
  25. "port": $alamat_port,
  26. "protocol": "vless",
  27. "settings": {
  28. "clients": [
  29. {
  30. "id": "1d716ea0-9670-4359-800b-ed8d783ec04b",
  31. "flow": "xtls-rprx-direct",
  32. "level": 0,
  33. "email": "$alamat_emel"
  34. }
  35. ],
  36. "decryption": "none",
  37. "fallbacks": [
  38. {
  39. "dest": 1310,
  40. "xver": 1
  41. },
  42. {
  43. "path": "/websocket",
  44. "dest": 1234,
  45. "xver": 1
  46. },
  47. {
  48. "path": "/vmesstcp",
  49. "dest": 2345,
  50. "xver": 1
  51. },
  52. {
  53. "path": "/vmessws",
  54. "dest": 3456,
  55. "xver": 1
  56. }
  57. ]
  58. },
  59. "streamSettings": {
  60. "network": "tcp",
  61. "security": "xtls",
  62. "xtlsSettings": {
  63. "alpn": [
  64. "http/1.1"
  65. ],
  66. "certificates": [
  67. {
  68. "certificateFile": "/usr/local/etc/v2ray/v2ray.crt",
  69. "keyFile": "/usr/local/etc/v2ray/v2ray.key"
  70. }
  71. ]
  72. }
  73. }
  74. },
  75. {
  76. "port": 1310,
  77. "listen": "127.0.0.1",
  78. "protocol": "trojan",
  79. "settings": {
  80. "clients": [
  81. {
  82. "password": "",
  83. "level": 0,
  84. "email": "$alamat_emel"
  85. }
  86. ],
  87. "fallbacks": [
  88. {
  89. "dest": 80
  90. }
  91. ]
  92. },
  93. "streamSettings": {
  94. "network": "tcp",
  95. "security": "none",
  96. "tcpSettings": {
  97. "acceptProxyProtocol": true
  98. }
  99. }
  100. },
  101. {
  102. "port": 1234,
  103. "listen": "127.0.0.1",
  104. "protocol": "vless",
  105. "settings": {
  106. "clients": [
  107. {
  108. "id": "",
  109. "level": 0,
  110. "email": "$alamat_emel"
  111. }
  112. ],
  113. "decryption": "none"
  114. },
  115. "streamSettings": {
  116. "network": "ws",
  117. "security": "none",
  118. "wsSettings": {
  119. "acceptProxyProtocol": true,
  120. "path": "/websocket"
  121. }
  122. }
  123. },
  124. {
  125. "port": 2345,
  126. "listen": "127.0.0.1",
  127. "protocol": "vmess",
  128. "settings": {
  129. "clients": [
  130. {
  131. "id": "",
  132. "level": 0,
  133. "email": "$alamat_emel"
  134. }
  135. ]
  136. },
  137. "streamSettings": {
  138. "network": "tcp",
  139. "security": "none",
  140. "tcpSettings": {
  141. "acceptProxyProtocol": true,
  142. "header": {
  143. "type": "http",
  144. "request": {
  145. "path": [
  146. "/vmesstcp"
  147. ]
  148. }
  149. }
  150. }
  151. }
  152. },
  153. {
  154. "port": 3456,
  155. "listen": "127.0.0.1",
  156. "protocol": "vmess",
  157. "settings": {
  158. "clients": [
  159. {
  160. "id": "",
  161. "level": 0,
  162. "email": "$alamat_emel"
  163. }
  164. ]
  165. },
  166. "streamSettings": {
  167. "network": "ws",
  168. "security": "none",
  169. "wsSettings": {
  170. "acceptProxyProtocol": true,
  171. "path": "/vmessws"
  172. }
  173. }
  174. }
  175. ],
  176. "outbounds": [
  177. {
  178. "protocol": "freedom"
  179. }
  180. ]
  181. }
  182. xray-xtls
  183. systemctl enable xray@xray-xtls; systemctl start xray@xray-xtls
  184. echo
  185. echo -e "\033[1;32mCongratulation, We are done with the xray installation.\033[0m"
  186. echo
  187. echo 'Use my referral link https://m.do.co/c/a28a40414d6a'
  188. echo 'to gets $100 credit into your DigitalOcean account.'
  189. echo 'Created by Doctype, Powered by Cybertize'
  190. echo 'Copyright 2021, Allright reserved.'
  191. echo; sleep 5