Matthias Andreas Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame] | 1 | <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 Benkard | 12a5735 | 2021-12-28 18:02:04 +0100 | [diff] [blame] | 10 | <form class="form" data-id="f2b" role="form" method="post"> |
Matthias Andreas Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame] | 11 | <div class="mb-4"> |
Matthias Andreas Benkard | 12a5735 | 2021-12-28 18:02:04 +0100 | [diff] [blame] | 12 | <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 Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame] | 15 | <div class="mb-4"> |
Matthias Andreas Benkard | 12a5735 | 2021-12-28 18:02:04 +0100 | [diff] [blame] | 16 | <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 Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame] | 19 | <div class="mb-4"> |
Matthias Andreas Benkard | 12a5735 | 2021-12-28 18:02:04 +0100 | [diff] [blame] | 20 | <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 Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame] | 23 | <div class="mb-4"> |
Matthias Andreas Benkard | 12a5735 | 2021-12-28 18:02:04 +0100 | [diff] [blame] | 24 | <label for="f2b_netban_ipv4">{{ lang.admin.f2b_netban_ipv4 }}:</label> |
| 25 | <div class="input-group"> |
Matthias Andreas Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame] | 26 | <span class="input-group-text">/</span> |
Matthias Andreas Benkard | 12a5735 | 2021-12-28 18:02:04 +0100 | [diff] [blame] | 27 | <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 Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame] | 30 | <div class="mb-4"> |
Matthias Andreas Benkard | 12a5735 | 2021-12-28 18:02:04 +0100 | [diff] [blame] | 31 | <label for="f2b_netban_ipv6">{{ lang.admin.f2b_netban_ipv6 }}:</label> |
| 32 | <div class="input-group"> |
Matthias Andreas Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame] | 33 | <span class="input-group-text">/</span> |
Matthias Andreas Benkard | 12a5735 | 2021-12-28 18:02:04 +0100 | [diff] [blame] | 34 | <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 Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame] | 38 | <p class="text-muted">{{ lang.admin.f2b_list_info|raw }}</p> |
| 39 | <div class="mb-2"> |
Matthias Andreas Benkard | 12a5735 | 2021-12-28 18:02:04 +0100 | [diff] [blame] | 40 | <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 Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame] | 43 | <div class="mb-4"> |
Matthias Andreas Benkard | 12a5735 | 2021-12-28 18:02:04 +0100 | [diff] [blame] | 44 | <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 Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame] | 48 | <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 Benkard | 12a5735 | 2021-12-28 18:02:04 +0100 | [diff] [blame] | 50 | </div> |
| 51 | </form> |
Matthias Andreas Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame] | 52 | <legend data-bs-target="#f2b_regex_filters" style="margin-top:40px;cursor:pointer" unselectable="on" data-bs-toggle="collapse"> |
Matthias Andreas Benkard | 12a5735 | 2021-12-28 18:02:04 +0100 | [diff] [blame] | 53 | <i style="font-size:10pt;" class="bi bi-plus-square"></i> {{ lang.admin.f2b_filter }} |
| 54 | </legend> |
Matthias Andreas Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame] | 55 | <hr /> |
Matthias Andreas Benkard | 12a5735 | 2021-12-28 18:02:04 +0100 | [diff] [blame] | 56 | <div id="f2b_regex_filters" class="collapse"> |
Matthias Andreas Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame] | 57 | <p class="text-muted">{{ lang.admin.f2b_regex_info }}</p> |
Matthias Andreas Benkard | 12a5735 | 2021-12-28 18:02:04 +0100 | [diff] [blame] | 58 | <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"> </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 Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame] | 69 | <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 Benkard | 12a5735 | 2021-12-28 18:02:04 +0100 | [diff] [blame] | 70 | </tr> |
| 71 | {% endfor %} |
| 72 | </table> |
| 73 | <p><div class="btn-group"> |
Matthias Andreas Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame] | 74 | <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 Benkard | 12a5735 | 2021-12-28 18:02:04 +0100 | [diff] [blame] | 77 | </div></p> |
| 78 | </form> |
| 79 | </div> |
| 80 | |
Matthias Andreas Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame] | 81 | <p class="text-muted">{{ lang.admin.ban_list_info|raw }}</p> |
Matthias Andreas Benkard | 12a5735 | 2021-12-28 18:02:04 +0100 | [diff] [blame] | 82 | {% 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 Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame] | 87 | <span class="badge fs-5 bg-info" style="padding:4px;font-size:85%;"> |
Matthias Andreas Benkard | 12a5735 | 2021-12-28 18:02:04 +0100 | [diff] [blame] | 88 | <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 Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame] | 106 | <span class="badge fs-5 bg-danger" style="padding: 0.1em 0.4em 0.1em;"> |
Matthias Andreas Benkard | 12a5735 | 2021-12-28 18:02:04 +0100 | [diff] [blame] | 107 | <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> |