anastasis

Credential backup and recovery protocol and service
Log | Files | Refs | Submodules | README | LICENSE

commit d7273ff70ad72f47b7e0c925a52be3ecb48f23dd
parent 882c069cec34d5f952faebf1e4f50c9f66244609
Author: Florian Dold <dold@taler.net>
Date:   Tue,  8 Sep 2026 00:46:10 +0200

services: apply DD102 restart and socket policy

Diffstat:
Adebian/anastasis-httpd.anastasis.target | 7+++++++
Mdebian/anastasis-httpd.prerm | 2++
Mdebian/anastasis-httpd.service | 16++++++----------
Mdebian/anastasis-httpd.socket | 1+
Mdebian/rules | 5+++--
Msrc/backend/anastasis-httpd.c | 9+++++----
6 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/debian/anastasis-httpd.anastasis.target b/debian/anastasis-httpd.anastasis.target @@ -0,0 +1,7 @@ +[Unit] +Description=Anastasis services +Wants=postgresql.service anastasis-httpd.service +After=postgresql.service network.target + +[Install] +WantedBy=multi-user.target diff --git a/debian/anastasis-httpd.prerm b/debian/anastasis-httpd.prerm @@ -6,4 +6,6 @@ if [ -d /run/systemd/system ] && [ "$1" = remove ]; then deb-systemd-invoke stop 'anastasis-httpd.service' >/dev/null || true fi +#DEBHELPER# + exit 0 diff --git a/debian/anastasis-httpd.service b/debian/anastasis-httpd.service @@ -1,27 +1,23 @@ [Unit] +PartOf=anastasis.target +StartLimitIntervalSec=0 Description=Anastasis key recovery backend After=postgresql.service network.target Requires=anastasis-httpd.socket [Service] +# DD102: retry transient failures without a start-rate limit. +Restart=always +RestartSec=10s User=anastasis-httpd Type=simple -Restart=always RestartMode=direct -RestartSec=1s -RestartPreventExitStatus=9 +RestartPreventExitStatus=6 9 -# Disable the service if more than 5 restarts are encountered within 5s. -# These are usually the systemd defaults, but can be overwritten, thus we set -# them here explicitly, as the exchange code assumes StartLimitInterval -# to be >=5s. -StartLimitBurst=5 -StartLimitInterval=5s ExecStart=/usr/bin/anastasis-httpd -c /etc/anastasis/anastasis.conf -L INFO EnvironmentFile=/etc/anastasis/anastasis.env -RuntimeMaxSec=3600s StandardOutput=journal StandardError=journal PrivateTmp=yes diff --git a/debian/anastasis-httpd.socket b/debian/anastasis-httpd.socket @@ -1,4 +1,5 @@ [Unit] +BindsTo=anastasis-httpd.service Description=Anastasis Socket [Socket] diff --git a/debian/rules b/debian/rules @@ -25,9 +25,10 @@ override_dh_auto_clean: dh_auto_clean override_dh_installsystemd: - dh_installsystemd -panastasis-httpd --name=anastasis-httpd --no-start --no-enable + dh_installsystemd -panastasis-httpd --name=anastasis --no-start --no-enable --no-stop-on-upgrade + dh_installsystemd -panastasis-httpd --name=anastasis-httpd --no-start --no-enable --no-stop-on-upgrade # final invocation to generate daemon reload - dh_installsystemd + dh_installsystemd --no-start --no-enable --no-stop-on-upgrade override_dh_install: dh_install diff --git a/src/backend/anastasis-httpd.c b/src/backend/anastasis-httpd.c @@ -1019,7 +1019,7 @@ run (void *cls, AH_load_terms (config); TALER_MHD_setup (go); AH_cfg = config; - global_result = EXIT_NO_RESTART; + global_result = EXIT_NOTCONFIGURED; GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL); if (GNUNET_OK != @@ -1185,7 +1185,8 @@ run (void *cls, ANASTASIS_DB_init (config)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Database not setup. Did you run anastasis-dbinit?\n"); + "Failed to initialize database; check connectivity and anastasis-dbinit.\n"); + global_result = EXIT_FAILURE; GNUNET_SCHEDULER_shutdown (); return; } @@ -1206,7 +1207,7 @@ run (void *cls, case GNUNET_NO: if (! have_daemons) { - global_result = EXIT_NOTCONFIGURED; + global_result = EXIT_FAILURE; GNUNET_SCHEDULER_shutdown (); return; } @@ -1272,7 +1273,7 @@ main (int argc, "Anastasis HTTP interface", options, &run, NULL); if (GNUNET_SYSERR == res) - return 3; + return EXIT_NOTCONFIGURED; if (GNUNET_NO == res) return 0; return global_result;