Ticket #49026: Portfile

File Portfile, 4.6 KB (added by fclaire@…, 9 years ago)
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$
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
40python.link_binaries_suffix
41
42patchfiles              patch-setup.py.diff \
43                        patch-fail2ban-client-configreader.py.diff \
44                        patch-fail2ban-tests-misctestcase.py.diff \
45                        patch-fail2ban-tests-utils.py.diff \
46                        patch-config-fail2ban.conf.diff \
47                        patch-config-jail.conf.diff \
48                        patch-config-paths-common.conf.diff \
49                        patch-config-paths-osx.conf.diff \
50                        patch-config-action.d-osx-afctl.conf.diff \
51                        patch-bin-fail2ban-client.diff \
52                        patch-bin-fail2ban-server.diff \
53                        patch-fail2ban-server-filterpoll.py.diff
54
55post-patch   {
56    reinplace "s|@@PREFIX@@|${prefix}|g"    ${worksrcpath}/setup.py \
57                                            ${worksrcpath}/fail2ban/client/configreader.py \
58                                            ${worksrcpath}/fail2ban/tests/misctestcase.py \
59                                            ${worksrcpath}/fail2ban/tests/utils.py \
60                                            ${worksrcpath}/config/fail2ban.conf \
61                                            ${worksrcpath}/config/paths-common.conf \
62                                            ${worksrcpath}/bin/fail2ban-client \
63                                            ${worksrcpath}/bin/fail2ban-server
64}
65
66startupitem.create      yes
67startupitem.start       "export LANG=en_GB.UTF-8; if \[ -r ${f2bsock} -a ! -r ${f2bpid} \]; then rm ${f2bsock}; fi; ${f2bbindir}/${name}-client start"
68startupitem.stop        "${f2bbindir}/${name}-client stop"
69
70destroot.keepdirs       ${destroot}${f2brundir}
71
72post-destroot {
73    # Adding dedicated OSX pf-icefloor action file
74    xinstall -m 644 ${filespath}/pf-icefloor.conf ${destroot}${f2bconfdir}/action.d/
75    # Adding a suffix to config files
76    set cfgfiles [concat [glob ${destroot}${f2bconfdir}/*.conf] [glob ${destroot}${f2bconfdir}/action.d/*.conf] [glob ${destroot}${f2bconfdir}/filter.d/*.conf]]
77    foreach cfgfile ${cfgfiles} {
78        move ${cfgfile} ${cfgfile}.${version}
79    }
80}
81
82post-activate {
83    # If not already present we put default config files
84    set cfgfiles [concat [glob ${f2bconfdir}/*.conf.${version}] [glob ${f2bconfdir}/action.d/*.conf.${version}] [glob ${f2bconfdir}/filter.d/*.conf.${version}]]
85    foreach cfgfile ${cfgfiles} {
86        regsub "\.${version}" ${cfgfile} {} origcfgfile
87        if {![file exists ${origcfgfile}]} {
88            file copy ${cfgfile} ${origcfgfile}
89        }
90    }
91}
92
93notes "
94Next step is to configure fail2ban.
95Start to read:
96${f2bconfdir}/fail2ban.conf
97${f2bconfdir}/jail.conf
98and create your own fail2ban.local and jail.local
99
100Start/stop fail2ban with: sudo port \[un\]load fail2ban
101
102More info at ${homepage}
103"
104
105livecheck.type          regexm
106livecheck.url           ${homepage}wiki/index.php/Downloads
107livecheck.regex         <i>stable</i>.*?>${name}-(\[0-9.\]+)<