diff --git a/fail2ban-0.8.4-examplemail.patch b/fail2ban-0.8.4-examplemail.patch new file mode 100644 index 0000000..71268b5 --- /dev/null +++ b/fail2ban-0.8.4-examplemail.patch @@ -0,0 +1,110 @@ +--- fail2ban-0.8.4/config/jail.conf.bak 2011-04-09 17:53:27.022210040 +0200 ++++ fail2ban-0.8.4/config/jail.conf 2011-04-09 18:22:35.075335264 +0200 +@@ -45,7 +45,7 @@ + enabled = true + filter = sshd + action = iptables[name=SSH, port=ssh, protocol=tcp] +- sendmail-whois[name=SSH, dest=root, sender=fail2ban@mail.com] ++ sendmail-whois[name=SSH, dest=root, sender=fail2ban@example.com] + logpath = /var/log/secure + maxretry = 5 + +@@ -54,7 +54,7 @@ + enabled = false + filter = proftpd + action = iptables[name=ProFTPD, port=ftp, protocol=tcp] +- sendmail-whois[name=ProFTPD, dest=you@mail.com] ++ sendmail-whois[name=ProFTPD, dest=you@example.com] + logpath = /var/log/proftpd/proftpd.log + maxretry = 6 + +@@ -66,7 +66,7 @@ + filter = sasl + backend = polling + action = iptables[name=sasl, port=smtp, protocol=tcp] +- sendmail-whois[name=sasl, dest=you@mail.com] ++ sendmail-whois[name=sasl, dest=you@example.com] + logpath = /var/log/mail.log + + # Here we use TCP-Wrappers instead of Netfilter/Iptables. "ignoreregex" is +@@ -77,7 +77,7 @@ + enabled = false + filter = sshd + action = hostsdeny +- sendmail-whois[name=SSH, dest=you@mail.com] ++ sendmail-whois[name=SSH, dest=you@example.com] + ignoreregex = for myuser from + logpath = /var/log/sshd.log + +@@ -101,7 +101,7 @@ + enabled = false + filter = postfix + action = hostsdeny[file=/not/a/standard/path/hosts.deny] +- sendmail[name=Postfix, dest=you@mail.com] ++ sendmail[name=Postfix, dest=you@example.com] + logpath = /var/log/postfix.log + bantime = 300 + +@@ -112,7 +112,7 @@ + + enabled = false + filter = vsftpd +-action = sendmail-whois[name=VSFTPD, dest=you@mail.com] ++action = sendmail-whois[name=VSFTPD, dest=you@example.com] + logpath = /var/log/vsftpd.log + maxretry = 5 + bantime = 1800 +@@ -124,7 +124,7 @@ + enabled = false + filter = vsftpd + action = iptables[name=VSFTPD, port=ftp, protocol=tcp] +- sendmail-whois[name=VSFTPD, dest=you@mail.com] ++ sendmail-whois[name=VSFTPD, dest=you@example.com] + logpath = /var/log/vsftpd.log + maxretry = 5 + bantime = 1800 +@@ -137,7 +137,7 @@ + enabled = false + filter = apache-badbots + action = iptables-multiport[name=BadBots, port="http,https"] +- sendmail-buffered[name=BadBots, lines=5, dest=you@mail.com] ++ sendmail-buffered[name=BadBots, lines=5, dest=you@example.com] + logpath = /var/www/*/logs/access_log + bantime = 172800 + maxretry = 1 +@@ -149,7 +149,7 @@ + enabled = false + filter = apache-noscript + action = shorewall +- sendmail[name=Postfix, dest=you@mail.com] ++ sendmail[name=Postfix, dest=you@example.com] + logpath = /var/log/apache2/error_log + + # Ban attackers that try to use PHP's URL-fopen() functionality +@@ -190,7 +190,7 @@ + enabled = false + filter = sshd + action = ipfw[localhost=192.168.0.1] +- sendmail-whois[name="SSH,IPFW", dest=you@mail.com] ++ sendmail-whois[name="SSH,IPFW", dest=you@example.com] + logpath = /var/log/auth.log + ignoreip = 168.192.0.1 + +@@ -216,7 +216,7 @@ + enabled = false + filter = named-refused + action = iptables-multiport[name=Named, port="domain,953", protocol=udp] +- sendmail-whois[name=Named, dest=you@mail.com] ++ sendmail-whois[name=Named, dest=you@example.com] + logpath = /var/log/named/security.log + ignoreip = 168.192.0.1 + +@@ -227,7 +227,7 @@ + enabled = false + filter = named-refused + action = iptables-multiport[name=Named, port="domain,953", protocol=tcp] +- sendmail-whois[name=Named, dest=you@mail.com] ++ sendmail-whois[name=Named, dest=you@example.com] + logpath = /var/log/named/security.log + ignoreip = 168.192.0.1 + diff --git a/fail2ban-0.8.4-notmp.patch b/fail2ban-0.8.4-notmp.patch new file mode 100644 index 0000000..dc09397 --- /dev/null +++ b/fail2ban-0.8.4-notmp.patch @@ -0,0 +1,101 @@ +diff -rud fail2ban-0.8.4.org/ChangeLog fail2ban-0.8.4/ChangeLog +--- fail2ban-0.8.4.org/ChangeLog 2009-09-07 21:11:29.000000000 +0200 ++++ fail2ban-0.8.4/ChangeLog 2011-04-09 17:56:51.029085738 +0200 +@@ -353,7 +353,7 @@ + Thanks to Tom Pike + - fail2ban.conf modified for readability. Thanks to Iain Lea + - Added an initd script for Gentoo +-- Changed default PID lock file location from /tmp to /var/run ++- Changed default PID lock file location from /var/lib/fail2ban to /var/run + + ver. 0.4.0 (2005/04/24) - stable + ---------- +diff -rud fail2ban-0.8.4.org/client/fail2banreader.py fail2ban-0.8.4/client/fail2banreader.py +--- fail2ban-0.8.4.org/client/fail2banreader.py 2008-02-27 22:44:56.000000000 +0100 ++++ fail2ban-0.8.4/client/fail2banreader.py 2011-04-09 17:56:51.027086612 +0200 +@@ -39,7 +39,7 @@ + ConfigReader.read(self, "fail2ban") + + def getEarlyOptions(self): +- opts = [["string", "socket", "/tmp/fail2ban.sock"]] ++ opts = [["string", "socket", "/var/lib/fail2ban/fail2ban.sock"]] + return ConfigReader.getOptions(self, "Definition", opts) + + def getOptions(self): +diff -rud fail2ban-0.8.4.org/config/action.d/dshield.conf fail2ban-0.8.4/config/action.d/dshield.conf +--- fail2ban-0.8.4.org/config/action.d/dshield.conf 2008-07-14 19:13:47.000000000 +0200 ++++ fail2ban-0.8.4/config/action.d/dshield.conf 2011-04-09 17:56:51.031085423 +0200 +@@ -204,7 +204,7 @@ + + # Option: tmpfile + # Notes.: Base name of temporary files used for buffering +-# Values: [ STRING ] Default: /tmp/fail2ban-dshield ++# Values: [ STRING ] Default: /var/lib/fail2ban/fail2ban-dshield + # +-tmpfile = /tmp/fail2ban-dshield ++tmpfile = /var/lib/fail2ban/fail2ban-dshield + +diff -rud fail2ban-0.8.4.org/config/action.d/mail-buffered.conf fail2ban-0.8.4/config/action.d/mail-buffered.conf +--- fail2ban-0.8.4.org/config/action.d/mail-buffered.conf 2008-07-16 23:11:43.000000000 +0200 ++++ fail2ban-0.8.4/config/action.d/mail-buffered.conf 2011-04-09 17:56:51.031085423 +0200 +@@ -81,7 +81,7 @@ + + # Default temporary file + # +-tmpfile = /tmp/fail2ban-mail.txt ++tmpfile = /var/lib/fail2ban/fail2ban-mail.txt + + # Destination/Addressee of the mail + # +diff -rud fail2ban-0.8.4.org/config/action.d/mynetwatchman.conf fail2ban-0.8.4/config/action.d/mynetwatchman.conf +--- fail2ban-0.8.4.org/config/action.d/mynetwatchman.conf 2008-07-14 19:14:13.000000000 +0200 ++++ fail2ban-0.8.4/config/action.d/mynetwatchman.conf 2011-04-09 17:56:51.030086280 +0200 +@@ -139,6 +139,6 @@ + + # Option: tmpfile + # Notes.: Base name of temporary files +-# Values: [ STRING ] Default: /tmp/fail2ban-mynetwatchman ++# Values: [ STRING ] Default: /var/lib/fail2ban/fail2ban-mynetwatchman + # +-tmpfile = /tmp/fail2ban-mynetwatchman ++tmpfile = /var/lib/fail2ban/fail2ban-mynetwatchman +diff -rud fail2ban-0.8.4.org/config/action.d/sendmail-buffered.conf fail2ban-0.8.4/config/action.d/sendmail-buffered.conf +--- fail2ban-0.8.4.org/config/action.d/sendmail-buffered.conf 2008-07-16 23:11:43.000000000 +0200 ++++ fail2ban-0.8.4/config/action.d/sendmail-buffered.conf 2011-04-09 17:56:51.029085738 +0200 +@@ -101,5 +101,5 @@ + + # Default temporary file + # +-tmpfile = /tmp/fail2ban-mail.txt ++tmpfile = /var/lib/fail2ban/fail2ban-mail.txt + +diff -rud fail2ban-0.8.4.org/files/nagios/f2ban.txt fail2ban-0.8.4/files/nagios/f2ban.txt +--- fail2ban-0.8.4.org/files/nagios/f2ban.txt 2009-01-27 23:53:40.000000000 +0100 ++++ fail2ban-0.8.4/files/nagios/f2ban.txt 2011-04-09 17:56:51.027086612 +0200 +@@ -6,7 +6,7 @@ + /etc/init.d/fail2ban stop + + 2.) delete the socket if avalible +-rm /tmp/fail2ban.sock ++rm /var/lib/fail2ban/fail2ban.sock + + 3.) start the Service + /etc/init.d/fail2ban start +diff -rud fail2ban-0.8.4.org/testcases/actiontestcase.py fail2ban-0.8.4/testcases/actiontestcase.py +--- fail2ban-0.8.4.org/testcases/actiontestcase.py 2008-02-27 22:44:54.000000000 +0100 ++++ fail2ban-0.8.4/testcases/actiontestcase.py 2011-04-09 17:56:51.027086612 +0200 +@@ -38,10 +38,10 @@ + self.__action.execActionStop() + + def testExecuteActionBan(self): +- self.__action.setActionStart("touch /tmp/fail2ban.test") +- self.__action.setActionStop("rm -f /tmp/fail2ban.test") ++ self.__action.setActionStart("touch /var/lib/fail2ban/fail2ban.test") ++ self.__action.setActionStop("rm -f /var/lib/fail2ban/fail2ban.test") + self.__action.setActionBan("echo -n") +- self.__action.setActionCheck("[ -e /tmp/fail2ban.test ]") ++ self.__action.setActionCheck("[ -e /var/lib/fail2ban/fail2ban.test ]") + + self.assertTrue(self.__action.execActionBan(None)) + +\ No newline at end of file diff --git a/fail2ban-tmpfiles.conf b/fail2ban-tmpfiles.conf new file mode 100644 index 0000000..3fd783f --- /dev/null +++ b/fail2ban-tmpfiles.conf @@ -0,0 +1 @@ +D /var/run/fail2ban 0755 root root - \ No newline at end of file diff --git a/fail2ban.spec b/fail2ban.spec index 166104a..ac9690c 100644 --- a/fail2ban.spec +++ b/fail2ban.spec @@ -4,21 +4,27 @@ Summary: Ban IPs that make too many password failures Name: fail2ban Version: 0.8.4 -Release: 26%{?dist} +Release: 27%{?dist} License: GPLv2+ Group: System Environment/Daemons URL: http://fail2ban.sourceforge.net/ Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.bz2 Source1: fail2ban-logrotate +Source2: fail2ban-tmpfiles.conf Patch0: fail2ban-0.8.3-init.patch Patch1: fail2ban-0.8.1-sshd.patch Patch3: fail2ban-0.8.2-fd_cloexec.patch Patch6: fail2ban-0.8.3-log2syslog.patch Patch7: asyncserver.start_selinux.patch +Patch8: fail2ban-0.8.4-notmp.patch +Patch9: pyinotify.patch +Patch10: fail2ban-0.8.4-examplemail.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRequires: python-devel >= 2.3 BuildArch: noarch Requires: iptables, tcp_wrappers, shorewall, gamin-python +Requires: python-inotify +Requires: initscripts Requires(post): /sbin/chkconfig Requires(preun): /sbin/chkconfig Requires(preun): /sbin/service @@ -35,6 +41,9 @@ failures. It updates firewall rules to reject the IP address. %patch3 -p1 -b .fd_cloexec %patch6 -p1 -b .log2syslog %patch7 -p1 -b .fd_cloexec2 +%patch8 -p1 -b .notmp +%patch9 -p1 -b .inotify +%patch10 -p1 -b .mail %build python setup.py build @@ -48,8 +57,10 @@ mkdir -p %{buildroot}%{_mandir}/man1 install -p -m 644 man/fail2ban*.1 %{buildroot}%{_mandir}/man1 mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d install -p -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/fail2ban -mkdir -p %{buildroot}%{_localstatedir}/run/fail2ban -chmod 0755 %{buildroot}%{_localstatedir}/run/fail2ban +install -d -m 0755 %{buildroot}%{_localstatedir}/run/fail2ban/ +install -d -m 0755 %{buildroot}%{_localstatedir}/lib/fail2ban/ +mkdir -p %{buildroot}%{_sysconfdir}/tmpfiles.d +install -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/tmpfiles.d/fail2ban.conf %clean rm -rf %{buildroot} @@ -81,14 +92,15 @@ fi %config(noreplace) %{_sysconfdir}/fail2ban/action.d/*.conf %config(noreplace) %{_sysconfdir}/fail2ban/filter.d/*.conf %config(noreplace) %{_sysconfdir}/logrotate.d/fail2ban -%dir %{_localstatedir}/run/fail2ban +%dir %{_localstatedir}/run/fail2ban/ +%config(noreplace) %{_sysconfdir}/tmpfiles.d/fail2ban.conf +%dir %{_localstatedir}/lib/fail2ban/ %changelog -* Tue Feb 08 2011 Fedora Release Engineering - 0.8.4-26 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild - -* Wed Aug 11 2010 David Malcolm - 0.8.4-25 -- recompiling .py files against Python 2.7 (rhbz#623295) +* Sat Apr 9 2011 Axel Thimm - 0.8.4-27 +- Move tmp files to /var/lib (suggested by Phil Anderson). +- Enable inotify support (by Jonathan Underwood). +- Fixes RH bugs #669966, #669965, #551895, #552947, #658849, #656584. * Sun Feb 14 2010 Axel Thimm - 0.8.4-24 - Patch by Jonathan G. Underwood to diff --git a/pyinotify.patch b/pyinotify.patch new file mode 100644 index 0000000..f76ee0a --- /dev/null +++ b/pyinotify.patch @@ -0,0 +1,1379 @@ + + + + +Attachment #381327 for bug #551895 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + View + | Details + | Raw Unified + | Return to bug 551895 +
+ + +Collapse All | +Expand All + + +

