[92381] trunk/dports/security
g5pw at macports.org
g5pw at macports.org
Thu Apr 26 22:28:53 PDT 2012
Revision: 92381
https://trac.macports.org/changeset/92381
Author: g5pw at macports.org
Date: 2012-04-26 22:28:49 -0700 (Thu, 26 Apr 2012)
Log Message:
-----------
security/fail2ban:
New port, commited from ticket #34229
Added Paths:
-----------
trunk/dports/security/fail2ban/
trunk/dports/security/fail2ban/Portfile
trunk/dports/security/fail2ban/files/
trunk/dports/security/fail2ban/files/patch-client-csocket.py.diff
trunk/dports/security/fail2ban/files/patch-config-fail2ban.conf.diff
trunk/dports/security/fail2ban/files/patch-fail2ban-client.diff
trunk/dports/security/fail2ban/files/patch-fail2ban-regex.diff
trunk/dports/security/fail2ban/files/patch-fail2ban-server.diff
trunk/dports/security/fail2ban/files/patch-server-server.py.diff
trunk/dports/security/fail2ban/files/patch-setup.cfg.diff
trunk/dports/security/fail2ban/files/patch-setup.py.diff
Added: trunk/dports/security/fail2ban/Portfile
===================================================================
--- trunk/dports/security/fail2ban/Portfile (rev 0)
+++ trunk/dports/security/fail2ban/Portfile 2012-04-27 05:28:49 UTC (rev 92381)
@@ -0,0 +1,75 @@
+# -*- 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
+# $Id$
+
+PortSystem 1.0
+PortGroup github 1.0
+PortGroup python27 1.0
+
+github.setup fail2ban fail2ban 0.8.6
+categories security python
+license GPL-2+
+maintainers free.fr:fclaire openmaintainer
+platforms darwin
+homepage http://www.fail2ban.org
+description Fail2ban protects computer against brute-force attacks
+
+long_description Fail2ban scans log files (e.g. /var/log/apache/error_log) and \
+ bans IPs that show the malicious signs -- too many password failures, \
+ seeking for exploits, etc. Generally Fail2Ban then used to update \
+ firewall rules to reject the IP addresses for a specified amount \
+ of time, although any arbitrary other action (e.g. sending an email, \
+ or ejecting CD-ROM tray) could also be configured. Out of the box \
+ Fail2Ban comes with filters for various services (apache, curier, ssh, etc).
+
+checksums sha256 24d02422c55f1b7d92bea30a7dde6f72f280eadf09d478fcca8b1dd40fb4e914 \
+ rmd160 70678ca46849a462367603fb3d0e2c6c2f3b75cf
+
+set f2bconfdir ${prefix}/etc/${name}
+set f2bbindir ${prefix}/bin
+
+python.link_binaries_suffix
+
+patchfiles patch-setup.py.diff \
+ patch-setup.cfg.diff \
+ patch-fail2ban-client.diff \
+ patch-fail2ban-regex.diff \
+ patch-fail2ban-server.diff \
+ patch-config-fail2ban.conf.diff \
+ patch-client-csocket.py.diff \
+ patch-server-server.py.diff
+
+post-patch {
+ reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/setup.py
+ reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/setup.cfg
+ reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/fail2ban-client
+ reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/fail2ban-regex
+ reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/fail2ban-server
+ reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/client/csocket.py
+ reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/config/fail2ban.conf
+ reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/server/server.py
+}
+
+startupitem.create yes
+startupitem.start "${f2bbindir}/${name}-client start"
+startupitem.stop "${f2bbindir}/${name}-client stop"
+
+destroot.keepdirs ${destroot}${prefix}/var/run/fail2ban
+
+post-destroot {
+ # Adding a suffix to config files
+ set cfgfiles [concat [glob ${destroot}${f2bconfdir}/*.conf] [glob ${destroot}${f2bconfdir}/action.d/*.conf] [glob ${destroot}${f2bconfdir}/filter.d/*.conf]]
+ foreach cfgfile ${cfgfiles} {
+ move ${cfgfile} ${cfgfile}.${version}
+ }
+}
+
+post-activate {
+ # If not already present we put default config files
+ set cfgfiles [concat [glob ${f2bconfdir}/*.conf.${version}] [glob ${f2bconfdir}/action.d/*.conf.${version}] [glob ${f2bconfdir}/filter.d/*.conf.${version}]]
+ foreach cfgfile ${cfgfiles} {
+ regsub "\.${version}" ${cfgfile} {} origcfgfile
+ if {![file exists ${origcfgfile}]} {
+ file copy ${cfgfile} ${origcfgfile}
+ }
+ }
+}
Property changes on: trunk/dports/security/fail2ban/Portfile
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ native
Added: trunk/dports/security/fail2ban/files/patch-client-csocket.py.diff
===================================================================
--- trunk/dports/security/fail2ban/files/patch-client-csocket.py.diff (rev 0)
+++ trunk/dports/security/fail2ban/files/patch-client-csocket.py.diff 2012-04-27 05:28:49 UTC (rev 92381)
@@ -0,0 +1,11 @@
+--- client/csocket.py.orig 2012-04-26 13:21:29.000000000 +0200
++++ client/csocket.py 2012-04-26 13:21:45.000000000 +0200
+@@ -35,7 +35,7 @@
+
+ END_STRING = "<F2B_END_COMMAND>"
+
+- def __init__(self, sock = "/var/run/fail2ban/fail2ban.sock"):
++ def __init__(self, sock = "@@PREFIX@@/var/run/fail2ban/fail2ban.sock"):
+ # Create an INET, STREAMing socket
+ #self.csock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ self.__csock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
Added: trunk/dports/security/fail2ban/files/patch-config-fail2ban.conf.diff
===================================================================
--- trunk/dports/security/fail2ban/files/patch-config-fail2ban.conf.diff (rev 0)
+++ trunk/dports/security/fail2ban/files/patch-config-fail2ban.conf.diff 2012-04-27 05:28:49 UTC (rev 92381)
@@ -0,0 +1,9 @@
+--- config/fail2ban.conf.orig 2012-04-26 13:22:09.000000000 +0200
++++ config/fail2ban.conf 2012-04-26 13:22:30.000000000 +0200
+@@ -30,5 +30,5 @@
+ # communicate with the server afterwards.
+ # Values: FILE Default: /var/run/fail2ban/fail2ban.sock
+ #
+-socket = /var/run/fail2ban/fail2ban.sock
++socket = @@PREFIX@@/var/run/fail2ban/fail2ban.sock
+
Added: trunk/dports/security/fail2ban/files/patch-fail2ban-client.diff
===================================================================
--- trunk/dports/security/fail2ban/files/patch-fail2ban-client.diff (rev 0)
+++ trunk/dports/security/fail2ban/files/patch-fail2ban-client.diff 2012-04-27 05:28:49 UTC (rev 92381)
@@ -0,0 +1,20 @@
+--- fail2ban-client.orig 2012-04-26 10:59:30.000000000 +0200
++++ fail2ban-client 2012-04-26 11:27:03.000000000 +0200
+@@ -33,7 +33,7 @@
+
+ # Inserts our own modules path first in the list
+ # fix for bug #343821
+-sys.path.insert(1, "/usr/share/fail2ban")
++sys.path.insert(1, "@@PREFIX@@/share/fail2ban")
+
+ # Now we can import our modules
+ from common.version import version
+@@ -59,7 +59,7 @@
+ self.__stream = None
+ self.__configurator = Configurator()
+ self.__conf = dict()
+- self.__conf["conf"] = "/etc/fail2ban"
++ self.__conf["conf"] = "@@PREFIX@@/etc/fail2ban"
+ self.__conf["dump"] = False
+ self.__conf["force"] = False
+ self.__conf["verbose"] = 1
Added: trunk/dports/security/fail2ban/files/patch-fail2ban-regex.diff
===================================================================
--- trunk/dports/security/fail2ban/files/patch-fail2ban-regex.diff (rev 0)
+++ trunk/dports/security/fail2ban/files/patch-fail2ban-regex.diff 2012-04-27 05:28:49 UTC (rev 92381)
@@ -0,0 +1,20 @@
+--- fail2ban-regex.orig 2012-04-26 11:00:35.000000000 +0200
++++ fail2ban-regex 2012-04-26 11:27:19.000000000 +0200
+@@ -29,7 +29,7 @@
+
+ # Inserts our own modules path first in the list
+ # fix for bug #343821
+-sys.path.insert(1, "/usr/share/fail2ban")
++sys.path.insert(1, "@@PREFIX@@/share/fail2ban")
+
+ from client.configparserinc import SafeConfigParserWithIncludes
+ from ConfigParser import NoOptionError, NoSectionError, MissingSectionHeaderError
+@@ -66,7 +66,7 @@
+
+ test = None
+
+- CONFIG_DEFAULTS = {'configpath' : "/etc/fail2ban/"}
++ CONFIG_DEFAULTS = {'configpath' : "@@PREFIX@@/etc/fail2ban/"}
+
+ def __init__(self):
+ self.__filter = Filter(None)
Added: trunk/dports/security/fail2ban/files/patch-fail2ban-server.diff
===================================================================
--- trunk/dports/security/fail2ban/files/patch-fail2ban-server.diff (rev 0)
+++ trunk/dports/security/fail2ban/files/patch-fail2ban-server.diff 2012-04-27 05:28:49 UTC (rev 92381)
@@ -0,0 +1,20 @@
+--- fail2ban-server.orig 2012-04-26 11:02:58.000000000 +0200
++++ fail2ban-server 2012-04-26 13:11:25.000000000 +0200
+@@ -32,7 +32,7 @@
+
+ # Inserts our own modules path first in the list
+ # fix for bug #343821
+-sys.path.insert(1, "/usr/share/fail2ban")
++sys.path.insert(1, "@@PREFIX@@/share/fail2ban")
+
+ from common.version import version
+ from server.server import Server
+@@ -56,7 +56,7 @@
+ self.__conf = dict()
+ self.__conf["background"] = True
+ self.__conf["force"] = False
+- self.__conf["socket"] = "/var/run/fail2ban/fail2ban.sock"
++ self.__conf["socket"] = "@@PREFIX@@/var/run/fail2ban/fail2ban.sock"
+
+ def dispVersion(self):
+ print "Fail2Ban v" + version
Added: trunk/dports/security/fail2ban/files/patch-server-server.py.diff
===================================================================
--- trunk/dports/security/fail2ban/files/patch-server-server.py.diff (rev 0)
+++ trunk/dports/security/fail2ban/files/patch-server-server.py.diff 2012-04-27 05:28:49 UTC (rev 92381)
@@ -0,0 +1,11 @@
+--- server/server.py.orig 2012-04-26 22:18:49.000000000 +0200
++++ server/server.py 2012-04-26 22:19:08.000000000 +0200
+@@ -40,7 +40,7 @@
+
+ class Server:
+
+- PID_FILE = "/var/run/fail2ban/fail2ban.pid"
++ PID_FILE = "@@PREFIX@@/var/run/fail2ban/fail2ban.pid"
+
+ def __init__(self, daemon = False):
+ self.__loggingLock = Lock()
Added: trunk/dports/security/fail2ban/files/patch-setup.cfg.diff
===================================================================
--- trunk/dports/security/fail2ban/files/patch-setup.cfg.diff (rev 0)
+++ trunk/dports/security/fail2ban/files/patch-setup.cfg.diff 2012-04-27 05:28:49 UTC (rev 92381)
@@ -0,0 +1,9 @@
+--- setup.cfg.orig 2012-04-26 11:04:26.000000000 +0200
++++ setup.cfg 2012-04-26 11:04:40.000000000 +0200
+@@ -1,5 +1,5 @@
+ [install]
+-install-purelib=/usr/share/fail2ban
++install-purelib=@@PREFIX@@/share/fail2ban
+
+ [sdist]
+ formats=bztar
Added: trunk/dports/security/fail2ban/files/patch-setup.py.diff
===================================================================
--- trunk/dports/security/fail2ban/files/patch-setup.py.diff (rev 0)
+++ trunk/dports/security/fail2ban/files/patch-setup.py.diff 2012-04-27 05:28:49 UTC (rev 92381)
@@ -0,0 +1,56 @@
+--- setup.py.orig 2012-04-26 10:26:02.000000000 +0200
++++ setup.py 2012-04-26 11:06:43.000000000 +0200
+@@ -62,16 +62,16 @@
+ 'server'
+ ],
+ data_files = [
+- ('/etc/fail2ban',
++ ('@@PREFIX@@/etc/fail2ban',
+ glob("config/*.conf")
+ ),
+- ('/etc/fail2ban/filter.d',
++ ('@@PREFIX@@/etc/fail2ban/filter.d',
+ glob("config/filter.d/*.conf")
+ ),
+- ('/etc/fail2ban/action.d',
++ ('@@PREFIX@@/etc/fail2ban/action.d',
+ glob("config/action.d/*.conf")
+ ),
+- ('/var/run/fail2ban',
++ ('@@PREFIX@@/var/run/fail2ban',
+ ''
+ )
+ ]
+@@ -81,21 +81,21 @@
+ # Search for obsolete files.
+ obsoleteFiles = []
+ elements = {
+- "/etc/":
++ "@@PREFIX@@/etc/":
+ [
+ "fail2ban.conf"
+ ],
+- "/usr/bin/":
++ "@@PREFIX@@/bin/":
+ [
+ "fail2ban.py"
+ ],
+- "/usr/lib/fail2ban/firewall/":
++ "@@PREFIX@@/lib/fail2ban/firewall/":
+ [
+ "iptables.py",
+ "ipfwadm.py",
+ "ipfw.py"
+ ],
+- "/usr/lib/fail2ban/":
++ "@@PREFIX@@/lib/fail2ban/":
+ [
+ "version.py",
+ "protocol.py"
+@@ -129,5 +129,5 @@
+ if argv[1] == "install":
+ print
+ print "Please do not forget to update your configuration files."
+- print "They are in /etc/fail2ban/."
++ print "They are in @@PREFIX@@/etc/fail2ban/."
+ print
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20120426/9218bb9d/attachment-0001.html>
More information about the macports-changes
mailing list