From 378cb1d5f745e61bb6c8ec5be0eb25fdf429ab26 Mon Sep 17 00:00:00 2001 From: Michael Trip Date: Tue, 5 Jan 2021 09:49:48 +0100 Subject: [PATCH] added seal script for vmware --- vmware-seal-opensuse.sh | 47 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 vmware-seal-opensuse.sh diff --git a/vmware-seal-opensuse.sh b/vmware-seal-opensuse.sh new file mode 100644 index 0000000..659d1b2 --- /dev/null +++ b/vmware-seal-opensuse.sh @@ -0,0 +1,47 @@ + #!/usr/bin/env bash + + # + # This is the sys_prep script + # It will clear out all non-revelent information for a new VM + # + # 1. Force logs to rotate and clear old. + /usr/sbin/logrotate -f /etc/logrotate.conf + /bin/rm -f /var/log/*-20* /var/log/*.gz + # + # 2. Clear the audit log & wtmp. + /bin/cat /dev/null > /var/log/audit/audit.log + /bin/cat /dev/null > /var/log/wtmp + # + # 3. Remove the udev device rules. + /bin/rm -f /etc/udev/rules.d/70* + # + # 4. Remove the traces of the template MAC address and UUIDs. + /bin/sed -i '/^\(HWADDR\|UUID\|IPADDR\|NETMASK\|GATEWAY\)=/d' /etc/sysconfig/network/ifcfg-e* + # + # 5. Clean /tmp out. + /bin/rm -rf /tmp/* + /bin/rm -rf /var/tmp/* + # + # 6. Remove the SSH host keys. + /bin/rm -f /etc/ssh/*key* + # + # 7. Remove the root user's shell history. + /bin/rm -f /root/.bash_history + unset HISTFILE + # + # 8. Set hostname to localhost + + /bin/hostnamectl set-hostname localhost.localdomain + + # + # 9. Remove rsyslog.conf remote log server IP. + /bin/sed -i '/1.1.1.1.1/'d /etc/rsyslog.conf + + + + rm -v /root/.ssh/known_hosts + + # + # 11. Shutdown the VM. Poweron required to scan new HW addresses. + poweroff + # \ No newline at end of file