Remove some extra files on shutdown

This commit is contained in:
Bob Mottram 2016-07-28 20:38:00 +01:00
parent cafa67da40
commit 8ba875e37e
1 changed files with 12 additions and 1 deletions

View File

@ -480,7 +480,18 @@ function mesh_amnesic {
echo '#!/bin/bash' > /usr/bin/amnesic echo '#!/bin/bash' > /usr/bin/amnesic
echo '' >> /usr/bin/amnesic echo '' >> /usr/bin/amnesic
echo 'MY_USERNAME=$1' >> /usr/bin/amnesic
echo 'tomb slam all' >> /usr/bin/amnesic echo 'tomb slam all' >> /usr/bin/amnesic
echo "if [ -f /home/${MY_USERNAME}/.bash_history ]; then" >> /usr/bin/amnesic
echo " shred -zu /home/${MY_USERNAME}/.bash_history" >> /usr/bin/amnesic
echo 'fi' >> /usr/bin/amnesic
echo "if [ -f /home/${MY_USERNAME}/.ssh/authorized_keys ]; then" >> /usr/bin/amnesic
echo " shred -zu /home/${MY_USERNAME}/.ssh/authorized_keys" >> /usr/bin/amnesic
echo " echo '' > /home/${MY_USERNAME}/.ssh/authorized_keys" >> /usr/bin/amnesic
echo 'fi' >> /usr/bin/amnesic
echo "if [ -f /home/${MY_USERNAME}/.xsession-errors ]; then" >> /usr/bin/amnesic
echo " shred -zu /home/${MY_USERNAME}/.xsession-errors" >> /usr/bin/amnesic
echo 'fi' >> /usr/bin/amnesic
echo '' >> /usr/bin/amnesic echo '' >> /usr/bin/amnesic
echo 'exit 0' >> /usr/bin/amnesic echo 'exit 0' >> /usr/bin/amnesic
chmod +x /usr/bin/amnesic chmod +x /usr/bin/amnesic
@ -495,7 +506,7 @@ function mesh_amnesic {
echo 'Type=oneshot' >> /etc/systemd/system/amnesic.service echo 'Type=oneshot' >> /etc/systemd/system/amnesic.service
echo 'RemainAfterExit=true' >> /etc/systemd/system/amnesic.service echo 'RemainAfterExit=true' >> /etc/systemd/system/amnesic.service
echo 'ExecStart=/bin/true' >> /etc/systemd/system/amnesic.service echo 'ExecStart=/bin/true' >> /etc/systemd/system/amnesic.service
echo "ExecStop=/usr/bin/amnesic" >> /etc/systemd/system/amnesic.service echo "ExecStop=/usr/bin/amnesic $MY_USERNAME" >> /etc/systemd/system/amnesic.service
echo '' >> /etc/systemd/system/amnesic.service echo '' >> /etc/systemd/system/amnesic.service
echo '[Install]' >> /etc/systemd/system/amnesic.service echo '[Install]' >> /etc/systemd/system/amnesic.service
echo 'WantedBy=multi-user.target' >> /etc/systemd/system/amnesic.service echo 'WantedBy=multi-user.target' >> /etc/systemd/system/amnesic.service