Domain Create Modal anpassen Fehler auf Null

main
boban 2025-10-17 13:56:19 +02:00
parent b85a01415c
commit 47aed3add9
1 changed files with 25 additions and 10 deletions

View File

@ -42,29 +42,33 @@ class DomainDnsModal extends ModalComponent
$d = Domain::findOrFail($domainId); $d = Domain::findOrFail($domainId);
$this->domainName = $d->domain; $this->domainName = $d->domain;
$tlsa = TlsaRecord::forServer()
->where('service', '_25._tcp')
->latest('id')
->first();
$ips = NetProbe::resolve(); $ips = NetProbe::resolve();
$ipv4 = $ips['ipv4']; $ipv4 = $ips['ipv4'];
$ipv6 = $ips['ipv6']; $ipv6 = $ips['ipv6'];
$this->zone = $this->extractZone($d->domain); $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) --- // --- Statische Infrastruktur (für alle Domains gleich) ---
$this->static = [ $this->static = [
['type' => 'A', 'name' => $mta, 'value' => $ipv4], ['type' => 'MX', 'name' => $base, 'value' => "10 {$mailServerFqdn}."],
['type' => 'PTR', 'name' => $this->ptrFromIPv4($ipv4), 'value' => $mta], ['type' => 'A', 'name' => $mailServerFqdn, 'value' => $ipv4],
['type' => 'PTR', 'name' => $this->ptrFromIPv4($ipv4), 'value' => $tlsa->host],
]; ];
if ($ipv6) { if ($ipv6) {
$this->static[] = ['type' => 'AAAA', 'name' => $mta, 'value' => $ipv6]; $this->static[] = ['type' => 'AAAA', 'name' => $mailServerFqdn, 'value' => $ipv6];
$this->static[] = ['type' => 'PTR', 'name' => $this->ptrFromIPv6($ipv6), 'value' => $mta]; $this->static[] = ['type' => 'PTR', 'name' => $this->ptrFromIPv6($ipv6), 'value' => $mailServerFqdn];
} }
$tlsa = TlsaRecord::forServer()
->where('service', '_25._tcp')
->latest('id')
->first();
if ($tlsa?->dns_string) { if ($tlsa?->dns_string) {
$this->static[] = [ $this->static[] = [
'type' => 'TLSA', 'type' => 'TLSA',
@ -86,12 +90,23 @@ class DomainDnsModal extends ModalComponent
: ($dkim->public_key_txt ?? 'v=DKIM1; k=rsa; p='); : ($dkim->public_key_txt ?? 'v=DKIM1; k=rsa; p=');
$this->dynamic = [ $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' => $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' => "_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/'], ['type' => 'TXT', 'name' => $dkimHost, 'value' => $dkimTxt, 'helpLabel' => 'DKIM Inspector', 'helpUrl' => 'https://dkimvalidator.com/'],
]; ];
} }
private function extractZone(string $fqdn): string private function extractZone(string $fqdn): string
{ {
$fqdn = strtolower(trim($fqdn, ".")); $fqdn = strtolower(trim($fqdn, "."));