+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
(-)a/config/jail.conf + (-3 / +6 lines) +
+ +
+  Lines 26-38 +   findtime = 600 + + Link Here  +
+
26
maxretry = 3
26
maxretry = 3
27
27
28
# "backend" specifies the backend used to get files modification. Available
28
# "backend" specifies the backend used to get files modification. Available
29
# options are "gamin", "polling" and "auto". This option can be overridden in
29
# options are "inotify", "gamin", "polling" and "auto". This option can be
30
# each jail too (use "gamin" for a jail and "polling" for another).
30
# overridden in each jail too (use "gamin" for a jail and "polling" for
31
# another).
31
#
32
#
33
# inotify: requires pyinotify and the a kernel supporting Inotify
32
# gamin:   requires Gamin (a file alteration monitor) to be installed. If Gamin
34
# gamin:   requires Gamin (a file alteration monitor) to be installed. If Gamin
33
#          is not installed, Fail2ban will use polling.
35
#          is not installed, Fail2ban will use polling.
34
# polling: uses a polling algorithm which does not require external libraries.
36
# polling: uses a polling algorithm which does not require external libraries.
35
# auto:    will choose Gamin if available and polling otherwise.
37
# auto:    will choose Inotify if pyinotify is present, if not then it will
38
# 	   try Gamin and use that if available, and polling otherwise.
36
backend = auto
39
backend = auto
37
40
38
41
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
(-)a/server/filterinotify.py + (+157 lines) +
+ +
+ Line 0 +    + + Link Here  +
+
1
# This file is part of Fail2Ban.
2
#
3
# Fail2Ban is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
7
#
8
# Fail2Ban is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
12
#
13
# You should have received a copy of the GNU General Public License
14
# along with Fail2Ban; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
17
# Author: Jonathan G. Underwood
18
# 
19
# $Revision$
20
21
__author__ = "Jonathan G. Underwood"
22
__version__ = "$Revision$"
23
__date__ = "$Date$"
24
__copyright__ = "Copyright (c) 2010 Jonathan G. Underwood"
25
__license__ = "GPL"
26
27
from failmanager import FailManagerEmpty
28
from filter import FileFilter
29
from mytime import MyTime
30
31
import time, logging
32
33
import pyinotify
34
from pyinotify import ProcessEvent, WatchManager, Notifier
35
36
# Gets the instance of the logger.
37
logSys = logging.getLogger("fail2ban.filter")
38
39
##
40
# Log reader class.
41
#
42
# This class reads a log file and detects login failures or anything else
43
# that matches a given regular expression. This class is instanciated by
44
# a Jail object.
45
46
class FilterInotify(ProcessEvent, FileFilter):
47
48
	##
