Cleaning-up a system for migration and destruction

system common

review/backup/migrate for every user incl. root

ls -lF /home/

~/
~/.ssh/
~/bin/

crontab -l

and system-wide

cd /etc/
ls -altr

cat /etc/hosts
cat /etc/resolv.conf

ls -lF /etc/rc.local*
ls -lF /etc/rc.d/rc.local*
ls -lF /etc/rc.d/rc.inet1

/opt/
/data/
/var/tmp/
/var/named/
/var/...

/var/mail/
/usr/src/

find / -type f -size +1G

workstation specific

~/.config/chromium/
~/.mozilla/
~/.thunderbird/
desktop documents pictures ...

send to DEDIBACKUP

public data

#xc
lftp -u auto,auto dedibackup-dc2.online.net
lcd /data/backup/
mirror -R -e -c

sensible data

#xc
lftp -u auto,auto dedibackup-dc2.online.net
lcd /data/
secret=SYMMETRIC-PASSPHRASE-HERE
tar czf - TARGET/ | \
    openssl enc -aes-256-cbc -e -k "$secret" -pbkdf2 -out TARGET.tar.gz.aes \
    && echo done || echo FAILED

Wipe-out privkeys

apt install secure-delete
srm ~/.ssh/id_*

or if you deleted the file already forgot to shred it first, it will be difficult to locate the exact location of what is left of the file on the disk, your best option is to fill the unused space with zeros, on a mounted file-system

dd if=/dev/zero of=zero.raw status=progress
sync
rm -f zero.raw

or on an un-mounted file-system

apt install zerofree
zerofree /dev/sdaX

Wipe-out disks

in case you are liberating that root-server from your farm, wipe-out your backups first

#ssd
lftp -u auto,auto dedibackup-dc3.online.net

then boot in rescue mode and

fdisk -l

mount /dev/sda1 /mnt/
apt update
apt install secure-delete
srm -rf /mnt/root/.ssh/
srm -rf /mnt/home/USERNAME/.ssh/
umount /mnt/

dd if=/dev/zero of=/dev/sda status=progress
sync

or boot-up your box with rescue system and simply low-format everything

apt update
apt install htop

screen
htop
dd if=/dev/zero of=/dev/sda bs=1M status=progress
dd if=/dev/zero of=/dev/sdb bs=1M status=progress
dd if=/dev/zero of=/dev/sdc bs=1M status=progress

finally reboot in normal mode and get rid of the box.

Resources

How to securely delete data after rm https://unix.stackexchange.com/questions/298484/how-to-securely-delete-data-after-rm

Clear unused space with zeros (ext3,ext4) https://unix.stackexchange.com/questions/44234/clear-unused-space-with-zeros-ext3-ext4


HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | HTML5 | CONTACT
Copyright © 2024 Pierre-Philipp Braun