aienos.com
Source of www.aienos.com, served from my own hardware
Brought by drakestapleton
aienos.com / scripts / allen / relay / start
| 1 | #!/bin/sh |
| 2 | # Root-run starter for allen-relay-mailer until aien-supervise owns it (no systemd unit, by Drake's order). |
| 3 | # The mailer runs as allen-relay with no_new_privs and no capabilities. The Gandi password for |
| 4 | # aien@aienos.com goes from the TPM-bound atlas vault straight into the mailer's stdin: never on |
| 5 | # disk, in argv or in the environment. nft (table inet atlas_ingress, chain output) lets the |
| 6 | # allen-relay user reach only DNS on loopback and TCP 465. |
| 7 | set -eu |
| 8 | if pgrep -u allen-relay -f /opt/allen-relay/allen_relay_mailer.py >/dev/null; then |
| 9 | echo "allen-relay-mailer: already running" >&2 |
| 10 | exit 1 |
| 11 | fi |
| 12 | umask 027 |
| 13 | # The vault owner's home, from the passwd database (this script runs as root). |
| 14 | VAULT_HOME=$(getent passwd drakestapleton | cut -d: -f6) |
| 15 | [ -n "$VAULT_HOME" ] || { echo "allen-relay-mailer: no home for drakestapleton" >&2; exit 1; } |
| 16 | ( |
| 17 | runuser -u drakestapleton -- env -i HOME="$VAULT_HOME" PATH=/usr/bin:/bin \ |
| 18 | "$VAULT_HOME/.local/bin/atlas-vault" get GANDI_AIEN_MAIL_PASSWORD 2>/dev/null | |
| 19 | setsid setpriv --reuid=allen-relay --regid=allen-relay --init-groups \ |
| 20 | --no-new-privs --inh-caps=-all --bounding-set=-all \ |
| 21 | env -i HOME=/var/lib/allen-relay PATH=/usr/bin:/bin LANG=C.UTF-8 \ |
| 22 | /usr/bin/python3 -I /opt/allen-relay/allen_relay_mailer.py >>/var/log/allen-relay.log 2>&1 |
| 23 | ) </dev/null >/dev/null 2>&1 & |