From 1eada6a5e8ed5e304ff245228472b629d2d0b2a0 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Thu, 16 Feb 2023 15:32:55 -0500 Subject: [PATCH] fix: purge log files and droplet-agent This should fix a few of the warnings/errors shown during the image check process. --- contrib/images/digitalocean/in_parts/099-cleanup | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/contrib/images/digitalocean/in_parts/099-cleanup b/contrib/images/digitalocean/in_parts/099-cleanup index b6dfe7d09..c46a9f468 100755 --- a/contrib/images/digitalocean/in_parts/099-cleanup +++ b/contrib/images/digitalocean/in_parts/099-cleanup @@ -18,6 +18,7 @@ apt-get -y update apt-get -o Dpkg::Options::="--force-confold" upgrade -q -y --force-yes apt-get -y autoremove apt-get -y autoclean +apt-get -y purge droplet-agent echo '--> Clearing history' history -c @@ -27,6 +28,7 @@ unset HISTFILE echo '--> Clearing log files' find /var/log -mtime -1 -type f -exec truncate -s 0 {} \; rm -rf /var/log/*.gz /var/log/*.[0-9] /var/log/*-???????? +rm /var/log/alternatives.log /var/log/auth.log /var/log/cloud-init-output.log /var/log/cloud-init.log /var/log/dpkg.log /var/log/kern.log /var/log/ubuntu-advantage-timer.log /var/log/ufw.log /var/log/unattended-upgrades cat /dev/null >/var/log/lastlog cat /dev/null >/var/log/wtmp rm -rf /var/lib/cloud/instances/* @@ -37,6 +39,9 @@ rm -f /root/.ssh/authorized_keys /etc/ssh/*key* touch /etc/ssh/revoked_keys chmod 600 /etc/ssh/revoked_keys +echo '--> DO Directory' +ls -lah /opt/digitalocean + echo '--> Securely erase the unused portion of the filesystem' printf "\n\033[0;32mWriting zeros to the remaining disk space to securely erase the unused portion of the file system.