CluPilotCloud/app/Console/Commands/CheckCertificates.php

37 lines
1.0 KiB
PHP

<?php
namespace App\Console\Commands;
use App\Services\Proxy\CertificateSweep;
use Illuminate\Console\Command;
/**
* Täglich: welche Namen bedient diese Installation, und wie lange gelten ihre
* Zertifikate noch.
*
* Nach Zeitplan und nicht nur auf Knopfdruck, weil die Frage, auf die es
* ankommt, nicht „ist es gerade gültig" lautet, sondern „läuft die Erneuerung".
* Die beantwortet nur eine Messung, die auch dann läuft, wenn niemand hinsieht.
*/
class CheckCertificates extends Command
{
protected $signature = 'clupilot:check-certificates';
protected $description = 'Syncs the known hostnames and measures their certificates';
public function handle(CertificateSweep $sweep): int
{
$added = $sweep->sync();
$result = $sweep->check();
$this->info(sprintf(
'%d hostname(s) added, %d checked, %d without a valid certificate',
$added,
$result['checked'],
$result['failing'],
));
return self::SUCCESS;
}
}