Created
July 8, 2013 21:29
-
-
Save kelseyhightower/5952671 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function clear_audit_logs() { | |
/bin/cat /dev/null > /var/log/audit.log | |
/bin/cat /dev/null > /var/log/wtmp | |
} | |
function remove_ssh_host_keys() { | |
/bin/rm -f /etc/ssh/*key* | |
} | |
function cleanup_hosts_file() { | |
cat <<-EOF > /etc/hosts | |
127.0.0.1 localhost | |
127.0.1.1 localhost | |
# The following lines are desirable for IPv6 capable hosts | |
::1 localhost ip6-localhost ip6-loopback | |
ff02::1 ip6-allnodes | |
ff02::2 ip6-allrouters | |
EOF | |
} | |
function cleanup_hostname() { | |
echo "localhost" > /etc/hostname | |
} | |
function remove_root_shell_history() { | |
/bin/rm -f /root/.bash_history | |
unset HISTFILE | |
} | |
function main() { | |
remove_root_shell_history | |
clear_audit_logs | |
remove_ssh_host_keys | |
cleanup_hosts_file | |
cleanup_hostname | |
} | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment