blob: 5c4c2a24cf868daca477edaf9c349622d775592d [file] [log] [blame]
Matthias Andreas Benkard12a57352021-12-28 18:02:04 +01001<div role="tabpanel" class="tab-pane" id="tab-config-f2b">
2 <div class="panel panel-default">
3 <div class="panel-heading">{{ lang.admin.f2b_parameters }}</div>
4 <div class="panel-body">
5 <form class="form" data-id="f2b" role="form" method="post">
6 <div class="form-group">
7 <label for="f2b_ban_time">{{ lang.admin.f2b_ban_time }}:</label>
8 <input type="number" class="form-control" id="f2b_ban_time" name="ban_time" value="{{ f2b_data.ban_time }}" required>
9 </div>
10 <div class="form-group">
11 <label for="f2b_max_attempts">{{ lang.admin.f2b_max_attempts }}:</label>
12 <input type="number" class="form-control" id="f2b_max_attempts" name="max_attempts" value="{{ f2b_data.max_attempts }}" required>
13 </div>
14 <div class="form-group">
15 <label for="f2b_retry_window">{{ lang.admin.f2b_retry_window }}:</label>
16 <input type="number" class="form-control" id="f2b_retry_window" name="retry_window" value="{{ f2b_data.retry_window }}" required>
17 </div>
18 <div class="form-group">
19 <label for="f2b_netban_ipv4">{{ lang.admin.f2b_netban_ipv4 }}:</label>
20 <div class="input-group">
21 <span class="input-group-addon">/</span>
22 <input type="number" class="form-control" id="f2b_netban_ipv4" name="netban_ipv4" value="{{ f2b_data.netban_ipv4 }}" required>
23 </div>
24 </div>
25 <div class="form-group">
26 <label for="f2b_netban_ipv6">{{ lang.admin.f2b_netban_ipv6 }}:</label>
27 <div class="input-group">
28 <span class="input-group-addon">/</span>
29 <input type="number" class="form-control" id="f2b_netban_ipv6" name="netban_ipv6" value="{{ f2b_data.netban_ipv6 }}" required>
30 </div>
31 </div>
32 <hr>
33 <p class="help-block">{{ lang.admin.f2b_list_info|raw }}</p>
34 <div class="form-group">
35 <label for="f2b_whitelist">{{ lang.admin.f2b_whitelist }}:</label>
36 <textarea class="form-control" id="f2b_whitelist" name="whitelist" rows="5">{{ f2b_data.whitelist }}</textarea>
37 </div>
38 <div class="form-group">
39 <label for="f2b_blacklist">{{ lang.admin.f2b_blacklist }}:</label>
40 <textarea class="form-control" id="f2b_blacklist" name="blacklist" rows="5">{{ f2b_data.blacklist }}</textarea>
41 </div>
42 <div class="btn-group">
43 <button class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success" data-action="edit_selected" data-item="self" data-id="f2b" data-api-url='edit/fail2ban' data-api-attr='{}' href="#"><i class="bi bi-check-lg"></i> {{ lang.admin.save }}</button>
44 <a href="#" role="button" class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default" data-toggle="modal" data-container="netfilter-mailcow" data-target="#RestartContainer"><i class="bi bi-arrow-repeat"></i> {{ lang.header.restart_netfilter }}</a>
45 <div class="clearfix visible-xs"></div>
46 </div>
47 </form>
48 <legend data-target="#f2b_regex_filters" style="margin-top:40px;cursor:pointer" unselectable="on" data-toggle="collapse">
49 <i style="font-size:10pt;" class="bi bi-plus-square"></i> {{ lang.admin.f2b_filter }}
50 </legend>
51 <div id="f2b_regex_filters" class="collapse">
52 <p class="help-block">{{ lang.admin.f2b_regex_info }}</p>
53 <form class="form-inline" data-id="f2b_regex" role="form" method="post">
54 <table class="table table-condensed" id="f2b_regex_table">
55 <tr>
56 <th width="50px">ID</th>
57 <th>RegExp</th>
58 <th width="100px">&nbsp;</th>
59 </tr>
60 {% for regex_id, regex_val in f2b_data.regex %}
61 <tr>
62 <td><input disabled class="input-sm input-xs-lg form-control" style="text-align:center" data-id="f2b_regex" type="text" name="app" required value="{{ regex_id }}"></td>
63 <td><input class="input-sm input-xs-lg form-control regex-input" data-id="f2b_regex" type="text" name="regex" required value="{{ regex_val }}"></td>
64 <td><a href="#" role="button" class="btn btn-xs btn-xs-lg btn-default" type="button">{{ lang.admin.remove_row }}</a></td>
65 </tr>
66 {% endfor %}
67 </table>
68 <p><div class="btn-group">
69 <button class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-success" data-action="edit_selected" data-item="admin" data-id="f2b_regex" data-reload="no" data-api-url='edit/fail2ban' data-api-attr='{"action":"edit-regex"}' href="#"><i class="bi bi-check-lg"></i> {{ lang.admin.save }}</button>
70 <button class="btn btn-sm btn-xs-half visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default admin-ays-dialog" data-action="edit_selected" data-item="self" data-id="f2b-quick" data-api-url='edit/fail2ban' data-api-attr='{"action":"reset-regex"}' href="#">{{ lang.admin.reset_default }}</button>
71 <button class="btn btn-sm visible-xs-block visible-sm-inline visible-md-inline visible-lg-inline btn-default" type="button" id="add_f2b_regex_row"><i class="bi bi-plus-lg"></i> {{ lang.admin.add_row }}</button>
72 </div></p>
73 </form>
74 </div>
75
76 <p class="help-block">{{ lang.admin.ban_list_info|raw }}</p>
77 {% if not f2b_data.active_bans and not f2b_data.perm_bans %}
78 <i>{{ lang.admin.no_active_bans }}</i>
79 {% endif %}
80 {% for active_ban in f2b_data.active_bans %}
81 <p>
82 <span class="label label-info" style="padding:4px;font-size:85%;">
83 <i class="bi bi-funnel-fill"></i>
84 <a href="https://bgp.he.net/ip/{{ active_ban.ip }}" target="_blank" style="color:white">
85 {{ active_ban.network }}
86 </a>
87 ({{ active_ban.banned_until }}) -
88 {% if active_ban.queued_for_unban == 0 %}
89 <a data-action="edit_selected" data-item="{{ active_ban.network }}" data-id="f2b-quick" data-api-url='edit/fail2ban' data-api-attr='{"action":"unban"}' href="#">[{{ lang.admin.queue_unban }}]</a>
90 <a data-action="edit_selected" data-item="{{ active_ban.network }}" data-id="f2b-quick" data-api-url='edit/fail2ban' data-api-attr='{"action":"whitelist"}' href="#">[whitelist]</a>
91 <a data-action="edit_selected" data-item="{{ active_ban.network }}" data-id="f2b-quick" data-api-url='edit/fail2ban' data-api-attr='{"action":"blacklist"}' href="#">[blacklist (<b>needs restart</b>)]</a>
92 {% else %}
93 <i>{{ lang.admin.unban_pending }}</i>
94 {% endif %}
95 </span>
96 </p>
97 {% endfor %}
98 <hr>
99 {% for perm_ban in f2b_data.perm_bans %}
100 <p>
101 <span class="label label-danger" style="padding: 0.1em 0.4em 0.1em;">
102 <i class="bi bi-funnel-fill"></i>
103 <a href="https://bgp.he.net/ip/{{ perm_ban.ip }}" target="_blank" style="color:white">
104 {{ perm_ban.network }}
105 </a>
106 </span>
107 </p>
108 {% endfor %}
109 </div>
110 </div>
111</div>