Package: molly-guard
Severity: wishlist
Tag: patch

Hi,

unfortunately molly-guard doesn't by default allow using conf.d configuration files, so using a configuration management system (like ansible) needs to handle /etc/molly-guard/rc more complicated than it needs to be.

The attach fixes this by also supporting /etc/molly-guard/rc.d/*

I've also opened a merge request on salsa:
https://salsa.debian.org/debian/molly-guard/-/merge_requests/7

It would be nice if you could merge it.

Regards,
Daniel
From 7970e1061ac5797ddf034cb9700c82d5a279cda9 Mon Sep 17 00:00:00 2001
From: Daniel Baumann <[email protected]>
Date: Fri, 13 Nov 2026 17:07:06 +0100
Subject: [PATCH] Adding support for /etc/molly-guard/rc.d/* to ease
 configuration management.

Signed-off-by: Daniel Baumann <[email protected]>
---
 molly-guard.xml | 5 +++--
 shutdown.in     | 5 ++++-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/molly-guard.xml b/molly-guard.xml
index 9c01f2f..84df5ff 100644
--- a/molly-guard.xml
+++ b/molly-guard.xml
@@ -224,8 +224,9 @@ and docbook-xsl in your Build-Depends control field.
     <para> You can pass the <option>--pretend-ssh</option> script option to
       &dhcommand; to pretend that those tests succeeds. Alternatively, setting
       <envar>ALWAYS_QUERY_HOSTNAME</envar> in
-      <filename>/etc/molly-guard/rc</filename> causes the script to
-      always query.</para>
+      <filename>/etc/molly-guard/rc</filename> (or
+      <filename>/etc/molly-guard/rc.d/*</filename>)
+      causes the script to always query.</para>
 
     <para> The following situations are still UNGUARDED. If you can think of
       ways to protect against those, please let me know!</para>
diff --git a/shutdown.in b/shutdown.in
index 3216933..f39d558 100755
--- a/shutdown.in
+++ b/shutdown.in
@@ -129,7 +129,10 @@ esac
 # interactive shell.
 CONFIGURATION_MANAGEMENT=0
 
-[ -f "$MOLLYGUARD_SETTINGS" ] && . "$MOLLYGUARD_SETTINGS"
+for file in "$MOLLYGUARD_SETTINGS" "$MOLLYGUARD_SETTINGS".d/*
+do
+	[ -f "$file" ] && . "$file"
+done
 
 # Ansible uses an interactive shell, but by default puts Ansible in the
 # broadcast message, we can look for that. Allow for it be changed per site.
-- 
2.55.0

Reply via email to