fail2ban.server.jail module
***************************

class fail2ban.server.jail.Jail(name, backend='auto', db=None)

   Bases: "object"

   Fail2Ban jail, which manages a filter and associated actions.

   The class handles the initialisation of a filter, and actions. It's
   role is then to act as an interface between the filter and actions,
   passing bans detected by the filter, for the actions to then act
   upon.

   Parameters:
      **name** : str
         Name assigned to the jail.

      **backend** : str
         Backend to be used for filter. "auto" will attempt to pick
         the most preferred backend method. Default: "auto"

      **db** : Fail2BanDb
         Fail2Ban persistent database instance. Default: *None*

   Attributes:
      "name"
         Name of jail.

      "database"
         The database used to store persistent data for the jail.

      "filter"
         The filter which the jail is using to monitor log files.

      "actions"
         Actions object used to manage actions for jail.

      "idle"
         A boolean indicating whether jail is idle.

      "status"
         The status of the jail.

   -[ Methods ]-

   +------------+--------------------------------------------------------------------------------------------+
   | "getFailTi | Get a fail ticket from the jail.                                                           |
   | cket"()    |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "getMaxBan | Returns max possible ban-time of jail.                                                     |
   | Time"()    |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "isAlive"( | Check jail "isAlive" by checking filter and actions threads.                               |
   | )          |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "putFailTi | Add a fail ticket to the jail.                                                             |
   | cket"(tick |                                                                                            |
   | et)        |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "restoreCu | Restore any previous valid bans from the database.                                         |
   | rrentBans" |                                                                                            |
   | ([correctB |                                                                                            |
   | anTime])   |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "start"()  | Start the jail, by starting filter and actions threads.                                    |
   +------------+--------------------------------------------------------------------------------------------+
   | "status"([ | The status of the jail.                                                                    |
   | flavor])   |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "stop"([st | Stop the jail, by stopping filter and actions threads.                                     |
   | op, join]) |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+

   +---------------------+------------+
   | **getBanTimeExtra** |            |
   +---------------------+------------+
   | **setBanTimeExtra** |            |
   +---------------------+------------+

   property actions

      Actions object used to manage actions for jail.

   property database

      The database used to store persistent data for the jail.

   property filter

      The filter which the jail is using to monitor log files.

   getBanTimeExtra(opt=None)

   getFailTicket()

      Get a fail ticket from the jail.

      Used by actions to get a failure for banning.

   getMaxBanTime()

      Returns max possible ban-time of jail.

   property hasFailTickets

      Retrieve whether queue has tickets to ban.

   property idle

      A boolean indicating whether jail is idle.

   isAlive()

      Check jail "isAlive" by checking filter and actions threads.

   property name

      Name of jail.

   putFailTicket(ticket)

      Add a fail ticket to the jail.

      Used by filter to add a failure for banning.

   restoreCurrentBans(correctBanTime=True)

      Restore any previous valid bans from the database.

   setBanTimeExtra(opt, value)

   start()

      Start the jail, by starting filter and actions threads.

      Once stated, also queries the persistent database to reinstate
      any valid bans.

   status(flavor='basic')

      The status of the jail.

   stop(stop=True, join=True)

      Stop the jail, by stopping filter and actions threads.
