# Read the bank and hand the incoming credits to the server. # # A USER unit, on the machine where nostrod holds the bank connection, NOT on # the web host. The web host holds no key to the bank, and should not: a key # that can read the account can as a rule also pay from it. So the server only # ever reads a file. # # This unit holds no key either. tools/pull-and-ship-credits.sh asks nostrod # (https://forgejo.catcrafts.net/Catcrafts/Nostro) over the system bus, and # nostrod lets a program look at the accounts without ever handing it the key. # # Install: # mkdir -p ~/.config/systemd/user # cp deploy/catcrafts-credits.{service,timer} ~/.config/systemd/user/ # systemctl --user daemon-reload # systemctl --user enable --now catcrafts-credits.timer # # WHO MAY LOOK. As nostrod ships, a program may look without a password only # while you are logged in at this machine (an active local session, which a # user unit counts as part of). So as installed above, this pulls while you are # logged in and is refused otherwise: with nobody logged in, or on a machine # you only reach over SSH. To have it run regardless, add the polkit rule in # deploy/README.md ("Who may look"), and then, so the unit runs with nobody # logged in at all: # loginctl enable-linger "$USER" # Lingering without the rule only produces a refused pull every hour. # # Watch: journalctl --user -u catcrafts-credits -f [Unit] Description=Pull bank credits from nostrod and ship them to catcrafts.net Documentation=file:deploy/README.md # Pointless without a route to the bank or to the server. After=network-online.target [Service] Type=oneshot WorkingDirectory=%h/repos/catcrafts.net ExecStart=%h/repos/catcrafts.net/tools/pull-and-ship-credits.sh # A failed pull must not look like a successful one. The script ships nothing # when it could not read the account, and never overwrites the remote with an # empty file, so a failure here leaves the server settling from the last good # copy rather than from nothing. SuccessExitStatus=0