49
	# Constructor.
50
	#
51
	# Initialize the filter object with default values.
52
	# @param jail the jail object
53
	
54
	# Note that according to the pyinotify documentation we shouldn't
55
	# define an __init__ function, but define a my_init function which is
56
	# called by ProcessEvent.__init__. However, that approach appears not
57
	# to work here and so we define __init__ and call
58
	# ProcessEvent.__init__ from here.
59
	def __init__(self, jail):
60
		FileFilter.__init__(self, jail)
61
		ProcessEvent.__init__(self)
62
		self.__monitor = WatchManager()
63
		self.__notifier = Notifier(self.__monitor, self)
64
		self.__mask = pyinotify.IN_MODIFY | pyinotify.IN_CREATE
65
		
66
	##
67
	# Event handling functions used by pyinotify.ProcessEvent
68
	# instance. These simply call the __handleMod method.
69
	# @event an event object
70
71
	def process_IN_MODIFY(self, event):
72
		logSys.debug("process_IN_MODIFY called")
73
		self.__handleMod(event)
74
75
	def process_IN_CREATE(self, event):
76
		logSys.debug("process_IN_CREATE called")
77
		self.__handleMod(event)
78
79
	##
80
	# This method handles all modified file events
81
	# @event an event object
82
83
	def __handleMod(self, event):
84
		self.getFailures(event.path)
85
		try:
86
			while True:
87
				ticket = self.failManager.toBan()
88
				self.jail.putFailTicket(ticket)
89
		except FailManagerEmpty:
90
			self.failManager.cleanup(MyTime.time())
91
		self.dateDetector.sortTemplate()
92
			
93
	##
94
	# Add a log file path
95
	#
96
	# @param path log file path
97
98
	def addLogPath(self, path, tail = False):
99
		if self.containsLogPath(path):
100
			logSys.error(path + " already exists")
101
		else:
102
			wd = self.__monitor.add_watch(path, self.__mask)
103
			if wd[path] > 0:
104
				FileFilter.addLogPath(self, path, tail)
105
				logSys.info("Added logfile = %s" % path)
106
			else:
107
				logSys.error("Failed to add an inotify watch for logfile = %s" % path)
108
	
109
	##
110
	# Delete a log path
111
	#
112
	# @param path the log file to delete
113
	
114
	def delLogPath(self, path):
115
		if not self.containsLogPath(path):
116
			logSys.error(path + " is not monitored")
117
		else:
118
			rd = self.__monitor.rm_watch(self.__monitor.get_wd(path))
119
			if rd[path]:
120
				FileFilter.delLogPath(self, path)
121
				logSys.info("Removed logfile = %s" % path)
122
			else:
123
				logSys.error("Failed to remove inotify watch for logfile = %s" % path)
124
		
125
	##
126
	# Main loop.
127
	#
128
	# This function is the main loop of the thread. It checks if the
129
	# file has been modified and looks for failures.
130
	# @return True when the thread exits nicely
131
132
	def run(self):
133
		self.setActive(True)
134
		while self._isActive():
135
			if not self.getIdle():
136
				# We cannot block here because we want to be able to
137
				# exit. __notifier.check_events will block for
138
				# timeout milliseconds.
139
				if self.__notifier.check_events(timeout=10):
140
					self.__notifier.read_events()
141
					self.__notifier.process_events()
142
				time.sleep(self.getSleepTime())
143
			else:
144
				time.sleep(self.getSleepTime())
145
146
		# Cleanup when shutting down
147
		for wd in self.watchd.keys():
148
			self.__monitor.rm_watch(wd)
149
		del self.__monitor
150
		self.__notifier.stop()
151
		del self.__notifier
152
153
		logSys.debug(self.jail.getName() + ": filter terminated")
154
		return True
155
156
157
				
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
(-)a/server/jail.py + (-2 / +16 lines) +
+ +
+  Lines 40-56 +   class Jail: + + Link Here  +
+
40
		logSys.info("Creating new jail '%s'" % self.__name)
