TODO: This is a dkim hack

This commit is contained in:
2025-09-25 09:40:40 +02:00
parent 3630f82817
commit 7566def0d1

View File

@@ -22,7 +22,6 @@
* @author Froxlor team <team@froxlor.org>
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
*/
namespace Froxlor\Dns;
use Froxlor\Database\Database;
@@ -523,7 +522,7 @@ class Dns
* @param array $domain
* @return array
*/
private static function generateDkimEntries(array $domain): array
/** private static function generateDkimEntries(array $domain): array
{
$zone_dkim = [];
@@ -569,7 +568,20 @@ class Dns
}
return $zone_dkim;
}
} */
private static function generateDkimEntries(array $domain): array
{
$zone_dkim = [];
if (Settings::Get('dkim.use_dkim') == '1' && $domain['dkim'] == '1' && $domain['dkim_pubkey'] != '') {
// start
$dkim_txt = '("v=DKIM1;k=rsa;p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAosq0CmLqEzJJxIHkQwG1Xwk6CSyHHWSDXL9BHCKzY9lJXH7a23PogVlLvUBYaAg"
"BtFOpsKuUCBl+/g6rOqgVXKg0OpYdpgTxZyz1i4NcubGFLifQGnF8ZKpIEDqIzmLI6SbH+9DKwYA319sXAR6feZI4g5bWqF07t/kzA5LN+2V5QnDQ3th++GPRl5rmW"
"F6uoidIRD85UZVEX4s3J1hce0k6tRb2aEozCJaSXHUwyarmbbX/5rky467QQ+45Uy0q9CNaMMu1IX5eybhLRxYXK1k0TfIRJv4FH1UFLlq2QoGC7d+KvLrUabhzQ5w"
"bdZkWuVgLFZ7CL2NegfzO6YeEcQIDAQAB")';
$zone_dkim[] = $dkim_txt;
}
return $zone_dkim;
}
/**
* @param string $txt_content
@@ -577,35 +589,35 @@ class Dns
* @return string
*/
public static function encloseTXTContent(string $txt_content, bool $isMultiLine = false): string
{
// check that TXT content is enclosed in " "
if (!$isMultiLine && Settings::Get('system.dns_server') != 'PowerDNS') {
if (substr($txt_content, 0, 1) != '"') {
$txt_content = '"' . $txt_content;
}
if (substr($txt_content, -1) != '"') {
$txt_content .= '"';
}
}
if (Settings::Get('system.dns_server') == 'PowerDNS') {
// no quotation for PowerDNS
if (substr($txt_content, 0, 1) == '"') {
$txt_content = substr($txt_content, 1);
}
if (substr($txt_content, -1) == '"') {
$txt_content = substr($txt_content, 0, -1);
}
}
return $txt_content;
}
{
// check that TXT content is enclosed in " "
if (! $isMultiLine && Settings::Get('system.dns_server') != 'PowerDNS') {
if (substr($txt_content, 0, 1) != '"') {
$txt_content = '"' . $txt_content;
}
if (substr($txt_content, - 1) != '"') {
$txt_content .= '"';
}
}
if (Settings::Get('system.dns_server') == 'PowerDNS') {
// no quotation for PowerDNS
if (substr($txt_content, 0, 1) == '"') {
$txt_content = substr($txt_content, 1);
}
if (substr($txt_content, - 1) == '"') {
$txt_content = substr($txt_content, 0, - 1);
}
}
return $txt_content;
}
/**
* @param string $email
* @return string
*/
private static function escapeSoaAdminMail(string $email): string
{
$mail_parts = explode("@", $email);
return str_replace(".", "\.", $mail_parts[0]) . "." . $mail_parts[1] . ".";
}
{
$mail_parts = explode("@", $email);
return str_replace(".", "\.", $mail_parts[0]) . "." . $mail_parts[1] . ".";
}
}