Subject: [PATCH v3] gnu: sshguard: Fix sshguard.

From: Ashish SHUKLA <[email-masked]>
Date: Wed, 30 Apr 2025 23:42:28 +0200

Patch sshguard to accept configuration file from an environment variable.

* gnu/packages/admin.scm (sshguard)[arguments]: Add phases.

Change-Id: Ifd1cee18787b2623e5c32801e20e5837ce94c88c
---
Hi Artyom,

Thanks for updating it to 2.5.1.

Running it atm yields:

=============================================================================
% /gnu/store/xna4knzy4a4qw0hfna292p89ybvzbrxy-sshguard-2.5.1/sbin/sshguard
sshguard: Could not read '/gnu/store/xna4knzy4a4qw0hfna292p89ybvzbrxy-sshguard-2.5.1/etc/sshguard.conf'
sshguard: Please configure SSHGuard.
=============================================================================

AFAICT, it's fairly useless as the check can not be bypassed. If you're running it in a different way, please share.

I've a patch that I'm using it while waiting for this patch to be committed. I've rebased it on top of your commit.

Thanks!
Ashish

 gnu/packages/admin.scm | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index 160c8a562d..9530c2253b 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -72,7 +72,7 @@
 ;;; Copyright © 2024 nathan <[email-masked]>
 ;;; Copyright © 2024 Nikita Domnitskii <[email-masked]>
 ;;; Copyright © 2024 Roman Scherer <[email-masked]>
-;;; Copyright © 2024 Ashish SHUKLA <[email-masked]>
+;;; Copyright © 2024, 2025 Ashish SHUKLA <[email-masked]>
 ;;; Copyright © 2024 Ashvith Shetty <[email-masked]>
 ;;; Copyright © 2025 Dariqq <[email-masked]>
 ;;; Copyright © 2024 nik gaffney <[email-masked]>
@@ -6781,6 +6781,16 @@ (define-public sshguard
     (build-system gnu-build-system)
     (native-inputs
      (list autoconf automake bison flex python-docutils))
+    (arguments
+     (list #:phases
+           #~(modify-phases %standard-phases
+               ;; patch sshguard to find configuration through
+               ;; environment variable
+               (add-after 'unpack 'patch-sshguard
+                 (lambda _
+                   (substitute* "src/sshguard.in"
+                     (("^config=.*$")
+                      "config=${SSHGUARD_CONFIG_FILE:-@sysconfdir@/sshguard.conf}\n")))))))
     (home-page "https://sshguard.net/")
     (synopsis "Daemon to blocks SSH brute-force attacks")
     (description

base-commit: 5bf15734c869ecb9103832cae56198eb8a9adf89
-- 
2.49.0