40
		logSys.info("Creating new jail '%s'" % self.__name)
41
		if backend == "polling":
41
		if backend == "polling":
42
			self.__initPoller()
42
			self.__initPoller()
43
		elif backend == "inotify":
44
			self.__initInotify()
45
		elif backend == "gamin":
46
			self.__initGamin()
43
		else:
47
		else:
44
			try:
48
			try:
45
				self.__initGamin()
49
				self.__initInotify()
46
			except ImportError:
50
			except ImportError:
47
				self.__initPoller()
51
				try:
52
					self.__initGamin()
53
				except ImportError:
54
					self.__initPoller()
48
		self.__action = Actions(self)
55
		self.__action = Actions(self)
49
	
56
	
50
	def __initPoller(self):
57
	def __initPoller(self):
51
		logSys.info("Jail '%s' uses poller" % self.__name)
58
		logSys.info("Jail '%s' uses poller" % self.__name)
52
		from filterpoll import FilterPoll
59
		from filterpoll import FilterPoll
53
		self.__filter = FilterPoll(self)
60
		self.__filter = FilterPoll(self)
61
62
	def __initInotify(self):
63
		# Try to import pyinotify
64
		import pyinotify
65
		logSys.info("Jail '%s' uses Inotify" % self.__name)
66
		from filterinotify import FilterInotify
67
		self.__filter = FilterInotify(self)
54
	
68
	
55
	def __initGamin(self):
69
	def __initGamin(self):
56
		# Try to import gamin
70
		# Try to import gamin
+ + +
+ + Return to bug 551895 +
+ + + + + + + + \ No newline at end of file