aboutsummaryrefslogtreecommitdiff
path: root/deploy
diff options
context:
space:
mode:
Diffstat (limited to 'deploy')
-rw-r--r--deploy/blind-uploader-watcher.service39
-rw-r--r--deploy/blind-uploader-watcher.timer12
-rw-r--r--deploy/blind-uploader.service2
3 files changed, 52 insertions, 1 deletions
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
diff --git a/deploy/blind-uploader-watcher.timer b/deploy/blind-uploader-watcher.timer
new file mode 100644
index 0000000..d076334
--- /dev/null
+++ b/deploy/blind-uploader-watcher.timer
@@ -0,0 +1,12 @@
+[Unit]
+Description=Run the Private Drop upload notifier every 5 minutes
+
+[Timer]
+# Fixed wall-clock slots keep consecutive 5-minute scan windows aligned, so an
+# upload is reported once. Keep this in sync with SCAN_INTERVAL_SECONDS.
+OnCalendar=*:0/5
+AccuracySec=1s
+Persistent=false
+
+[Install]
+WantedBy=timers.target
diff --git a/deploy/blind-uploader.service b/deploy/blind-uploader.service
index 8bbba05..5c03feb 100644
--- a/deploy/blind-uploader.service
+++ b/deploy/blind-uploader.service
@@ -16,7 +16,7 @@ RestartSec=3s
Environment=HOST=127.0.0.1
Environment=PORT=8000
Environment=UPLOAD_DIR=/var/lib/blind-uploader/uploads
-Environment=TARGETS_FILE=/etc/blind-uploader/allowed-uris
+Environment=CONFIG_FILE=/etc/blind-uploader/config.toml
Environment=PYTHONDONTWRITEBYTECODE=1
EnvironmentFile=-/etc/default/blind-uploader