Skip to content

Instantly share code, notes, and snippets.

@kelseyhightower
Created July 8, 2013 21:29
Show Gist options
  • Save kelseyhightower/5952671 to your computer and use it in GitHub Desktop.
Save kelseyhightower/5952671 to your computer and use it in GitHub Desktop.
#!/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