mirror of
https://https.git.savannah.gnu.org/git/guix.git/
synced 2025-07-17 12:30:38 +02:00
gnu: fail2ban: Improve style.
* gnu/packages/admin.scm (fail2ban): Use gexps and run guix style. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
parent
6567fd4072
commit
30f240b034
1 changed files with 164 additions and 174 deletions
|
@ -6173,37 +6173,35 @@ alias cysdig=sudo csysdig --modern-bpf
|
||||||
(package
|
(package
|
||||||
(name "fail2ban")
|
(name "fail2ban")
|
||||||
(version "1.1.0")
|
(version "1.1.0")
|
||||||
(source (origin
|
(source
|
||||||
|
(origin
|
||||||
(method git-fetch)
|
(method git-fetch)
|
||||||
(uri (git-reference
|
(uri (git-reference
|
||||||
(url "https://github.com/fail2ban/fail2ban")
|
(url "https://github.com/fail2ban/fail2ban")
|
||||||
(commit version)))
|
(commit version)))
|
||||||
(file-name (git-file-name name version))
|
(file-name (git-file-name name version))
|
||||||
(sha256
|
(sha256
|
||||||
(base32
|
(base32 "0lfakna6ad2xwz95sjxzkavipcsxiy7ybavkdkf9zzmspf2ws4yk"))
|
||||||
"0lfakna6ad2xwz95sjxzkavipcsxiy7ybavkdkf9zzmspf2ws4yk"))
|
|
||||||
(modules '((guix build utils)))
|
(modules '((guix build utils)))
|
||||||
(snippet
|
(snippet #~(begin
|
||||||
'(begin
|
|
||||||
;; Replacing those by our own paths-guix.conf
|
;; Replacing those by our own paths-guix.conf
|
||||||
(with-directory-excursion "config"
|
(with-directory-excursion "config"
|
||||||
(for-each delete-file
|
(for-each delete-file
|
||||||
'("paths-arch.conf"
|
'("paths-arch.conf" "paths-debian.conf"
|
||||||
"paths-debian.conf"
|
"paths-fedora.conf" "paths-freebsd.conf"
|
||||||
"paths-fedora.conf"
|
"paths-opensuse.conf" "paths-osx.conf")))))
|
||||||
"paths-freebsd.conf"
|
|
||||||
"paths-opensuse.conf"
|
|
||||||
"paths-osx.conf")))))
|
|
||||||
(patches (search-patches "fail2ban-paths-guix-conf.patch"))))
|
(patches (search-patches "fail2ban-paths-guix-conf.patch"))))
|
||||||
(build-system pyproject-build-system)
|
(build-system pyproject-build-system)
|
||||||
(arguments
|
(arguments
|
||||||
'(#:phases (modify-phases %standard-phases
|
(list
|
||||||
|
#:phases
|
||||||
|
#~(modify-phases %standard-phases
|
||||||
(add-after 'unpack 'avoid-external-binary-in-/bin
|
(add-after 'unpack 'avoid-external-binary-in-/bin
|
||||||
(lambda _
|
(lambda _
|
||||||
(delete-file "fail2ban/setup.py")
|
(delete-file "fail2ban/setup.py")
|
||||||
(substitute* '("bin/fail2ban-testcases"
|
(substitute* '("bin/fail2ban-testcases" "setup.py")
|
||||||
"setup.py")
|
((".*updatePyExec.*")
|
||||||
((".*updatePyExec.*") ""))))
|
""))))
|
||||||
(add-after 'unpack 'patch-setup.py
|
(add-after 'unpack 'patch-setup.py
|
||||||
(lambda _
|
(lambda _
|
||||||
;; Get rid of absolute file names.
|
;; Get rid of absolute file names.
|
||||||
|
@ -6246,16 +6244,14 @@ alias cysdig=sudo csysdig --modern-bpf
|
||||||
"fail2ban/client/fail2bancmdline.py"
|
"fail2ban/client/fail2bancmdline.py"
|
||||||
"fail2ban/client/fail2banregex.py")
|
"fail2ban/client/fail2banregex.py")
|
||||||
(("/etc/fail2ban")
|
(("/etc/fail2ban")
|
||||||
(string-append (assoc-ref outputs "out")
|
(string-append (assoc-ref outputs "out") "/etc/fail2ban")))))
|
||||||
"/etc/fail2ban")))))
|
|
||||||
(add-after 'fix-default-config 'set-action-dependencies
|
(add-after 'fix-default-config 'set-action-dependencies
|
||||||
(lambda* (#:key inputs #:allow-other-keys)
|
(lambda* (#:key inputs #:allow-other-keys)
|
||||||
;; deleting things that are not feasible to fix
|
;; deleting things that are not feasible to fix
|
||||||
;; or won't be used any way
|
;; or won't be used any way
|
||||||
(with-directory-excursion "config/action.d"
|
(with-directory-excursion "config/action.d"
|
||||||
(for-each delete-file
|
(for-each delete-file
|
||||||
'("apf.conf"
|
'("apf.conf" "bsd-ipfw.conf"
|
||||||
"bsd-ipfw.conf"
|
|
||||||
"dshield.conf"
|
"dshield.conf"
|
||||||
"ipfilter.conf"
|
"ipfilter.conf"
|
||||||
"ipfw.conf"
|
"ipfw.conf"
|
||||||
|
@ -6286,11 +6282,9 @@ alias cysdig=sudo csysdig --modern-bpf
|
||||||
;; TODO: deal with geoiplookup ..
|
;; TODO: deal with geoiplookup ..
|
||||||
(("(awk|curl|dig|jq)" all cmd)
|
(("(awk|curl|dig|jq)" all cmd)
|
||||||
(bin cmd))
|
(bin cmd))
|
||||||
(("(cat|echo|grep|head|printf|wc) " all
|
(("(cat|echo|grep|head|printf|wc) " all cmd)
|
||||||
cmd)
|
|
||||||
(string-append (bin cmd) " "))
|
(string-append (bin cmd) " "))
|
||||||
((" (date|rm|sed|tail|touch|tr) " all
|
((" (date|rm|sed|tail|touch|tr) " all cmd)
|
||||||
cmd)
|
|
||||||
(string-append " "
|
(string-append " "
|
||||||
(bin cmd) " "))
|
(bin cmd) " "))
|
||||||
(("cut -d")
|
(("cut -d")
|
||||||
|
@ -6313,7 +6307,8 @@ alias cysdig=sudo csysdig --modern-bpf
|
||||||
(("mail -E")
|
(("mail -E")
|
||||||
(string-append sendmail " -E"))
|
(string-append sendmail " -E"))
|
||||||
(("nftables = nft")
|
(("nftables = nft")
|
||||||
(string-append "nftables = " (sbin "nft")))
|
(string-append "nftables = "
|
||||||
|
(sbin "nft")))
|
||||||
(("perl -e")
|
(("perl -e")
|
||||||
(string-append (bin "perl") " -e"))
|
(string-append (bin "perl") " -e"))
|
||||||
(("/usr/sbin/sendmail")
|
(("/usr/sbin/sendmail")
|
||||||
|
@ -6321,34 +6316,29 @@ alias cysdig=sudo csysdig --modern-bpf
|
||||||
(("test -e")
|
(("test -e")
|
||||||
(string-append (bin "test") " -e"))
|
(string-append (bin "test") " -e"))
|
||||||
(("_whois = whois")
|
(("_whois = whois")
|
||||||
(string-append "_whois = " (bin "whois")))))
|
(string-append "_whois = "
|
||||||
|
(bin "whois")))))
|
||||||
(substitute* "config/jail.conf"
|
(substitute* "config/jail.conf"
|
||||||
(("before = paths-debian\\.conf")
|
(("before = paths-debian\\.conf")
|
||||||
"before = paths-guix.conf"))))
|
"before = paths-guix.conf"))))
|
||||||
(add-after 'install 'copy-man-pages
|
(add-after 'install 'copy-man-pages
|
||||||
(lambda* (#:key outputs #:allow-other-keys)
|
(lambda* (#:key outputs #:allow-other-keys)
|
||||||
(let* ((man (string-append (assoc-ref outputs "out")
|
(let* ((man (string-append (assoc-ref outputs "out") "/man"))
|
||||||
"/man"))
|
|
||||||
(install-man (lambda (m)
|
(install-man (lambda (m)
|
||||||
(lambda (f)
|
(lambda (f)
|
||||||
(install-file (string-append f
|
(install-file (string-append f "." m)
|
||||||
"." m)
|
(string-append man "/man"
|
||||||
(string-append man
|
m)))))
|
||||||
"/man" m)))))
|
|
||||||
(install-man1 (install-man "1"))
|
(install-man1 (install-man "1"))
|
||||||
(install-man5 (install-man "5")))
|
(install-man5 (install-man "5")))
|
||||||
(with-directory-excursion "man"
|
(with-directory-excursion "man"
|
||||||
(for-each install-man1
|
(for-each install-man1
|
||||||
'("fail2ban"
|
'("fail2ban" "fail2ban-client" "fail2ban-python"
|
||||||
"fail2ban-client"
|
"fail2ban-regex" "fail2ban-server"
|
||||||
"fail2ban-python"
|
|
||||||
"fail2ban-regex"
|
|
||||||
"fail2ban-server"
|
|
||||||
"fail2ban-testcases"))
|
"fail2ban-testcases"))
|
||||||
(for-each install-man5
|
(for-each install-man5
|
||||||
'("jail.conf")))))))))
|
'("jail.conf")))))))))
|
||||||
(native-inputs
|
(native-inputs (list python-setuptools python-wheel))
|
||||||
(list python-setuptools python-wheel))
|
|
||||||
(inputs (list gawk
|
(inputs (list gawk
|
||||||
coreutils-minimal
|
coreutils-minimal
|
||||||
curl
|
curl
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue