From bca4e1a03d7a36b81a7e0b2399db3bbe932dc88c Mon Sep 17 00:00:00 2001 From: Niklas Meyer <niklas.meyer@servercow.de> Date: Mon, 11 Nov 2024 16:50:14 +0100 Subject: [PATCH 1/2] update.sh: precaution ask for deletion of dns_blocklists.cf if old format (#6154) --- update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update.sh b/update.sh index 3afe623c2..a388d1a25 100755 --- a/update.sh +++ b/update.sh @@ -299,7 +299,7 @@ fix_broken_dnslist_conf() { echo -e "\e[35mOk, not deleting it! Please make sure you take a look at postfix upon start then..." return 2 fi - fi + fi } From 852d944cfba4c06dcc3af44d698f68c25425a07c Mon Sep 17 00:00:00 2001 From: FreddleSpl0it <patschul@posteo.de> Date: Thu, 4 Apr 2024 16:27:48 +0200 Subject: [PATCH 2/2] [Web] remove f2b banlist from json_api.php --- data/web/admin.php | 2 +- data/web/f2b-banlist.php | 11 +++++++++++ data/web/json_api.php | 14 -------------- data/web/templates/admin/tab-config-f2b.twig | 2 +- 4 files changed, 13 insertions(+), 16 deletions(-) create mode 100644 data/web/f2b-banlist.php diff --git a/data/web/admin.php b/data/web/admin.php index 5dd7b3c6b..f03e52e76 100644 --- a/data/web/admin.php +++ b/data/web/admin.php @@ -104,7 +104,7 @@ $template_data = [ 'all_domains' => $all_domains, 'mailboxes' => $mailboxes, 'f2b_data' => $f2b_data, - 'f2b_banlist_url' => getBaseUrl() . "/api/v1/get/fail2ban/banlist/" . $f2b_data['banlist_id'], + 'f2b_banlist_url' => getBaseUrl() . "/f2b-banlist?id=" . $f2b_data['banlist_id'], 'q_data' => quarantine('settings'), 'qn_data' => quota_notification('get'), 'pw_reset_data' => reset_password('get_notification'), diff --git a/data/web/f2b-banlist.php b/data/web/f2b-banlist.php new file mode 100644 index 000000000..05c769907 --- /dev/null +++ b/data/web/f2b-banlist.php @@ -0,0 +1,11 @@ +<?php + +require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/prerequisites.inc.php'; + +if (isset($_GET['id'])) { + header('Content-Type: text/plain'); + echo fail2ban('banlist', 'get', $_GET['id']); +} else { + header('HTTP/1.1 404 Not Found'); + exit; +} diff --git a/data/web/json_api.php b/data/web/json_api.php index 66054e6d3..86ab21c60 100644 --- a/data/web/json_api.php +++ b/data/web/json_api.php @@ -510,16 +510,6 @@ if (isset($_GET['query'])) { $_SESSION['challenge'] = $WebAuthn->getChallenge(); return; break; - case "fail2ban": - if (!isset($_SESSION['mailcow_cc_role'])){ - switch ($object) { - case 'banlist': - header('Content-Type: text/plain'); - echo fail2ban('banlist', 'get', $extra); - break; - } - } - break; } if (isset($_SESSION['mailcow_cc_role'])) { switch ($category) { @@ -1420,10 +1410,6 @@ if (isset($_GET['query'])) { break; case "fail2ban": switch ($object) { - case 'banlist': - header('Content-Type: text/plain'); - echo fail2ban('banlist', 'get', $extra); - break; default: $data = fail2ban('get'); process_get_return($data); diff --git a/data/web/templates/admin/tab-config-f2b.twig b/data/web/templates/admin/tab-config-f2b.twig index bb4a2e85a..75c626641 100644 --- a/data/web/templates/admin/tab-config-f2b.twig +++ b/data/web/templates/admin/tab-config-f2b.twig @@ -99,7 +99,7 @@ {% endif %} <form class="form-inline" data-id="f2b_banlist" role="form" method="post"> <div class="input-group mb-3"> - <input type="text" class="form-control" aria-label="Banlist url" value="{{ f2b_banlist_url}}" id="banlist_url"> + <input type="text" class="form-control" aria-label="Banlist url" value="{{ f2b_banlist_url }}" id="banlist_url"> {% if is_https %} <button class="btn btn-secondary" type="button" onclick="copyToClipboard('banlist_url')"><i class="bi bi-clipboard"></i></button> {% endif %}