Last active
September 14, 2019 20:55
-
-
Save michalblaha/1e37fdd21386d3eb431b21596d71e12d to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
#Paths are for Centos 7.x | |
# Install optional packages | |
yum check-update | |
yum clean all | |
yum update -y | |
yum install -y bash-completion htop yum-utils | |
yum install sudo -y | |
yum install nano -y | |
yum install qemu-guest-agent.x86_64 -y | |
systemctl status qemu-guest-agent | |
#stop logging services | |
/sbin/service rsyslog stop | |
/sbin/service auditd stop | |
#remove old kernels | |
/usr/bin/package-cleanup --oldkernels --count=1 | |
#clean yum cache | |
/usr/bin/yum clean all | |
#force logrotate to shrink logspace and remove old logs as well as truncate logs | |
/usr/sbin/logrotate -f /etc/logrotate.conf | |
/bin/rm -f /var/log/*-???????? /var/log/*.gz | |
/bin/rm -f /var/log/dmesg.old | |
/bin/rm -rf /var/log/anaconda | |
/bin/cat /dev/null > /var/log/audit/audit.log | |
/bin/cat /dev/null > /var/log/wtmp | |
/bin/cat /dev/null > /var/log/lastlog | |
/bin/cat /dev/null > /var/log/grubby | |
#remove udev hardware rules | |
/bin/rm -f /etc/udev/rules.d/70* | |
#remove uuid from ifcfg scripts | |
/bin/sed -i '/^(HWADDR|UUID)=/d' /etc/sysconfig/network-scripts/ifcfg-ent0 | |
#remove SSH host keys | |
/bin/rm -f /etc/ssh/*key* | |
#remove root users shell history | |
/bin/rm -f ~root/.bash_history | |
unset HISTFILE | |
#remove root users SSH history | |
/bin/rm -rf ~root/.ssh/ | |
poweroff |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment