Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Install script for a fresh setup raspbian to auto configure everything including studnet bouncer
- # insert your data
- studnetPass = ""
- studnetNr = ""
- studnetIp = ""
- # change password
- passwd
- # update
- sudo apt-get update
- sudo apt-get -y dist-upgrade
- # install nohup and sshpass
- sudo apt-get -y install nohup sshpass
- # firewall
- sudo apt-get -y install ufw
- sudo ufw allow 22
- sudo ufw enable
- # fail2ban
- sudo apt-get install fail2ban
- sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
- sudo service fail2ban restart
- # watchdog
- sudo apt-get install watchdog
- sudo modprobe bcm2835_wdt
- sudo echo "bcm2835_wdt" >> /etc/modules
- # add watchdog to startup applications
- sudo update-rc.d watchdog defaults
- # edit config und uncomment lines
- sudo sed -i '/^#.*max-load-1/s/^#//' /etc/watchdog.conf
- sudo sed -i '/^#.*watchdog-device/s/^#//' /etc/watchdog.conf
- sudo service watchdog start
- # studnet sh
- sudo touch /usr/local/bin/studnet.sh
- sudo chmod u+rwx /usr/local/bin/studnet.sh
- echo "#!/bin/bash" >> /usr/local/bin/studnet.sh
- echo "while true" >> /usr/local/bin/studnet.sh
- echo "do" >> /usr/local/bin/studnet.sh
- echo "sshpass -p '${studnetPass}' ssh -t -t -o StrictHostKeyChecking=no ${studnetNr}@${studnetIP}" >> /usr/local/bin/studnet.sh
- echo "echo \"done\"" >> /usr/local/bin/studnet.sh
- echo "sleep 5" >> /usr/local/bin/studnet.sh
- echo "done" >> /usr/local/bin/studnet.sh
- sudo touch /var/log/studnet.log
- sudo chmod 777 /var/log/studnet.log
- # add the sh to startup
- sudo sed -i 's/.*exit 0/\/usr\/bin\/nohup \/bin\/sh \/usr\/local\/bin\/studnet.sh > \/var\/log\/studnet.log &\n&/' /var/rc.local
- # activate auto updates
- sudo apt-get -y install unattended-upgrades apt-listchanges
- sudo dpkg-reconfigure -plow unattended-upgrades
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement