Skip to content

Instantly share code, notes, and snippets.

View kwirk's full-sized avatar

Steven Hiscocks kwirk

  • Wiltshire, England, United Kingdom
View GitHub Profile

Keybase proof

I hereby claim:

  • I am kwirk on github.
  • I am kwirk (https://keybase.io/kwirk) on keybase.
  • I have a public key ASA5TpkIYy4NWukvixZAe1NxQOUnd4PEaeLu-Ht28hQNAQo

To claim this, I am signing this object:

@kwirk
kwirk / gist:7937442
Created December 12, 2013 23:26
fail2ban - callable tags in actions
diff --git a/fail2ban/server/action.py b/fail2ban/server/action.py
index 7e16901..c34c839 100644
--- a/fail2ban/server/action.py
+++ b/fail2ban/server/action.py
@@ -314,12 +314,15 @@ class Action:
"""
string = query
for tag, value in aInfo.iteritems():
- value = str(value) # assure string
- if tag == 'matches':
@kwirk
kwirk / gist:5674184
Last active December 17, 2015 21:19
fail2ban/fail2ban issue #67
diff --git a/MANIFEST b/MANIFEST
index 8ad73b5..254c9b2 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -30,7 +30,6 @@ fail2ban/server/filterpoll.py
fail2ban/server/iso8601.py
fail2ban/server/server.py
fail2ban/server/actions.py
-fail2ban/server/faildata.py
fail2ban/server/failmanager.py
@kwirk
kwirk / gist:5560548
Created May 11, 2013 16:42
fail2ban/fail2ban issue#161
diff --git a/server/asyncserver.py b/server/asyncserver.py
index 62a5dd8..02fc766 100644
--- a/server/asyncserver.py
+++ b/server/asyncserver.py
@@ -75,6 +75,10 @@ class RequestHandler(asynchat.async_chat):
logSys.error(traceback.format_exc().splitlines())
self.close()
+ def close(self):
+ self.socket.shutdown(socket.SHUT_RDWR)
@kwirk
kwirk / gist:5518039
Last active December 17, 2015 00:00
fail2ban/fail2ban overlap date patterns
diff --git a/fail2ban/server/datetemplate.py b/fail2ban/server/datetemplate.py
index d37fa45..1be34d8 100644
--- a/fail2ban/server/datetemplate.py
+++ b/fail2ban/server/datetemplate.py
@@ -63,6 +63,9 @@ class DateTemplate:
def getHits(self):
return self.__hits
+ def resetHits(self):
+ self.__hits = 0
@kwirk
kwirk / gist:5506003
Created May 2, 2013 22:34
fail2ban/fail2ban date detector ideas
diff --git a/fail2ban/server/datedetector.py b/fail2ban/server/datedetector.py
index a29c975..734131d 100644
--- a/fail2ban/server/datedetector.py
+++ b/fail2ban/server/datedetector.py
@@ -29,7 +29,7 @@ __license__ = "GPL"
import time, logging
-from datetemplate import DateStrptime, DateTai64n, DateEpoch, DateISO8601
+from datetemplate import DatePatternRegex, DateTai64n, DateEpoch, DateISO8601
@kwirk
kwirk / gist:5491782
Created April 30, 2013 20:42
fail2ban/fail2ban issue #189
diff --git a/fail2ban/client/jailreader.py b/fail2ban/client/jailreader.py
index 9943b69..776a164 100644
--- a/fail2ban/client/jailreader.py
+++ b/fail2ban/client/jailreader.py
@@ -94,12 +94,28 @@ class JailReader(ConfigReader):
logSys.error("Unable to read the filter")
return False
+ actNames = set()
# Read action
@kwirk
kwirk / gist:5484915
Last active December 16, 2015 19:29
fail2ban/fail2ban issue #190
diff --git a/fail2ban/server/action.py b/fail2ban/server/action.py
index 6c36bbc..2b8acd5 100644
--- a/fail2ban/server/action.py
+++ b/fail2ban/server/action.py
@@ -27,7 +27,7 @@ __date__ = "$Date$"
__copyright__ = "Copyright (c) 2004 Cyril Jaquier"
__license__ = "GPL"
-import logging, os, subprocess, time, signal
+import logging, os, subprocess, time, signal, tempfile
@kwirk
kwirk / gist:5484839
Last active December 16, 2015 19:28
fail2ban/fail2ba issue #190
diff --git a/fail2ban/server/action.py b/fail2ban/server/action.py
index 6c36bbc..38c2c00 100644
--- a/fail2ban/server/action.py
+++ b/fail2ban/server/action.py
@@ -27,7 +27,7 @@ __date__ = "$Date$"
__copyright__ = "Copyright (c) 2004 Cyril Jaquier"
__license__ = "GPL"
-import logging, os, subprocess, time, signal
+import logging, os, subprocess, time, signal, tempfile
@kwirk
kwirk / gist:5397732
Created April 16, 2013 17:18
fail2ban Apache Tomcat date format
diff --git a/server/datedetector.py b/server/datedetector.py
index a54e072..2976450 100644
--- a/server/datedetector.py
+++ b/server/datedetector.py
@@ -161,6 +161,12 @@ class DateDetector:
template.setRegex("^\d{2}\d{2}\d{2} +\d{1,2}:\d{2}:\d{2}")
template.setPattern("%y%m%d %H:%M:%S")
self._appendTemplate(template)
+ # Apache Tomcat
+ template = DateStrptime()