From: muradm <mail@muradm.net>
To: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Cc: 56608@debbugs.gnu.org
Subject: [bug#56608] [PATCH v2 2/2] gnu: tests: Add fail2ban tests.
Date: Tue, 23 Aug 2022 23:19:34 +0300 [thread overview]
Message-ID: <87mtbuyaht.fsf@muradm.net> (raw)
In-Reply-To: <87r116ybj4.fsf@muradm.net>
[-- Attachment #1: Type: text/plain, Size: 2081 bytes --]
muradm <mail@muradm.net> writes:
[...]
>>> + (test-equal "fail2ban sshd jail running"
>>> + '("Status for the jail: sshd"
>>> + "|- Filter"
>>> + "| |- Currently failed:\t0"
>>> + "| |- Total failed:\t0"
>>> + "| `- File list:\t/var/log/secure"
>>> + "`- Actions"
>>> + " |- Currently banned:\t0"
>>> + " |- Total banned:\t0"
>>> + " `- Banned IP list:\t"
>>> + "")
>>> + (marionette-eval
>>> + '(begin
>>> + (use-modules (ice-9 rdelim) (ice-9 popen)
>>> (rnrs io
>>> ports))
>>> + (let ((call-command
>>> + (lambda (cmd)
>>> + (let* ((err-cons (pipe))
>>> + (port (with-error-to-port
>>> (cdr
>>> err-cons)
>>> + (lambda ()
>>> (open-input-pipe cmd))))
>>> + (_ (setvbuf (car err-cons)
>>> 'block
>>> + (* 1024 1024
>>> 16)))
>>> + (result (read-delimited ""
>>> port)))
>>> + (close-port (cdr err-cons))
>>> + (values result (read-delimited ""
>>> (car
>>> err-cons)))))))
>>> + (string-split
>>> + (call-command
>>> + (string-join (list #$%fail2ban-server-cmd
>>> "status" "sshd") " "))
>>> + #\newline)))
>>> + marionette))
>>
>> Perhaps this could be turned into an Shepherd action, and the
>> Guile
>> procedure could do the above to return the text output; to
>> simplify
>> the
>> test and reduce boilerplate, while providing value to the user.
>>
Here I use a cli of fail2ban. It's arguments are very extended.
I'm not sure how it should be implemented in terms of
shepherd-action. I will continue thinking about it, but I
would prefer to skip this for now, if you don't mind.
thanks in advance,
muradm
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
prev parent reply other threads:[~2022-08-23 20:25 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-17 2:32 [bug#56608] [PATCH] gnu: security: Add fail2ban-service-type muradm
2022-08-03 16:09 ` Maxim Cournoyer
2022-08-22 17:26 ` [bug#56608] [PATCH v2 0/2] " muradm
2022-08-22 17:26 ` [bug#56608] [PATCH v2 1/2] gnu: security: " muradm
2022-08-22 18:53 ` Maxim Cournoyer
2022-08-23 18:22 ` muradm
2022-08-22 17:26 ` [bug#56608] [PATCH v2 2/2] gnu: tests: Add fail2ban tests muradm
2022-08-22 19:13 ` Maxim Cournoyer
2022-08-23 18:51 ` muradm
2022-08-23 20:13 ` [bug#56608] [PATCH v3] gnu: security: Add fail2ban-service-type muradm
2022-08-29 2:01 ` bug#56608: " Maxim Cournoyer
2022-08-23 20:19 ` muradm [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87mtbuyaht.fsf@muradm.net \
--to=mail@muradm.net \
--cc=56608@debbugs.gnu.org \
--cc=maxim.cournoyer@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.