| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 | #!/bin/bash# Ensure /tmp exists and has the proper permissions before# checking for security updates# https://github.com/digitalocean/marketplace-partners/issues/94if [[ ! -d /tmp ]]; then  mkdir /tmpfichmod 1777 /tmpexport DEBIAN_FRONTEND=noninteractiveapt-get -y updateapt-get -o Dpkg::Options::="--force-confold" upgrade -q -y --force-yesapt-get purge droplet-agentrm -rf /opt/digitaloceanapt-get -y autoremoveapt-get -y autocleanrm -rf /tmp/* /var/tmp/*history -ccat /dev/null > /root/.bash_historyunset HISTFILEfind /var/log -mtime -1 -type f -exec truncate -s 0 {} \;rm -rf /var/log/*.gz /var/log/*.[0-9] /var/log/*-????????rm -rf /var/lib/cloud/instances/*rm -f /root/.ssh/authorized_keys /etc/ssh/*key*touch /etc/ssh/revoked_keyschmod 600 /etc/ssh/revoked_keys# Securely erase the unused portion of the filesystemGREEN='\033[0;32m'NC='\033[0m'printf "\n${GREEN}Writing zeros to the remaining disk space to securelyerase the unused portion of the file system.Depending on your disk size this may take several minutes.The secure erase will complete successfully when you see:${NC}    dd: writing to '/zerofile': No space left on device\nBeginning secure erase now\n"dd if=/dev/zero of=/zerofile &  PID=$!  while [ -d /proc/$PID ]    do      printf "."      sleep 5    donesync; rm /zerofile; synccat /dev/null > /var/log/lastlog; cat /dev/null > /var/log/wtmp
 |