#!/bin/bash -e #Set up iptables, disable root login and create unprivilaged user #User info is displayed at end of script and also saved as auth.txt #Usage: cp /usr/share/webmin/geohelm/scripts/secure-debian.txt /opt/secure-debian.sh #Usage: cp /opt #Usage: chmod +x secure-debian.sh #Usage: ./secure-debian.sh #Change user name below to something else! UNPRIV_USER='helmin' function install_iptables(){ #Set firewall rules cat >/etc/iptables.save </etc/network/if-pre-up.d/iptablesload <> /root/auth.txt fi sed -i.save 's/#\?Port [0-9]\+/Port 3824/' /etc/ssh/sshd_config sed -i.save 's/#\?PermitRootLogin.*/PermitRootLogin no/' /etc/ssh/sshd_config service ssh restart } touch /root/auth.txt apt-get -y install iptables install_iptables; secure_ssh; echo "Passwords saved in /root/auth.txt" cat /root/auth.txt