Skip to content

Commit 2da59f9

Browse files
authored
Merge pull request #1463 from adrum/feature/trust-ca-cert
Trust CA Certificate only
2 parents b62bc68 + c0a2c7e commit 2da59f9

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

cli/Valet/Site.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,14 @@ public function createCa(int $caExpireInDays): void
525525
$caKeyPath = $this->caPath('LaravelValetCASelfSigned.key');
526526

527527
if ($this->files->exists($caKeyPath) && $this->files->exists($caPemPath)) {
528+
529+
$isTrusted = $this->cli->run(sprintf(
530+
'security verify-cert -c "%s"', $caPemPath
531+
));
532+
533+
if (strpos($isTrusted, '...certificate verification successful.') === false) {
534+
$this->trustCa($caPemPath);
535+
}
528536
return;
529537
}
530538

@@ -607,8 +615,6 @@ public function createCertificate(string $url, int $caExpireInDays): void
607615
$caExpireInDays, $caPemPath, $caKeyPath, $caSrlParam, $csrPath, $crtPath, $confPath
608616
));
609617
}
610-
611-
$this->trustCertificate($crtPath);
612618
}
613619

614620
/**

0 commit comments

Comments
 (0)