From 4beae781a232079846a849d9604bf571b1ec9fee Mon Sep 17 00:00:00 2001 From: Tobias Mueller Date: Mon, 16 Oct 2023 14:51:59 +0200 Subject: [PATCH] mac-wipe: copy existing database into a volatile memory rather than deleting everything. It seems that the device stops working when deleting the database. That is, the connection to the Internet stops working which is very safe as it does not leak any data but arguably defeats the purpose of the device. --- files/lib/blue-merle/mac-wipe.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/files/lib/blue-merle/mac-wipe.sh b/files/lib/blue-merle/mac-wipe.sh index 631339b..b32ce58 100644 --- a/files/lib/blue-merle/mac-wipe.sh +++ b/files/lib/blue-merle/mac-wipe.sh @@ -2,10 +2,17 @@ # This script wipes all MAC address data from the device and is called upon boot -/etc/init.d/gl-tertf stop -shred /etc/oui-tertf/client.db || rm -f /etc/oui-tertf/client.db +tmpdir="$(mktemp -d)" # We mount a tmpfs so that the client database will be stored in memory only +mount -t tmpfs / "$tmpdir" +/etc/init.d/gl-tertf stop +cp -a /etc/oui-tertf/client.db "$tmpdir" +shred /etc/oui-tertf/client.db || rm -f /etc/oui-tertf/client.db + mount -t tmpfs / /etc/oui-tertf +cp -a "$tmpdir/client.db" /etc/oui-tertf/client.db +umount -t tmpfs -l "$tmpdir" + logger -p notice -t blue-merle-mac-wipe "Restarting tertf..." /etc/init.d/gl-tertf start logger -p notice -t blue-merle-mac-wipe "... Finished"