mailwolt/app/Console/Commands/TlsaRefresh.php

33 lines
1.0 KiB
PHP

<?php
namespace App\Console\Commands;
use App\Services\TlsaService;
use Illuminate\Console\Command;
class TlsaRefresh extends Command
{
protected $signature = 'dns:tlsa:refresh';
protected $description = 'Aktualisiert TLSA (3 1 1) für den MX-Host (idempotent).';
public function handle(TlsaService $tlsa): int
{
if (app()->environment(['local', 'development'])) {
$this->info('TLSA: übersprungen in nicht-Produktivumgebung.');
return self::SUCCESS;
}
if (config('app.base_domain', env('BASE_DOMAIN', 'example.com')) === 'example.com') {
$this->info('TLSA: übersprungen für example.com.');
return self::SUCCESS;
}
$rec = $tlsa->refreshForMx(); // <─ HIER
if (!$rec) {
$this->warn('TLSA konnte nicht aktualisiert werden (is_server / Zertifikat / Rechte?).');
return self::FAILURE;
}
$this->info("TLSA ok: {$rec->service}.{$rec->host} 3 1 1 {$rec->hash}");
return self::SUCCESS;
}
}