1
0
mirror of https://github.com/laravel/valet.git synced 2026-02-05 08:30:07 +01:00

add the ability to see the Certificate Authority expiration date

This commit is contained in:
Austin Drummond
2024-11-15 12:09:11 -05:00
parent 072859eced
commit 3c0015c305
2 changed files with 21 additions and 5 deletions

View File

@@ -437,9 +437,9 @@ public function secured(): array
/**
* Get all of the URLs with expiration dates that are currently secured.
*/
public function securedWithDates(): array
public function securedWithDates($ca = false): array
{
return collect($this->secured())->map(function ($site) {
$sites = collect($this->secured())->map(function ($site) {
$filePath = $this->certificatesPath().'/'.$site.'.crt';
$expiration = $this->cli->run("openssl x509 -enddate -noout -in $filePath");
@@ -450,7 +450,22 @@ public function securedWithDates(): array
'site' => $site,
'exp' => new DateTime($expiration),
];
})->unique()->values()->all();
})->unique()->values();
if ($ca) {
$filePath = $this->caPath('LaravelValetCASelfSigned.pem');
$expiration = $this->cli->run("openssl x509 -enddate -noout -in $filePath");
$expiration = str_replace('notAfter=', '', $expiration);
$sites->prepend([
'site' => 'Certificate Authority',
'exp' => new DateTime($expiration),
]);
}
return $sites->all();
}
public function isSecured(string $site): bool