summaryrefslogtreecommitdiff
path: root/src/mod_fail2ban.erl
diff options
context:
space:
mode:
authorEvgeny Khramtsov <ekhramtsov@process-one.net>2020-01-08 12:24:51 +0300
committerEvgeny Khramtsov <ekhramtsov@process-one.net>2020-01-08 12:24:51 +0300
commit97da380acd8e3ba0c9a9618a99c4106eca1d1576 (patch)
treecc2b8fb7e175afcaf182a3595735f6f9177ec3dc /src/mod_fail2ban.erl
parentUpdate deps (diff)
Generate ejabberd.yml.5 man page from source code directly
Several documentation callbacks (doc/0 and mod_doc/0) are implemented and `ejabberdctl man` command is added to generate a man page. Note that the command requires a2x to be installed (which is a part of asciidoc package).
Diffstat (limited to 'src/mod_fail2ban.erl')
-rw-r--r--src/mod_fail2ban.erl32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/mod_fail2ban.erl b/src/mod_fail2ban.erl
index 0d2473c1..6492501d 100644
--- a/src/mod_fail2ban.erl
+++ b/src/mod_fail2ban.erl
@@ -34,7 +34,7 @@
-export([init/1, handle_call/3, handle_cast/2,
handle_info/2, terminate/2, code_change/3,
- mod_opt_type/1, mod_options/1, depends/2]).
+ mod_opt_type/1, mod_options/1, depends/2, mod_doc/0]).
%% ejabberd command.
-export([get_commands_spec/0, unban/1]).
@@ -254,3 +254,33 @@ mod_options(_Host) ->
[{access, none},
{c2s_auth_ban_lifetime, timer:hours(1)},
{c2s_max_auth_failures, 20}].
+
+mod_doc() ->
+ #{desc =>
+ [?T("The module bans IPs that show the malicious signs. "
+ "Currently only C2S authentication failures are detected."), "",
+ ?T("Unlike the standalone program, 'mod_fail2ban' clears the "
+ "record of authentication failures after some time since the "
+ "first failure or on a successful authentication. "
+ "It also does not simply block network traffic, but "
+ "provides the client with a descriptive error message.")],
+ opts =>
+ [{access,
+ #{value => ?T("AccessName"),
+ desc =>
+ ?T("Specify an access rule for whitelisting IP "
+ "addresses or networks. If the rule returns 'allow' "
+ "for a given IP address, that address will never be "
+ "banned. The 'AccessName' should be of type 'ip'. "
+ "The default value is 'none'.")}},
+ {c2s_auth_ban_lifetime,
+ #{value => "timeout()",
+ desc =>
+ ?T("The lifetime of the IP ban caused by too many "
+ "C2S authentication failures. The default value is "
+ "'1' hour.")}},
+ {c2s_max_auth_failures,
+ #{value => ?T("Number"),
+ desc =>
+ ?T("The number of C2S authentication failures to "
+ "trigger the IP ban. The default value is '20'.")}}]}.