osso-docktool :: HDD administration and maintenance
osso-docktool provides tools to register disks to the OSSO dashboard, to print labels and wipe disks.
Requirements (apt install --no-install-recommends):
tmux # auto cli mode coreutils # dd pwgen # pwgen smartmontools # smartctl nvme-cli # nvme hdparm # hdparm sdparm # sdparm ledmon # LED control # FIXME: /usr/local/bin/run-lessrandom # FIXME: /usr/local/bin/run-zero-disk
Example usage (as root):
osso-docktool /dev/sdb
Example setup (as root):
pip3 install osso-docktool
install -dm0700 /etc/osso-docktool
install /usr/local/share/doc/osso-docktool/local_settings.py.template \
/etc/osso-docktool/local_settings.py
${EDITOR:-vi} /etc/osso-docktool/local_settings.py
# ^-- fix hostnames, fix tokens
# get 1 shared token from:
# https://account.example.com/admin/usertoken/token/
# If you wish to use the auto process you will want to add the
# root disk to the IGNORE_DEVICES list.
Automation
/etc/udev/rules.d/10-osso-docktool.rules:
# Match the block device but not the partitions.
KERNEL=="sd[a-z]", SUBSYSTEM=="block", ACTION=="add", ENV{SYSTEMD_WANTS}+="osso-docktool@%k.service", TAG+="systemd"
/etc/systemd/system/osso-docktool@.service:
[Unit] Description=Notify osso-docktool about disk %i StopWhenUnneeded=yes [Service] Type=oneshot RemainAfterExit=yes ExecStart=/usr/local/bin/osso-docktool auto-notify --add /dev/%i ExecStop=/usr/local/bin/osso-docktool auto-notify --remove /dev/%i
When a disk is inserted this will start the osso-docktool@<disk>.service which will notify the osso-docktool auto process. The service is needed because udev starts RUN commands in a restricted container without network access and the systemd process is started outside the restricted container.
When the disk is removed systemd will stop the osso-docktool@<disk>.service.
There are several auto commands Beware that both erase commands will erase all inserted disks that do not match the ignore list without confirmation!
EMAIL=me@example.com osso-docktool auto
By default this uses a tmux session to spawn osso-docktool commands but there is a -g|–gui toggle to switch to a graphical terminal. You can change the default graphical terminal with the command:
update-alternatives --config x-terminal-emulator
Other tools
/usr/local/bin/run-zero-disk (0700):
#!/bin/bash
path=$1
if test -z $path; then
echo "please supply path as argument"
exit 1
fi
output=$(dd if=/dev/zero \
of=$path \
bs=32M \
conv=fsync 2>&1)
ret=$?
# Checking output as DD does not exit clean even if whole disk is wiped
if [[ $ret -eq 0 ]]; then
exit 0
else
if [[ $output == *'No space left on device'* ]]; then
echo "Disk $path has been zeroed"
exit 0
else
echo "Something went wrong while writing to $path"
echo $output
exit 1
fi
fi
Compile lessrandom.c and move lessrandom to /usr/local/bin/lessrandom (0700):
lessrandom.c:
#include <stdio.h>
#include <time.h>
#define BUF 4096
int main() {
FILE *f;
char buf[BUF];
f = fopen("/dev/urandom", "rb");
while (1) {
if (fread(buf, 1, BUF, f) == BUF) {
int i;
for (i = 0; i <= buf[0]; ++i) {
fwrite(buf, 1, BUF - 1, stdout);
}
}
}
fclose(f);
return 0;
}
gcc -Wall lessrandom.c -o lessrandom
/usr/local/bin/run-lessrandom (0700):
#!/bin/bash
path=$1
if test -z $path; then
echo "please supply path as argument"
exit 1
fi
output=$(dd if=<(/usr/local/bin/lessrandom) \
of=$path \
bs=32M \
conv=fsync 2>&1)
ret=$?
# Checking output as DD does not exit clean even if whole disk is wiped
if [[ $ret -eq 0 ]]; then
exit 0
else
if [[ $output == *'No space left on device'* ]]; then
echo "Disk $path has been wiped"
exit 0
else
echo "Something went wrong while writing to $path"
echo $output
exit 1
fi
fi
Metadata
Release files for osso-docktool 1.9.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| osso_docktool-1.9.8.tar.gz | 32.4 kB | Without provenance | Details for osso_docktool-1.9.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| osso_docktool-1.9.8-py3-none-any.whl | Python 3 | none | any | Details for osso_docktool-1.9.8-py3-none-any.whl |
Total release size: 70.0 kB
Release files / osso_docktool-1.9.8.tar.gz
| Download URL | osso_docktool-1.9.8.tar.gz |
|---|---|
| Size | 32.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a449d047ad78bcdeecc97a7661846415f5fbfb1aca06fbc580fe08e79c406fd4
|
|
BLAKE2b-256 checksum How to use checksums |
daeb9695aa8d2312a653891f549b6eda6bc8e8c451beb2a323c57f05030dc5e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|
Release files / osso_docktool-1.9.8-py3-none-any.whl
| Download URL | osso_docktool-1.9.8-py3-none-any.whl |
|---|---|
| Size | 37.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1d0fdbef18c081b8a189655c51d203df8752beee381ae84feaee575bb1c9788e
|
|
BLAKE2b-256 checksum How to use checksums |
cba611dc6a1bfdca97e6b56d67b70f3063ded60e36819602fc074e7f3bf52f72
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|
Security for osso-docktool 1.9.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.