+ (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))