diff --git a/README.md b/README.md index e8a3839..671c284 100644 --- a/README.md +++ b/README.md @@ -10,71 +10,36 @@ ## Debian Build Notes -* apt-get install ncurses-dev git make g++ -* clone repo in /root/ -* make release +* `apt-get install ncurses-dev git make g++` +* `make release` ## Create Standalone with Debian 11 Instructions how to create a standalone machine that boots directly to reHDD. This is aimed for production use, like several drives a day shredding. +* Start reHDD after boot without login (as a tty1 shell) +* Start dmesg after boot without login (as a tty2 shell) +* Start htop after boot without login (as a tty3 shell) +* Upload reHDD log every 12h if wanted ### Software requirements -* apt-get install hwinfo smartmontools curl +* `apt-get install hwinfo smartmontools curl` -### Start reHDD after boot without login (as a tty shell) +### Installation -mkdir /lib/systemd/system/getty@tty1.service.d/ +clone this repo into /root/ -nano /lib/systemd/system/getty@tty1.service.d/override.conf +`cd /root/reHDD/` -``` -[Service] -WorkingDirectory=/root/reHDD -ExecStart= -ExecStart=-/root/reHDD/reHDD -StandardInput=tty -StandardOutput=tty -Restart=always -RestartSec=1 -UtmpIdentifier=tty1 -TTYPath=/dev/tty1 -TTYReset=yes -TTYVHangup=yes -TTYVTDisallocate=yes -SendSIGHUP=yes +`make release` -``` +`bash scripts/install_reHDD.bash` -systemctl daemon-reload +If you want to upload the logs, edit `scripts/reHDDLogUploader.bash` with your nextcloud token -nano /etc/systemd/system/reHDDSettings.service -``` -[Service] -Type=oneshot -RemainAfterExit=yes -ExecStart=/usr/bin/bash /root/reHDDSettings.sh - -[Install] -WantedBy=multi-user.target -``` - -nano /root/reHDDSettings.sh -``` -#!/bin/bash -dmesg -n 1 #disable overlay if a drive is attached/detached -# remove comment for the following to activate log telemetie -# curl -k -T /root/reHDD/reHDD.log -u "fgggfffgfgfgfg:" -H 'X-Requested-With: XMLHttpRequest' https://schuttercloud.com/public.php/webdav/`echo $(date '+%Y-%m-%d_%H-%M')`_reHDD.log -rm -f /root/reHDD/reHDD.log -``` -chmod +x reHDDSettings.sh - - -Make sure the binary reHDD is in /root/reHDD/ - -Add your system drive in /root/reHDD/ignoreDrives.conf like: +Add your system drive in `/root/reHDD/ignoreDrives.conf` like: ```e102f49d``` -Get the first 8 Bytes from your UUID via blkid /dev/sdX +Get the first 8 Bytes from your UUID via `blkid /dev/sdX` -systemctl enable reHDDSettings.service +`reboot` diff --git a/doc/screenshot.png b/doc/screenshot.png index 7606712..0fd095e 100644 Binary files a/doc/screenshot.png and b/doc/screenshot.png differ diff --git a/scripts/getty@tty1.service.d_override.conf b/scripts/getty@tty1.service.d_override.conf new file mode 100644 index 0000000..4544b4e --- /dev/null +++ b/scripts/getty@tty1.service.d_override.conf @@ -0,0 +1,17 @@ +[Unit] +Description=reHDD on tty1 + +[Service] +WorkingDirectory=/root/reHDD/ +ExecStart= +ExecStart=-/root/reHDD/reHDD +StandardInput=tty +StandardOutput=tty +Restart=always +RestartSec=1 +UtmpIdentifier=tty1 +TTYPath=/dev/tty1 +TTYReset=yes +TTYVHangup=yes +TTYVTDisallocate=yes +SendSIGHUP=yes diff --git a/scripts/getty@tty2.service.d_override.conf b/scripts/getty@tty2.service.d_override.conf new file mode 100644 index 0000000..4dc5b66 --- /dev/null +++ b/scripts/getty@tty2.service.d_override.conf @@ -0,0 +1,17 @@ +[Unit] +Description=dmesg on tty2 + +[Service] +WorkingDirectory=/usr/bin/ +ExecStart= +ExecStart=-/usr/bin/dmesg -wH +StandardInput=tty +StandardOutput=tty +Restart=always +RestartSec=1 +UtmpIdentifier=tty2 +TTYPath=/dev/tty2 +TTYReset=yes +TTYVHangup=yes +TTYVTDisallocate=yes +SendSIGHUP=yes diff --git a/scripts/getty@tty3.service.d_override.conf b/scripts/getty@tty3.service.d_override.conf new file mode 100644 index 0000000..4b96c75 --- /dev/null +++ b/scripts/getty@tty3.service.d_override.conf @@ -0,0 +1,17 @@ +[Unit] +Description=htop on tty3 + +[Service] +WorkingDirectory=/usr/bin/ +ExecStart= +ExecStart=-/usr/bin/htop +StandardInput=tty +StandardOutput=tty +Restart=always +RestartSec=1 +UtmpIdentifier=tty3 +TTYPath=/dev/tty3 +TTYReset=yes +TTYVHangup=yes +TTYVTDisallocate=yes +SendSIGHUP=yes diff --git a/scripts/install_reHDD.bash b/scripts/install_reHDD.bash new file mode 100644 index 0000000..4628aad --- /dev/null +++ b/scripts/install_reHDD.bash @@ -0,0 +1,27 @@ +#!/bin/bash + +cd /root/reHDD/scripts/ + +chmod +x reHDDLogUploader.bash +cp reHDDLogUploader.service /lib/systemd/system/reHDDLogUploader.service +cp reHDDLogUploader.timer /lib/systemd/system/reHDDLogUploader.timer +systemctl daemon-reload +systemctl enable /lib/systemd/system/reHDDLogUploader.timer + +chmod +x reHDDStartHelper.bash +cp reHDDStartHelper.service /lib/systemd/system/reHDDStartHelper.service +systemctl daemon-reload +systemctl enable /lib/systemd/system/reHDDStartHelper.service + +mkdir -p /lib/systemd/system/getty@tty1.service.d +cp getty@tty1.service.d_override.conf /lib/systemd/system/getty@tty1.service.d/override.conf +systemctl daemon-reload + +mkdir -p /lib/systemd/system/getty@tty2.service.d +cp getty@tty2.service.d_override.conf /lib/systemd/system/getty@tty2.service.d/override.conf +systemctl daemon-reload + +mkdir -p /lib/systemd/system/getty@tty3.service.d +cp getty@tty3.service.d_override.conf /lib/systemd/system/getty@tty3.service.d/override.conf +systemctl daemon-reload + diff --git a/scripts/reHDDLogUploader.bash b/scripts/reHDDLogUploader.bash new file mode 100644 index 0000000..b384aa2 --- /dev/null +++ b/scripts/reHDDLogUploader.bash @@ -0,0 +1,6 @@ +#!/bin/bash +# remove comment for the following to activate log telemetie +curl -k -T /root/reHDD/reHDD.log -u "__Place_your_token_here__:" -H 'X-Requested-With: XMLHttpRequest' https://schuttercloud.com/public.php/webdav/`echo $(date '+%Y-%m-%d_%H-%M')`_reHDD.log +rm -f /root/reHDD/reHDD.log + + diff --git a/scripts/reHDDLogUploader.service b/scripts/reHDDLogUploader.service new file mode 100644 index 0000000..724addd --- /dev/null +++ b/scripts/reHDDLogUploader.service @@ -0,0 +1,18 @@ +[Unit] +Description=reHDD log uploader +After=syslog.target +After=network.target +After=network-online.target +Wants=network-online.target + +[Service] +Type=oneshot +User=root +Group=root +RemainAfterExit=yes +ExecStart=/usr/bin/bash /root/reHDD/scripts/reHDDLogUploader.bash + +[Install] +WantedBy=multi-user.target + + diff --git a/scripts/reHDDLogUploader.timer b/scripts/reHDDLogUploader.timer new file mode 100644 index 0000000..86cc3f6 --- /dev/null +++ b/scripts/reHDDLogUploader.timer @@ -0,0 +1,11 @@ +[Unit] +Description=reHDD log uploader timer + +[Timer] +OnActiveSec=30s +OnBootSec=10min +OnUnitActiveSec=12h + +[Install] +WantedBy=basic.target + diff --git a/scripts/reHDDStartHelper.bash b/scripts/reHDDStartHelper.bash new file mode 100644 index 0000000..0607d01 --- /dev/null +++ b/scripts/reHDDStartHelper.bash @@ -0,0 +1,4 @@ +#!/bin/bash +dmesg -n 1 #disable overlay if a drive is attached/detached + + diff --git a/scripts/reHDDStartHelper.service b/scripts/reHDDStartHelper.service new file mode 100644 index 0000000..a15bcda --- /dev/null +++ b/scripts/reHDDStartHelper.service @@ -0,0 +1,16 @@ +[Install] +WantedBy=multi-user.target + +[Unit] +Description=reHDD start helper +After=syslog.target + +[Service] +Type=oneshot +User=root +Group=root +RemainAfterExit=yes +ExecStart=/usr/bin/bash /root/reHDD/scripts/reHDDStartHelper.bash + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/shred_dummy.sh b/shred_dummy.sh deleted file mode 100644 index afc4268..0000000 --- a/shred_dummy.sh +++ /dev/null @@ -1,12 +0,0 @@ -#! /bin/bash - -echo "starting SHRED DUMMY" - -for i in {0..100..10} -do - #echo "DUMMY shred $i%" - echo $date > out.txt - sleep 1 -done - -echo "finished SHRED DUMMY"