~ubuntu-branches/ubuntu/vivid/fail2ban/vivid

« back to all changes in this revision

Viewing changes to server/actions.py

  • Committer: Package Import Robot
  • Author(s): Yaroslav Halchenko
  • Date: 2013-05-13 11:58:56 UTC
  • mfrom: (1.2.6) (11.1.5 experimental)
  • Revision ID: package-import@ubuntu.com-20130513115856-r1wwsd58ajx2ub5o
Tags: 0.8.9-1
* New upstream release
  - significant improvements in documentation (Closes: #400416)
  - roundcube auth filter (Closes: #699442)
  - enforces C locale for dates (Closes: #686341)
  - provides bash_completion.d/fail2ban
* debian/jail.conf:
  - added findtime and documentation on those basic options from jail.conf
    (Closes: #704568)
  - added new sample jails definitions for ssh-route, ssh-iptables-ipset{4,6},
    roundcube-auth, sogo-auth, mysqld-auth
* debian/control:
  - suggest system-log-daemon (Closes: #691001)
  - boost policy compliance to 3.9.4
* debian/rules:
  - run fail2ban's unittests at build time but ignore the failures
    (there are still some known issues to fix up to guarantee robust testing
    in clean chroots etc).
    Only pyinotify was added to build-depends since gamin might still be
    buggy on older releases and get stuck, which would complicate
    backporting

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
#
16
16
# You should have received a copy of the GNU General Public License
17
17
# along with Fail2Ban; if not, write to the Free Software
18
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
18
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19
19
 
20
20
# Author: Cyril Jaquier
21
21
22
 
# $Revision$
23
22
 
24
23
__author__ = "Cyril Jaquier"
25
 
__version__ = "$Revision$"
26
 
__date__ = "$Date$"
27
24
__copyright__ = "Copyright (c) 2004 Cyril Jaquier"
28
25
__license__ = "GPL"
29
26
 
77
74
                for action in self.__actions:
78
75
                        if action.getName() == name:
79
76
                                self.__actions.remove(action)
80
 
                                break
 
77
                                return
 
78
                raise KeyError("Invalid Action name: %s" % name)
81
79
        
82
80
        ##
83
81
        # Returns an action.
91
89
                for action in self.__actions:
92
90
                        if action.getName() == name:
93
91
                                return action
94
 
                raise KeyError
 
92
                raise KeyError("Invalid Action name")
95
93
        
96
94
        ##
97
95
        # Returns the last defined action.
121
119
                return self.__banManager.getBanTime()
122
120
        
123
121
        ##
 
122
        # Remove a banned IP now, rather than waiting for it to expire, even if set to never expire.
 
123
        #
 
124
        # @return the IP string or 'None' if not unbanned.
 
125
        def removeBannedIP(self, ip):
 
126
                # Find the ticket with the IP.
 
127
                ticket = self.__banManager.getTicketByIP(ip)
 
128
                if ticket is not None:
 
129
                        # Unban the IP.
 
130
                        self.__unBan(ticket)
 
131
                        return ip
 
132
                raise ValueError("IP %s is not banned" % ip)
 
133
 
 
134
        ##
124
135
        # Main loop.
125
136
        #
126
137
        # This function is the main loop of the thread. It checks the Jail
168
179
                                        action.execActionBan(aInfo)
169
180
                                return True
170
181
                        else:
171
 
                                logSys.warn("[%s] %s already banned" % (self.jail.getName(), 
 
182
                                logSys.info("[%s] %s already banned" % (self.jail.getName(),
172
183
                                                                                                                aInfo["ip"]))
173
184
                return False
174
185