From 75719aa37f7317f3a8feeb516f1444edb4274410 Mon Sep 17 00:00:00 2001 From: Jason McCormick Date: Thu, 5 Nov 2026 18:20:34 -0500 Subject: feat: TOML config and upload notification watcher Replace allowed-uris.txt with config.toml: [GLOBAL] holds SMTP settings (send_as, smtp_server, smtp_port, tls, starttls) and every other stanza is an upload URI with a recipient and optional view_url_prefix. Add watcher.py, run every 5 minutes by a systemd timer, which emails each drop's recipient once per run when new images appeared in the last slot. The email links each image under view_url_prefix and includes its .txt submission details. Fix the service unit and Makefile to use CONFIG_FILE, install the watcher and its units, and validate the config before restarting. Co-Authored-By: Claude Opus 5.5 --- deploy/blind-uploader-watcher.service | 39 +++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 deploy/blind-uploader-watcher.service (limited to 'deploy/blind-uploader-watcher.service') diff --git a/deploy/blind-uploader-watcher.service b/deploy/blind-uploader-watcher.service new file mode 100644 index 0000000..7d08e31 --- /dev/null +++ b/deploy/blind-uploader-watcher.service @@ -0,0 +1,39 @@ +[Unit] +Description=Private Drop upload notifier +Documentation=file:/opt/blind-uploader/README.md +After=network-online.target +Wants=network-online.target + +[Service] +Type=oneshot +User=www-data +Group=www-data +WorkingDirectory=/opt/blind-uploader +ExecStart=/usr/bin/python3 /opt/blind-uploader/watcher.py + +Environment=UPLOAD_DIR=/var/lib/blind-uploader/uploads +Environment=CONFIG_FILE=/etc/blind-uploader/config.toml +Environment=PYTHONDONTWRITEBYTECODE=1 +EnvironmentFile=-/etc/default/blind-uploader +# Optional SMTP_USERNAME / SMTP_PASSWORD (keep this file root:root 0600). +EnvironmentFile=-/etc/default/blind-uploader-watcher + +# The notifier only reads uploads and opens outbound SMTP connections. +UMask=0077 +NoNewPrivileges=yes +PrivateTmp=yes +PrivateDevices=yes +ProtectSystem=strict +ProtectHome=yes +ReadOnlyPaths=/var/lib/blind-uploader +ProtectClock=yes +ProtectKernelTunables=yes +ProtectKernelModules=yes +ProtectKernelLogs=yes +ProtectControlGroups=yes +RestrictSUIDSGID=yes +RestrictRealtime=yes +LockPersonality=yes +CapabilityBoundingSet= +AmbientCapabilities= +RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 -- cgit v1.2.3