Advertisement
Guest User

studnet

a guest
Jan 31st, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.76 KB | None | 0 0
  1. #!/bin/bash
  2. # Install script for a fresh setup raspbian to auto configure everything including studnet bouncer
  3. # insert your data
  4. studnetPass = ""
  5. studnetNr = ""
  6. studnetIp = ""
  7.  
  8. # change password
  9. passwd
  10.  
  11. # update
  12. sudo apt-get update
  13. sudo apt-get -y dist-upgrade
  14.  
  15. # install nohup and sshpass
  16. sudo apt-get -y install nohup sshpass
  17.  
  18. # firewall
  19. sudo apt-get -y install ufw
  20. sudo ufw allow 22
  21. sudo ufw enable
  22.  
  23. # fail2ban
  24. sudo apt-get install fail2ban
  25. sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
  26. sudo service fail2ban restart
  27.  
  28. # watchdog
  29. sudo apt-get install watchdog
  30. sudo modprobe bcm2835_wdt
  31. sudo echo "bcm2835_wdt" >> /etc/modules
  32. # add watchdog to startup applications
  33. sudo update-rc.d watchdog defaults
  34. # edit config und uncomment lines
  35. sudo sed -i '/^#.*max-load-1/s/^#//' /etc/watchdog.conf
  36. sudo sed -i '/^#.*watchdog-device/s/^#//' /etc/watchdog.conf
  37. sudo service watchdog start
  38.  
  39. # studnet sh
  40. sudo touch /usr/local/bin/studnet.sh
  41. sudo chmod u+rwx /usr/local/bin/studnet.sh
  42. echo "#!/bin/bash" >> /usr/local/bin/studnet.sh
  43. echo "while true" >> /usr/local/bin/studnet.sh
  44. echo "do" >> /usr/local/bin/studnet.sh
  45. echo "sshpass -p '${studnetPass}' ssh -t -t -o StrictHostKeyChecking=no ${studnetNr}@${studnetIP}" >> /usr/local/bin/studnet.sh
  46. echo "echo \"done\"" >> /usr/local/bin/studnet.sh
  47. echo "sleep 5" >> /usr/local/bin/studnet.sh
  48. echo "done" >> /usr/local/bin/studnet.sh
  49.  
  50.  
  51. sudo touch /var/log/studnet.log
  52. sudo chmod 777 /var/log/studnet.log
  53.  
  54. # add the sh to startup
  55. sudo sed -i 's/.*exit 0/\/usr\/bin\/nohup \/bin\/sh \/usr\/local\/bin\/studnet.sh > \/var\/log\/studnet.log &\n&/' /var/rc.local
  56.  
  57. # activate auto updates
  58. sudo apt-get -y install unattended-upgrades apt-listchanges
  59. sudo dpkg-reconfigure -plow unattended-upgrades
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement