From 47aed3add936ef1ec4c1ea64924af53d1093d6d6 Mon Sep 17 00:00:00 2001 From: boban Date: Fri, 17 Oct 2025 13:56:19 +0200 Subject: [PATCH] Domain Create Modal anpassen Fehler auf Null --- .../Ui/Domain/Modal/DomainDnsModal.php | 35 +++++++++++++------ 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/app/Livewire/Ui/Domain/Modal/DomainDnsModal.php b/app/Livewire/Ui/Domain/Modal/DomainDnsModal.php index 0a92fd4..8c4f07a 100644 --- a/app/Livewire/Ui/Domain/Modal/DomainDnsModal.php +++ b/app/Livewire/Ui/Domain/Modal/DomainDnsModal.php @@ -42,29 +42,33 @@ class DomainDnsModal extends ModalComponent $d = Domain::findOrFail($domainId); $this->domainName = $d->domain; + $tlsa = TlsaRecord::forServer() + ->where('service', '_25._tcp') + ->latest('id') + ->first(); + $ips = NetProbe::resolve(); $ipv4 = $ips['ipv4']; $ipv6 = $ips['ipv6']; $this->zone = $this->extractZone($d->domain); - $mta = env('MTA_SUB', 'mx') . '.' . $this->zone; // mx.example.com + $mta_sub = env('MTA_SUB'); + $base = env('BASE_DOMAIN'); + $mailServerFqdn = $mta_sub . '.' . $base; + $mta = $mta_sub . '.' . $this->zone; // --- Statische Infrastruktur (für alle Domains gleich) --- $this->static = [ - ['type' => 'A', 'name' => $mta, 'value' => $ipv4], - ['type' => 'PTR', 'name' => $this->ptrFromIPv4($ipv4), 'value' => $mta], + ['type' => 'MX', 'name' => $base, 'value' => "10 {$mailServerFqdn}."], + ['type' => 'A', 'name' => $mailServerFqdn, 'value' => $ipv4], + ['type' => 'PTR', 'name' => $this->ptrFromIPv4($ipv4), 'value' => $tlsa->host], ]; if ($ipv6) { - $this->static[] = ['type' => 'AAAA', 'name' => $mta, 'value' => $ipv6]; - $this->static[] = ['type' => 'PTR', 'name' => $this->ptrFromIPv6($ipv6), 'value' => $mta]; + $this->static[] = ['type' => 'AAAA', 'name' => $mailServerFqdn, 'value' => $ipv6]; + $this->static[] = ['type' => 'PTR', 'name' => $this->ptrFromIPv6($ipv6), 'value' => $mailServerFqdn]; } - $tlsa = TlsaRecord::forServer() - ->where('service', '_25._tcp') - ->latest('id') - ->first(); - if ($tlsa?->dns_string) { $this->static[] = [ 'type' => 'TLSA', @@ -86,12 +90,23 @@ class DomainDnsModal extends ModalComponent : ($dkim->public_key_txt ?? 'v=DKIM1; k=rsa; p='); $this->dynamic = [ + ['type' => 'CNAME', 'name' => "autoconfig.$this->domainName", 'value' => "$this->domainName."], + ['type' => 'CNAME', 'name' => "autodiscover.$this->domainName", 'value' => "$this->domainName."], + + // SRV Records für Autodiscover und Maildienste + ['type' => 'SRV', 'name' => "_autodiscover._tcp.$this->domainName", 'value' => "0 0 443 {$this->domainName}."], + ['type' => 'SRV', 'name' => "_imaps._tcp.$this->domainName", 'value' => "0 0 993 {$this->domainName}."], + ['type' => 'SRV', 'name' => "_pop3s._tcp.$this->domainName", 'value' => "0 0 995 {$this->domainName}."], + ['type' => 'SRV', 'name' => "_submission._tcp.$this->domainName", 'value' => "0 0 587 {$this->domainName}."], + + // TXT Records ['type' => 'TXT', 'name' => $this->domainName, 'value' => $spf, 'helpLabel' => 'SPF Record Syntax', 'helpUrl' => 'http://www.open-spf.org/SPF_Record_Syntax/'], ['type' => 'TXT', 'name' => "_dmarc.{$this->domainName}", 'value' => $dmarc, 'helpLabel' => 'DMARC Assistant', 'helpUrl' => 'https://www.kitterman.com/dmarc/assistant.html'], ['type' => 'TXT', 'name' => $dkimHost, 'value' => $dkimTxt, 'helpLabel' => 'DKIM Inspector', 'helpUrl' => 'https://dkimvalidator.com/'], ]; } + private function extractZone(string $fqdn): string { $fqdn = strtolower(trim($fqdn, "."));