Anpassen der Tlsa Record Ausgabe im Modal

main
boban 2025-10-17 12:24:31 +02:00
parent 0a03324eec
commit 4a52284245
4 changed files with 65 additions and 24 deletions

14
a?->dns_string); Normal file
View File

@ -0,0 +1,14 @@
= App\Models\TlsaRecord {#6794
id: 1,
domain_id: 9,
service: "_25._tcp",
host: "mx.nexlab.at",
usage: 3,
selector: 1,
matching: 1,
hash: "0922eee5f6090b241a3f8554a366b3c1adc4088eb1cdffa94ae838c6e580b983",
cert_path: "/etc/ssl/mail/fullchain.pem",
created_at: "2025-10-06 15:24:56",
updated_at: "2025-10-06 15:24:56",
}

View File

@ -27,6 +27,7 @@ class DomainDnsList extends Component
$this->systemDomain = Domain::where('is_system', true)->first();
// $this->userDomains = Domain::where('is_system', false)->orderBy('domain')->get();
$domains = Domain::where('is_system', false)
->where('is_server', false)
->withCount([
'mailUsers as mailboxes_count', // -> mail_users
'mailAliases as aliases_count', // -> mail_aliases

View File

@ -3,6 +3,7 @@
namespace App\Livewire\Ui\Domain\Modal;
use App\Models\Domain;
use App\Models\TlsaRecord;
use App\Support\NetProbe;
use Illuminate\Support\Facades\DB;
use LivewireUI\Modal\ModalComponent;
@ -20,7 +21,10 @@ class DomainDnsModal extends ModalComponent
/** @var array<int,array<string,string|int|null>> */
public array $dynamic = [];
public static function modalMaxWidth(): string { return '6xl'; }
public static function modalMaxWidth(): string
{
return '6xl';
}
public function mount(int $domainId): void
{
@ -54,15 +58,25 @@ class DomainDnsModal extends ModalComponent
$this->static[] = ['type' => 'AAAA', 'name' => $mta, 'value' => $ipv6];
$this->static[] = ['type' => 'PTR', 'name' => $this->ptrFromIPv6($ipv6), 'value' => $mta];
}
if ($tlsa = config('mailwolt.tlsa')) {
$this->static[] = ['type'=>'TLSA','name'=>"_25._tcp.$mta",'value'=>$tlsa];
$tlsa = TlsaRecord::forServer()
->where('service', '_25._tcp')
->latest('id')
->first();
if ($tlsa?->dns_string) {
$this->static[] = [
'type' => 'TLSA',
'name' => "{$tlsa->service}.{$tlsa->host}",
'value' => "{$tlsa->usage} {$tlsa->selector} {$tlsa->matching} {$tlsa->hash}",
];
}
$this->static[] = ['type'=>'MX','name'=>$this->domainName,'value'=>"10 $mta."];
// --- Domain-spezifisch ---
$spf = 'v=spf1 mx a -all';
$dmarc = "v=DMARC1; p=none; rua=mailto:dmarc@{$this->domainName}; pct=100";
*
$dkim = DB::table('dkim_keys')
->where('domain_id', $d->id)->where('is_active', 1)->orderByDesc('id')->first();
$selector = $dkim ? $dkim->selector : 'mwl1';
@ -108,6 +122,7 @@ class DomainDnsModal extends ModalComponent
$p = array_reverse(explode('.', $ip));
return implode('.', $p) . '.in-addr.arpa';
}
private function ptrFromIPv6(string $ip): string
{
$expanded = strtolower(inet_ntop(inet_pton($ip)));

View File

@ -2,6 +2,7 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
class TlsaRecord extends Model
@ -10,8 +11,18 @@ class TlsaRecord extends Model
'domain_id', 'service', 'host', 'usage', 'selector', 'matching', 'hash', 'cert_path',
];
public function domain() { return $this->belongsTo(Domain::class); }
// Relation zur Domain (FK: domain_id)
public function domain()
{
return $this->belongsTo(Domain::class);
}
public function scopeForServer(Builder $q): Builder
{
return $q->whereHas('domain', fn($d) => $d->where('is_server', true));
}
// Fertige Ausgabe-Zeile
public function getDnsStringAttribute(): string
{
return "{$this->service}.{$this->host}. IN TLSA {$this->usage} {$this->selector} {$this->matching} {$this->hash}";