SHARE
TWEET

Shadowsocks + v2ray install script

a guest Aug 22nd, 2019 128 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. user='zero'
  4. domain='exebutcher.ga'
  5. server_template='https://pastebin.com/raw/wz5BugFv'
  6. client_template='https://pastebin.com/raw/18hJwFmG'
  7. renew_script='https://pastebin.com/raw/hbACM8V3'
  8. systemd_service_template='https://pastebin.com/raw/Mtm3A0K2'
  9. systemd_timer='https://pastebin.com/raw/jLGTRSNc'
  10.  
  11. sudo apt install shadowsocks-libev simple-obfs certbot haveged curl pwgen dos2unix
  12. password=$(pwgen -cns 32 1)
  13.  
  14. sudo apt autoremove
  15. wget https://github.com/shadowsocks/v2ray-plugin/releases/download/v1.1.0/v2ray-plugin-linux-amd64-v1.1.0.tar.gz
  16. tar -xvf v2ray-plugin-linux-amd64-v1.1.0.tar.gz
  17. rm v2ray-plugin-linux-amd64-v1.1.0.tar.gz
  18.  
  19.  
  20. sudo systemctl stop shadowsocks-libev
  21. sudo rm /etc/shadowsocks-libev/config.json
  22. sudo certbot certonly -n --standalone  --force-renewal -d $domain --agree-tos --email email@sobaka.net
  23. mkdir /home/$user/certs
  24.  
  25. list=("cert.pem"  "chain.pem"  "fullchain.pem"  "privkey.pem")
  26. for i in "${list[@]}"; do sudo cp /etc/letsencrypt/live/$domain/$i /home/$user/certs/; done
  27.  
  28. sudo chown $user:$user /home/$user/certs/*
  29. chmod 644 /home/$user/certs/*
  30. sudo setcap 'cap_net_bind_service=+ep' /usr/bin/ss-server
  31. sudo setcap 'cap_net_bind_service=+ep' /home/$user/v2ray-plugin_linux_amd64
  32.  
  33. curl $server_template > tmp.cfg
  34. dos2unix tmp.cfg
  35.  
  36. sed -i "s/pw_placeholder/$password/g" tmp.cfg
  37. sed -i "s/user_placeholder/$user/g" tmp.cfg
  38. sed -i "s/domain_placeholder/$domain/g" tmp.cfg
  39. sudo mv tmp.cfg /etc/shadowsocks-libev/config.json
  40. sudo systemctl start shadowsocks-libev
  41.  
  42. curl $client_template > client.json
  43. dos2unix client.json
  44.  
  45. sed -i "s/password_placeholder/$password/g" client.json
  46. sed -i "s/domain_placeholder/$domain/g" client.json
  47. sed -i "s/ip_placeholder/$(curl -s 2ip.ru)/g" client.json
  48.  
  49. curl $systemd_service_template > tmp
  50. dos2unix tmp
  51. sed -i "s/user_placeholder/$user/g" tmp
  52. sed -i "s/domain_placeholder/$domain/g" tmp
  53. sudo mv tmp /etc/systemd/system/cert-renew.service
  54. sudo wget $systemd_timer -O /etc/systemd/system/cert-renew.timer
  55. sudo dos2unix /etc/systemd/system/cert-renew.timer
  56. sudo wget $renew_script  -O /opt/renew.sh
  57. sudo dos2unix /opt/renew.sh
  58. sudo systemctl daemon-reload
  59. sudo systemctl start cert-renew.timer
  60. sudo systemctl enable cert-renew.timer
  61.  
  62. echo Client config in client.json:
  63. cat client.json
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top