Last active
December 21, 2015 20:58
-
-
Save vdel26/6364892 to your computer and use it in GitHub Desktop.
Clean instance before pubslihing custom AMI
This file contains 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
# erase bash history | |
find /root/.*history /home/*/.*history -exec rm -f {} \; | |
# erase ssh authorized keys | |
find / -name "authorized_keys" –exec rm –f {} \; | |
sudo rm /etc/ssg/ssh_host_dsa_key* /etc/ssh/ssh_host_rsa_key* /etc/ssh/ssh_host_key* /etc/ssh/ssh_host_ecdsa_key* | |
# disable root and ubuntu user password | |
sudo passwd -l root | |
passwd -l ubuntu | |
# - make sure to remove any other passwords | |
# - configure sshd to allow only public key authentication | |
# in sshd_config: | |
# PubkeyAuthentication yes | |
# PasswordAuthentication no | |
# use rkhunter to check for Linux rootkit vulnerabilities |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment