blob: bbd3e36727d725e6fffdc9853091d1e910bae7eb [file] [log] [blame]
Matthias Andreas Benkard1ba53812022-12-27 17:32:58 +01001<div role="tabpanel" class="tab-pane fade" id="tab-config-f2b" role="tabpanel" aria-labelledby="tab-config-f2b">
2 <div class="card mb-4">
3 <div class="card-header d-flex fs-5">
4 <button class="btn d-md-none flex-grow-1 text-start" data-bs-target="#collapse-tab-config-f2b" data-bs-toggle="collapse" aria-controls="ollapse-tab-config-f2b">
5 {{ lang.admin.f2b_parameters }}
6 </button>
7 <span class="d-none d-md-block">{{ lang.admin.f2b_parameters }}</span>
8 </div>
9 <div id="collapse-tab-config-f2b" class="card-body collapse" data-bs-parent="#admin-content">
Matthias Andreas Benkard12a57352021-12-28 18:02:04 +010010 <form class="form" data-id="f2b" role="form" method="post">
Matthias Andreas Benkard1ba53812022-12-27 17:32:58 +010011 <div class="mb-4">
Matthias Andreas Benkard12a57352021-12-28 18:02:04 +010012 <label for="f2b_ban_time">{{ lang.admin.f2b_ban_time }}:</label>
13 <input type="number" class="form-control" id="f2b_ban_time" name="ban_time" value="{{ f2b_data.ban_time }}" required>
14 </div>
Matthias Andreas Benkard1ba53812022-12-27 17:32:58 +010015 <div class="mb-4">
Matthias Andreas Benkard12a57352021-12-28 18:02:04 +010016 <label for="f2b_max_attempts">{{ lang.admin.f2b_max_attempts }}:</label>
17 <input type="number" class="form-control" id="f2b_max_attempts" name="max_attempts" value="{{ f2b_data.max_attempts }}" required>
18 </div>
Matthias Andreas Benkard1ba53812022-12-27 17:32:58 +010019 <div class="mb-4">
Matthias Andreas Benkard12a57352021-12-28 18:02:04 +010020 <label for="f2b_retry_window">{{ lang.admin.f2b_retry_window }}:</label>
21 <input type="number" class="form-control" id="f2b_retry_window" name="retry_window" value="{{ f2b_data.retry_window }}" required>
22 </div>
Matthias Andreas Benkard1ba53812022-12-27 17:32:58 +010023 <div class="mb-4">
Matthias Andreas Benkard12a57352021-12-28 18:02:04 +010024 <label for="f2b_netban_ipv4">{{ lang.admin.f2b_netban_ipv4 }}:</label>
25 <div class="input-group">
Matthias Andreas Benkard1ba53812022-12-27 17:32:58 +010026 <span class="input-group-text">/</span>
Matthias Andreas Benkard12a57352021-12-28 18:02:04 +010027 <input type="number" class="form-control" id="f2b_netban_ipv4" name="netban_ipv4" value="{{ f2b_data.netban_ipv4 }}" required>
28 </div>
29 </div>
Matthias Andreas Benkard1ba53812022-12-27 17:32:58 +010030 <div class="mb-4">
Matthias Andreas Benkard12a57352021-12-28 18:02:04 +010031 <label for="f2b_netban_ipv6">{{ lang.admin.f2b_netban_ipv6 }}:</label>
32 <div class="input-group">
Matthias Andreas Benkard1ba53812022-12-27 17:32:58 +010033 <span class="input-group-text">/</span>
Matthias Andreas Benkard12a57352021-12-28 18:02:04 +010034 <input type="number" class="form-control" id="f2b_netban_ipv6" name="netban_ipv6" value="{{ f2b_data.netban_ipv6 }}" required>
35 </div>
36 </div>
37 <hr>
Matthias Andreas Benkard1ba53812022-12-27 17:32:58 +010038 <p class="text-muted">{{ lang.admin.f2b_list_info|raw }}</p>
39 <div class="mb-2">
Matthias Andreas Benkard12a57352021-12-28 18:02:04 +010040 <label for="f2b_whitelist">{{ lang.admin.f2b_whitelist }}:</label>
41 <textarea class="form-control" id="f2b_whitelist" name="whitelist" rows="5">{{ f2b_data.whitelist }}</textarea>
42 </div>
Matthias Andreas Benkard1ba53812022-12-27 17:32:58 +010043 <div class="mb-4">
Matthias Andreas Benkard12a57352021-12-28 18:02:04 +010044 <label for="f2b_blacklist">{{ lang.admin.f2b_blacklist }}:</label>
45 <textarea class="form-control" id="f2b_blacklist" name="blacklist" rows="5">{{ f2b_data.blacklist }}</textarea>
46 </div>
47 <div class="btn-group">
Matthias Andreas Benkard1ba53812022-12-27 17:32:58 +010048 <button class="btn btn-sm btn-xs-half d-block d-sm-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>
49 <a href="#" role="button" class="btn btn-sm btn-xs-half d-block d-sm-inline btn-secondary" data-bs-toggle="modal" data-container="netfilter-mailcow" data-bs-target="#RestartContainer"><i class="bi bi-arrow-repeat"></i> {{ lang.header.restart_netfilter }}</a>
Matthias Andreas Benkard12a57352021-12-28 18:02:04 +010050 </div>
51 </form>
Matthias Andreas Benkard1ba53812022-12-27 17:32:58 +010052 <legend data-bs-target="#f2b_regex_filters" style="margin-top:40px;cursor:pointer" unselectable="on" data-bs-toggle="collapse">
Matthias Andreas Benkard12a57352021-12-28 18:02:04 +010053 <i style="font-size:10pt;" class="bi bi-plus-square"></i> {{ lang.admin.f2b_filter }}
54 </legend>
Matthias Andreas Benkard1ba53812022-12-27 17:32:58 +010055 <hr />
Matthias Andreas Benkard12a57352021-12-28 18:02:04 +010056 <div id="f2b_regex_filters" class="collapse">
Matthias Andreas Benkard1ba53812022-12-27 17:32:58 +010057 <p class="text-muted">{{ lang.admin.f2b_regex_info }}</p>
Matthias Andreas Benkard12a57352021-12-28 18:02:04 +010058 <form class="form-inline" data-id="f2b_regex" role="form" method="post">
59 <table class="table table-condensed" id="f2b_regex_table">
60 <tr>
61 <th width="50px">ID</th>
62 <th>RegExp</th>
63 <th width="100px">&nbsp;</th>
64 </tr>
65 {% for regex_id, regex_val in f2b_data.regex %}
66 <tr>
67 <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>
68 <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>
Matthias Andreas Benkard1ba53812022-12-27 17:32:58 +010069 <td><a href="#" role="button" class="btn btn-sm btn-xs-lg btn-secondary h-100 w-100" type="button">{{ lang.admin.remove_row }}</a></td>
Matthias Andreas Benkard12a57352021-12-28 18:02:04 +010070 </tr>
71 {% endfor %}
72 </table>
73 <p><div class="btn-group">
Matthias Andreas Benkard1ba53812022-12-27 17:32:58 +010074 <button class="btn btn-sm btn-xs-half d-block d-sm-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>
75 <button class="btn btn-sm btn-xs-half d-block d-sm-inline btn-secondary 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>
76 <button class="btn btn-sm d-block d-sm-inline btn-secondary" type="button" id="add_f2b_regex_row"><i class="bi bi-plus-lg"></i> {{ lang.admin.add_row }}</button>
Matthias Andreas Benkard12a57352021-12-28 18:02:04 +010077 </div></p>
78 </form>
79 </div>
80
Matthias Andreas Benkard1ba53812022-12-27 17:32:58 +010081 <p class="text-muted">{{ lang.admin.ban_list_info|raw }}</p>
Matthias Andreas Benkard12a57352021-12-28 18:02:04 +010082 {% if not f2b_data.active_bans and not f2b_data.perm_bans %}
83 <i>{{ lang.admin.no_active_bans }}</i>
84 {% endif %}
85 {% for active_ban in f2b_data.active_bans %}
86 <p>
Matthias Andreas Benkard1ba53812022-12-27 17:32:58 +010087 <span class="badge fs-5 bg-info" style="padding:4px;font-size:85%;">
Matthias Andreas Benkard12a57352021-12-28 18:02:04 +010088 <i class="bi bi-funnel-fill"></i>
89 <a href="https://bgp.he.net/ip/{{ active_ban.ip }}" target="_blank" style="color:white">
90 {{ active_ban.network }}
91 </a>
92 ({{ active_ban.banned_until }}) -
93 {% if active_ban.queued_for_unban == 0 %}
94 <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>
95 <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>
96 <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>
97 {% else %}
98 <i>{{ lang.admin.unban_pending }}</i>
99 {% endif %}
100 </span>
101 </p>
102 {% endfor %}
103 <hr>
104 {% for perm_ban in f2b_data.perm_bans %}
105 <p>
Matthias Andreas Benkard1ba53812022-12-27 17:32:58 +0100106 <span class="badge fs-5 bg-danger" style="padding: 0.1em 0.4em 0.1em;">
Matthias Andreas Benkard12a57352021-12-28 18:02:04 +0100107 <i class="bi bi-funnel-fill"></i>
108 <a href="https://bgp.he.net/ip/{{ perm_ban.ip }}" target="_blank" style="color:white">
109 {{ perm_ban.network }}
110 </a>
111 </span>
112 </p>
113 {% endfor %}
114 </div>
115 </div>
116</div>