diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2022-12-06 17:05:34 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2022-12-06 17:07:12 +0100 |
| commit | e45c83c3979c2554119fafdee7bb204d27e138b5 (patch) | |
| tree | 166651e1dc54f0f3bee9fddbb57eb8c8eef9488a | |
| parent | fe563a87ad7c171448c56ed6b628c8e32a52c94a (diff) | |
services: fail2ban: 'stop' returns #f when the dameon is stopped.
* gnu/services/security.scm (fail2ban-shepherd-service): Change
FAIL2BAN-ACTION to return an 'invoke' gexp.
Adjust the shepherd 'start' and 'stop' fields accordingly. Have 'stop'
return #f on success.
| -rw-r--r-- | gnu/services/security.scm | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/gnu/services/security.scm b/gnu/services/security.scm index 15fae7a6287..2d048ab47b0 100644 --- a/gnu/services/security.scm +++ b/gnu/services/security.scm | |||
| @@ -356,13 +356,12 @@ provided as a list of file-like objects.")) | |||
| 356 | (config-dir (file-append (config->fail2ban-etc-directory config) | 356 | (config-dir (file-append (config->fail2ban-etc-directory config) |
| 357 | "/etc/fail2ban")) | 357 | "/etc/fail2ban")) |
| 358 | (fail2ban-action (lambda args | 358 | (fail2ban-action (lambda args |
| 359 | #~(lambda _ | 359 | #~(invoke #$fail2ban-server |
| 360 | (invoke #$fail2ban-server | 360 | "-c" #$config-dir |
| 361 | "-c" #$config-dir | 361 | "-p" #$pid-file |
| 362 | "-p" #$pid-file | 362 | "-s" #$socket-file |
| 363 | "-s" #$socket-file | 363 | "-b" |
| 364 | "-b" | 364 | #$@args)))) |
| 365 | #$@args))))) | ||
| 366 | 365 | ||
| 367 | ;; TODO: Add 'reload' action. | 366 | ;; TODO: Add 'reload' action. |
| 368 | (list (shepherd-service | 367 | (list (shepherd-service |
| @@ -371,8 +370,11 @@ provided as a list of file-like objects.")) | |||
| 371 | (requirement '(user-processes)) | 370 | (requirement '(user-processes)) |
| 372 | (modules `((ice-9 match) | 371 | (modules `((ice-9 match) |
| 373 | ,@%default-modules)) | 372 | ,@%default-modules)) |
| 374 | (start (fail2ban-action "start")) | 373 | (start #~(lambda () |
| 375 | (stop (fail2ban-action "stop"))))))) | 374 | #$(fail2ban-action "start"))) |
| 375 | (stop #~(lambda (_) | ||
| 376 | #$(fail2ban-action "stop") | ||
| 377 | #f))))))) ;successfully stopped | ||
| 376 | 378 | ||
| 377 | (define fail2ban-service-type | 379 | (define fail2ban-service-type |
| 378 | (service-type (name 'fail2ban) | 380 | (service-type (name 'fail2ban) |
