source: trunk/dports/security/fail2ban/Portfile

Last change on this file was 142815, checked in by jmr@…, 2 years ago

various ports: remove redundant clearing of python.link_binaries_suffix, the portgroup now handles this

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.6 KB
Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2# $Id: Portfile 142815 2015-11-24 03:22:35Z ryandesign@macports.org $
3
4PortSystem              1.0
5PortGroup               github 1.0
6PortGroup               python 1.0
7
8github.setup            fail2ban fail2ban 0.9.3
9categories              security python
10license                 GPL-2+
11maintainers             free.fr:fclaire openmaintainer
12platforms               darwin
13supported_archs         noarch
14
15description             Fail2ban protects computer against brute-force attacks
16
17long_description        Fail2ban scans log files (e.g. /var/log/apache/error_log) and \
18                        bans IPs that show the malicious signs -- too many password failures, \
19                        seeking for exploits, etc. Generally Fail2Ban then used to update \
20                        firewall rules to reject the IP addresses for a specified amount \
21                        of time, although any arbitrary other action (e.g. sending an email, \
22                        or ejecting CD-ROM tray) could also be configured. Out of the box \
23                        Fail2Ban comes with filters for various services (apache, curier, ssh, etc).
24
25homepage                http://www.fail2ban.org/
26
27distname                ${version}
28
29checksums               rmd160  1f1f1b7a504cbade13a3363cc9143d909168f062 \
30                        sha256  146811530b7acf706db6d28068ee60806f6e0c80da14d89b732955a696728c46
31
32python.default_version  27
33
34set f2bconfdir          ${prefix}/etc/${name}
35set f2bbindir           ${prefix}/bin
36set f2brundir           ${prefix}/var/run/${name}
37set f2bsock             ${f2brundir}/${name}.sock
38set f2bpid              ${f2brundir}/${name}.pid
39
40patchfiles              patch-setup.py.diff \
41                        patch-fail2ban-client-configreader.py.diff \
42                        patch-fail2ban-tests-misctestcase.py.diff \
43                        patch-fail2ban-tests-utils.py.diff \
44                        patch-config-fail2ban.conf.diff \
45                        patch-config-jail.conf.diff \
46                        patch-config-paths-common.conf.diff \
47                        patch-config-paths-osx.conf.diff \
48                        patch-config-action.d-osx-afctl.conf.diff \
49                        patch-bin-fail2ban-client.diff \
50                        patch-bin-fail2ban-server.diff \
51                        patch-fail2ban-server-filterpoll.py.diff
52
53post-patch   {
54    reinplace "s|@@PREFIX@@|${prefix}|g"    ${worksrcpath}/setup.py \
55                                            ${worksrcpath}/fail2ban/client/configreader.py \
56                                            ${worksrcpath}/fail2ban/tests/misctestcase.py \
57                                            ${worksrcpath}/fail2ban/tests/utils.py \
58                                            ${worksrcpath}/config/fail2ban.conf \
59                                            ${worksrcpath}/config/paths-common.conf \
60                                            ${worksrcpath}/bin/fail2ban-client \
61                                            ${worksrcpath}/bin/fail2ban-server
62}
63
64startupitem.create      yes
65startupitem.start       "export LANG=en_GB.UTF-8; if \[ -r ${f2bsock} -a ! -r ${f2bpid} \]; then rm ${f2bsock}; fi; ${f2bbindir}/${name}-client start"
66startupitem.stop        "${f2bbindir}/${name}-client stop"
67
68destroot.keepdirs       ${destroot}${f2brundir}
69
70post-destroot {
71    # Adding dedicated OSX pf-icefloor action file
72    xinstall -m 644 ${filespath}/pf-icefloor.conf ${destroot}${f2bconfdir}/action.d/
73    # Adding a suffix to config files
74    set cfgfiles [concat [glob ${destroot}${f2bconfdir}/*.conf] [glob ${destroot}${f2bconfdir}/action.d/*.conf] [glob ${destroot}${f2bconfdir}/filter.d/*.conf]]
75    foreach cfgfile ${cfgfiles} {
76        move ${cfgfile} ${cfgfile}.${version}
77    }
78}
79
80post-activate {
81    # If not already present we put default config files
82    set cfgfiles [concat [glob ${f2bconfdir}/*.conf.${version}] [glob ${f2bconfdir}/action.d/*.conf.${version}] [glob ${f2bconfdir}/filter.d/*.conf.${version}]]
83    foreach cfgfile ${cfgfiles} {
84        regsub "\.${version}" ${cfgfile} {} origcfgfile
85        if {![file exists ${origcfgfile}]} {
86            file copy ${cfgfile} ${origcfgfile}
87        }
88    }
89}
90
91notes "
92Next step is to configure fail2ban.
93Start to read:
94${f2bconfdir}/fail2ban.conf
95${f2bconfdir}/jail.conf
96and create your own fail2ban.local and jail.local
97
98Start/stop fail2ban with: sudo port \[un\]load fail2ban
99
100More info at ${homepage}
101"
102
103livecheck.type          regexm
104livecheck.url           ${homepage}wiki/index.php/Downloads
105livecheck.regex         <i>stable</i>.*?>${name}-(\[0-9.\]+)<
Note: See TracBrowser for help on using the repository browser.