run_slave_vip.sh 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. # bash -c "$(curl -fsSL http://hubgit.cn/ben/be-vpn/raw/master/run_slave_vip.sh)"
  2. # fixed
  3. sed -i 's/#$nrconf{restart} = '\"'\"'i'\"'\"';/$nrconf{restart} = '\"'\"'a'\"'\"';/g' /etc/needrestart/needrestart.conf
  4. sed -i "s/#\$nrconf{kernelhints} = -1;/\$nrconf{kernelhints} = -1;/g" /etc/needrestart/needrestart.conf
  5. sudo DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade -y
  6. mkdir /root/.ssh
  7. cat > /root/.ssh/id_rsa.pub << EOF
  8. ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDB60cDQjWkBl5hKvQc53mtKSnfEKKCQc5vCq4SRgiseZ+DjYSCHshUHsVW7RtzMMllv3iTTOKcWjkLPxSs7mfTWfMac6LVuMIungsC/Sp1MUwVdzz/9T0geTx0tpuIS+5FCw/iuqJKe31ucaF0UJMUBWRPvMjc5UXAMqKPaSrtTb98sE0398eRWYSa7xrho8y0lWepp5i7fG1fKmRZE4i/yKTtLsPLKhgwvuPgsD+E+fhAmT2zEHZKZ/LRhnfBiB4Pli4aoFV85p7Q9PXwQ+4SsNhA8aYeGLtneVkfWNOSb6xbek7Uz+PN2k5s2gAckZKXVrubgCqZtF+U9aHmwEJYwsbITeB1ZiyRnYDRJ13PKBooV1NftppGUTtnOWqpKtNnztuYQimXQrYQMJb/3N7rQ7GWBkbJ00JYAQ3GXn1ML0qT4oWQmy9SDymROCwd6K5tMjXhiHj5DYnUTO5hhEEKLKNojboCzSWIiKoous/8I0OyyTUE+Fzl5jYRQ4bE9F8=
  9. EOF
  10. cat > /root/.ssh/id_rsa << EOF
  11. -----BEGIN OPENSSH PRIVATE KEY-----
  12. b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn
  13. NhAAAAAw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XYNUd32XGCiMVZOrM
  42. tYfLHTY2lkRbOCDyUpgE08YNSZhmELH/28YZTaB16n+T33tv3pUiazRI3/hxWmu6uW9kVU
  43. rktMF9+dQdHW38YSkpsOuJNHxD3SmhdQAAAMEA9Gp4ppm1idAbKs6P3obR0hC1pOIHj6aX
  44. qCUZmxxCe+dhu0zJFGPoHV9wmt9ulGtg4keGOPmjYDaKjDKINeiJh0iq13aCOfB5AJurFX
  45. V58qf/+Tkr7hi62d3a120pguIG+ch4Ph/MFqKQ3ldTWxAriwsVeJgtOoAYuxMcL8fzAQtL
  46. VAh7NmBC7pJp0Ct/H5rj/BooOHunfbY1dUqPtjhrkDDPnv3YWHqc0Ue9F/xypQEbX5qUa2
  47. O5Ewg0+A83ldADAAAAFnJvb3RAbnljMy0wMS12MjAyNTAxMTMBAgME
  48. -----END OPENSSH PRIVATE KEY-----
  49. EOF
  50. chmod 600 /root/.ssh
  51. chmod 600 /root/.ssh/id_rsa
  52. chmod 600 /root/.ssh/id_rsa.pub
  53. ssh-keygen -F hubgit.cn || ssh-keyscan hubgit.cn >~/.ssh/known_hosts
  54. git clone root@hubgit.cn:ben/be-vpn.git
  55. cd be-vpn
  56. apt update -y
  57. add-apt-repository ppa:longsleep/golang-backports -y
  58. apt install golang-1.21 -y
  59. apt install golang -y
  60. chmod +x ./scripts/openvpn-install.sh
  61. export AUTO_INSTALL=y && ./scripts/openvpn-install.sh
  62. go build ./cmd/slave.go
  63. nohup ./slave -vip true &
  64. tail -f nohup.out