commit 9e36155c5f56c8895ca3da0d776c37d02ffa1938
parent 2dbf82c73bd5f7644d06f7ddc1b24941dfa6d44b
Author: Florian Dold <dold@taler.net>
Date: Tue, 8 Sep 2026 00:46:10 +0200
services: apply DD102 restart and socket policy
Diffstat:
11 files changed, 56 insertions(+), 46 deletions(-)
diff --git a/debian/donau.donau-httpd.service b/debian/donau.donau-httpd.service
@@ -1,25 +1,21 @@
[Unit]
+StartLimitIntervalSec=0
Description=GNU Taler payment system donau REST API
AssertPathExists=/run/donau/httpd
-Requires=donau-httpd.socket donau-secmod-cs.service donau-secmod-rsa.service donau-secmod-eddsa.service
-After=postgres.service network.target donau-secmod-cs.service donau-secmod-rsa.service donau-secmod-eddsa.service
+Requires=donau-httpd.socket
+After=postgresql.service network.target donau-secmod-cs.service donau-secmod-rsa.service donau-secmod-eddsa.service
PartOf=donau.target
[Service]
+# DD102: retry transient failures without a start-rate limit.
+Restart=always
+RestartSec=10s
+RestartMode=direct
+RestartPreventExitStatus=6 9
User=donau-httpd
Type=simple
-# Depending on the configuration, the service process kills itself and then
-# needs to be restarted. Thus no significant delay on restarts.
-Restart=always
-RestartSec=1ms
-# 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 donau code assumes StartLimitInterval
-# to be >=5s.
-StartLimitBurst=5
-StartLimitInterval=5s
ExecStart=/usr/bin/donau-httpd -c /etc/donau/donau.conf
StandardOutput=journal
diff --git a/debian/donau.donau-httpd.socket b/debian/donau.donau-httpd.socket
@@ -1,4 +1,5 @@
[Unit]
+BindsTo=donau-httpd.service
Description=Taler Donau Socket
[Socket]
diff --git a/debian/donau.donau-secmod-cs.service b/debian/donau.donau-secmod-cs.service
@@ -1,13 +1,16 @@
[Unit]
+StartLimitIntervalSec=0
Description=GNU Taler payment system donau CS security module
AssertPathExists=/run/donau/secmod-cs
PartOf=donau.target
[Service]
+# DD102: retry transient failures without a start-rate limit.
+Restart=always
+RestartSec=10s
+RestartPreventExitStatus=6 9
User=donau-secmod-cs
Type=simple
-Restart=always
-RestartSec=100ms
ExecStart=/usr/bin/donau-secmod-cs -c /etc/donau/donau.conf
StandardOutput=journal
StandardError=journal
diff --git a/debian/donau.donau-secmod-eddsa.service b/debian/donau.donau-secmod-eddsa.service
@@ -1,13 +1,16 @@
[Unit]
+StartLimitIntervalSec=0
Description=GNU Taler payment system donau EdDSA security module
AssertPathExists=/run/donau/secmod-eddsa
PartOf=donau.target
[Service]
+# DD102: retry transient failures without a start-rate limit.
+Restart=always
+RestartSec=10s
+RestartPreventExitStatus=6 9
User=donau-secmod-eddsa
Type=simple
-Restart=always
-RestartSec=100ms
ExecStart=/usr/bin/donau-secmod-eddsa -c /etc/donau/donau.conf
StandardOutput=journal
StandardError=journal
diff --git a/debian/donau.donau-secmod-rsa.service b/debian/donau.donau-secmod-rsa.service
@@ -1,13 +1,16 @@
[Unit]
+StartLimitIntervalSec=0
Description=GNU Taler payment system donau RSA security module
AssertPathExists=/run/donau/secmod-rsa
PartOf=donau.target
[Service]
+# DD102: retry transient failures without a start-rate limit.
+Restart=always
+RestartSec=10s
+RestartPreventExitStatus=6 9
User=donau-secmod-rsa
Type=simple
-Restart=always
-RestartSec=100ms
ExecStart=/usr/bin/donau-secmod-rsa -c /etc/donau/donau.conf
StandardOutput=journal
StandardError=journal
diff --git a/debian/donau.donau.target b/debian/donau.donau.target
@@ -1,6 +1,10 @@
[Unit]
+Wants=donau-secmod-cs.service
+Wants=donau-secmod-rsa.service
+Wants=donau-secmod-eddsa.service
+Wants=postgresql.service
Description=GNU Taler donau
-After=postgres.service network.target
+After=postgresql.service network.target
Wants=donau-httpd.service
diff --git a/debian/rules b/debian/rules
@@ -29,7 +29,7 @@ override_dh_installsystemd:
dh_installsystemd -pdonau --name=donau-secmod-eddsa --no-start --no-enable --no-stop-on-upgrade
dh_installsystemd -pdonau --name=donau-secmod-rsa --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/donau/donau-httpd.c b/src/donau/donau-httpd.c
@@ -803,9 +803,10 @@ handle_mhd_request (void *cls,
* Load configuration parameters for the donau
* server into the corresponding global variables.
*
- * @return #GNUNET_OK on success
+ * @return EXIT_SUCCESS on success, EXIT_NOTCONFIGURED for invalid settings,
+ * EXIT_FAILURE for an unavailable dependency
*/
-static enum GNUNET_GenericReturnValue
+static int
donau_serve_process_config (void)
{
if (GNUNET_OK !=
@@ -825,7 +826,7 @@ donau_serve_process_config (void)
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
"donau",
"CURRENCY");
- return GNUNET_SYSERR;
+ return EXIT_NOTCONFIGURED;
}
if (GNUNET_OK !=
@@ -837,7 +838,7 @@ donau_serve_process_config (void)
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
"donau",
"LEGAL_DOMAIN");
- return GNUNET_SYSERR;
+ return EXIT_NOTCONFIGURED;
}
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_string (DH_cfg,
@@ -858,7 +859,7 @@ donau_serve_process_config (void)
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
"donau",
"BASE_URL");
- return GNUNET_SYSERR;
+ return EXIT_NOTCONFIGURED;
}
if (! TALER_url_valid_charset (DH_base_url))
{
@@ -866,7 +867,7 @@ donau_serve_process_config (void)
"donau",
"BASE_URL",
"invalid URL");
- return GNUNET_SYSERR;
+ return EXIT_NOTCONFIGURED;
}
for (unsigned int i = 0; i<MAX_DB_RETRIES; i++)
@@ -883,10 +884,10 @@ donau_serve_process_config (void)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to initialize DB subsystem. Giving up.\n");
- return GNUNET_SYSERR;
+ return EXIT_FAILURE;
}
- return GNUNET_OK;
+ return EXIT_SUCCESS;
}
@@ -1038,10 +1039,9 @@ run (void *cls,
GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
NULL);
- if (GNUNET_OK !=
- donau_serve_process_config ())
+ if (EXIT_SUCCESS !=
+ (DH_global_ret = donau_serve_process_config ()))
{
- DH_global_ret = EXIT_NOTCONFIGURED;
GNUNET_SCHEDULER_shutdown ();
return;
}
@@ -1049,7 +1049,7 @@ run (void *cls,
if (GNUNET_OK !=
DH_keys_init ())
{
- DH_global_ret = EXIT_FAILURE;
+ DH_global_ret = EXIT_NOTCONFIGURED;
GNUNET_SCHEDULER_shutdown ();
return;
}
@@ -1090,7 +1090,7 @@ run (void *cls,
case GNUNET_NO:
if (! have_daemons)
{
- DH_global_ret = EXIT_NOTCONFIGURED;
+ DH_global_ret = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown ();
return;
}
@@ -1146,7 +1146,7 @@ main (int argc,
options,
&run, NULL);
if (GNUNET_SYSERR == ret)
- return EXIT_INVALIDARGUMENT;
+ return EXIT_NOTCONFIGURED;
if (GNUNET_NO == ret)
return EXIT_SUCCESS;
return DH_global_ret;
diff --git a/src/util/donau-secmod-cs.c b/src/util/donau-secmod-cs.c
@@ -37,12 +37,12 @@
#include "donau_util.h"
/* LSB-style exit status codes */
-#ifndef EXIT_INVALIDARGUMENT
+#ifndef EXIT_NOTCONFIGURED
/**
- * Command-line arguments are invalid.
+ * Configuration or command-line arguments are invalid.
* Restarting useless.
*/
-#define EXIT_INVALIDARGUMENT 2
+#define EXIT_NOTCONFIGURED 6
#endif
#ifndef EXIT_NOTCONFIGURED
@@ -235,6 +235,6 @@ main (int argc,
if (GNUNET_NO == ret)
return EXIT_SUCCESS;
if (GNUNET_SYSERR == ret)
- return EXIT_INVALIDARGUMENT;
+ return EXIT_NOTCONFIGURED;
return opts.global_ret;
}
diff --git a/src/util/donau-secmod-eddsa.c b/src/util/donau-secmod-eddsa.c
@@ -38,12 +38,12 @@
#include "donau_util.h"
/* LSB-style exit status codes */
-#ifndef EXIT_INVALIDARGUMENT
+#ifndef EXIT_NOTCONFIGURED
/**
- * Command-line arguments are invalid.
+ * Configuration or command-line arguments are invalid.
* Restarting useless.
*/
-#define EXIT_INVALIDARGUMENT 2
+#define EXIT_NOTCONFIGURED 6
#endif
/**
@@ -82,6 +82,6 @@ main (int argc,
if (GNUNET_NO == ret)
return EXIT_SUCCESS;
if (GNUNET_SYSERR == ret)
- return EXIT_INVALIDARGUMENT;
+ return EXIT_NOTCONFIGURED;
return opts.global_ret;
}
diff --git a/src/util/donau-secmod-rsa.c b/src/util/donau-secmod-rsa.c
@@ -37,12 +37,12 @@
#include "donau_util.h"
/* LSB-style exit status codes */
-#ifndef EXIT_INVALIDARGUMENT
+#ifndef EXIT_NOTCONFIGURED
/**
- * Command-line arguments are invalid.
+ * Configuration or command-line arguments are invalid.
* Restarting useless.
*/
-#define EXIT_INVALIDARGUMENT 2
+#define EXIT_NOTCONFIGURED 6
#endif
#ifndef EXIT_NOTCONFIGURED
@@ -235,6 +235,6 @@ main (int argc,
if (GNUNET_NO == ret)
return EXIT_SUCCESS;
if (GNUNET_SYSERR == ret)
- return EXIT_INVALIDARGUMENT;
+ return EXIT_NOTCONFIGURED;
return opts.global_ret;
}