Difference between revisions of "FEATURE Client Server"

From Fail2ban
Jump to: navigation, search
(Oops... Wrong page)
Line 9: Line 9:
  
 
The ''Server'' part monitors log file(s) and executes actions when a host has to be banned. The configuration of the ''Server'' is done by the ''Client'' which take care of reading configuration files. Communication between the ''Client'' and the ''Server'' is done through a socket. A protocol is defined. This allows dynamic reconfiguration of the ''Server'' and communication with it in order to retrieves, per example, statistics.
 
The ''Server'' part monitors log file(s) and executes actions when a host has to be banned. The configuration of the ''Server'' is done by the ''Client'' which take care of reading configuration files. Communication between the ''Client'' and the ''Server'' is done through a socket. A protocol is defined. This allows dynamic reconfiguration of the ''Server'' and communication with it in order to retrieves, per example, statistics.
 +
 +
== Protocol ==
 +
 +
* Commands are serialized before sending. Every command must end with the string <tt><F2B_END_COMMAND></tt> which is used to detect the end of a command. The flag <tt><F2B_END_COMMAND></tt> is added '''at the end''' of the serialized string.
 +
* Everytime a command is sent to ''Server'', this reply with the status of the executed command.
 +
 +
 +
Commands are splitted into several categories:
 +
 +
=== General ===
 +
 +
{| style="border-top:1px solid black; border-right:1px solid black; border-bottom:1px solid black; border-left:1px solid black; font-family:courier" cellspacing="0" cellpadding="4"
 +
| add || <Jail> || style="width:100%; border-left:1px solid black; font-family:helvetica" | Create a new ''Jail''
 +
|-
 +
| start || <Jail> || style="width:100%; border-left:1px solid black; font-family:helvetica" | Start the ''Jail''
 +
|-
 +
| stop || <Jail> || style="width:100%; border-left:1px solid black; font-family:helvetica" | Stop the ''Jail''
 +
|-
 +
| quit ||  || style="width:100%; border-left:1px solid black; font-family:helvetica" | Quit the daemon
 +
|}
 +
 +
=== Set ===
 +
 +
==== Logging ====
 +
 +
{| style="border-top:1px solid black; border-right:1px solid black; border-bottom:1px solid black; border-left:1px solid black; font-family:courier" cellspacing="0" cellpadding="4"
 +
| set || loglevel || <value> || style="width:100%; border-left:1px solid black; font-family:helvetica" | Set the log level to the ''value''
 +
|}
 +
 +
==== Jail ====
 +
 +
{| style="border-top:1px solid black; border-right:1px solid black; border-bottom:1px solid black; border-left:1px solid black; font-family:courier" cellspacing="0" cellpadding="4"
 +
| set || <Jail> || idle || <value> || style="width:100%; border-left:1px solid black; font-family:helvetica" | Set the ''Jail'' idle flag to ''value'' (on|off)
 +
|}
 +
 +
==== Filter ====
 +
 +
{| style="border-top:1px solid black; border-right:1px solid black; border-bottom:1px solid black; border-left:1px solid black; font-family:courier" cellspacing="0" cellpadding="4"
 +
| set || <jail> || logpath || <value> || style="width:100%; border-left:1px solid black; font-family:helvetica" | Set the path ''value'' of the log file for ''Jail''
 +
|-
 +
| set || <jail> || timeregex || <value> || style="width:100%; border-left:1px solid black; font-family:helvetica" | Set the regular expression ''value'' matching the date format for ''Jail''
 +
|}
 +
 +
==== Action ====
 +
 +
=== Get ===
 +
 +
==== Logging ====
 +
 +
==== Filter ====
 +
 +
==== Action ====
 +
 +
=== Status ===
  
 
[[Category:Feature]]
 
[[Category:Feature]]

Revision as of 12:52, 17 May 2006

Client/Server architecture

Until version 0.6, Fail2ban daemon is simply an application running in background and detached from any terminal. It do not allow reconfiguration of the daemon while it runs or any quite of communication with it.

Fail2ban is split into two parts:

  • Server
  • Client

The Server part monitors log file(s) and executes actions when a host has to be banned. The configuration of the Server is done by the Client which take care of reading configuration files. Communication between the Client and the Server is done through a socket. A protocol is defined. This allows dynamic reconfiguration of the Server and communication with it in order to retrieves, per example, statistics.

Protocol

  • Commands are serialized before sending. Every command must end with the string <F2B_END_COMMAND> which is used to detect the end of a command. The flag <F2B_END_COMMAND> is added at the end of the serialized string.
  • Everytime a command is sent to Server, this reply with the status of the executed command.


Commands are splitted into several categories:

General

add <Jail> Create a new Jail
start <Jail> Start the Jail
stop <Jail> Stop the Jail
quit Quit the daemon

Set

Logging

set loglevel <value> Set the log level to the value

Jail

set <Jail> idle <value> Set the Jail idle flag to value (on|off)

Filter

set <jail> logpath <value> Set the path value of the log file for Jail
set <jail> timeregex <value> Set the regular expression value matching the date format for Jail

Action

Get

Logging

Filter

Action

Status