mirror of
https://github.com/laravel/valet.git
synced 2026-02-05 08:30:07 +01:00
handle SSL .crt creation "Permission denied" failure
This commit is contained in:
@@ -304,11 +304,19 @@ function createCertificate($url)
|
||||
$caSrlParam = ' -CAserial ' . $caSrlPath;
|
||||
}
|
||||
|
||||
$this->cli->run(sprintf(
|
||||
$result = $this->cli->runAsUser(sprintf(
|
||||
'openssl x509 -req -sha256 -days 730 -CA "%s" -CAkey "%s"%s -in "%s" -out "%s" -extensions v3_req -extfile "%s"',
|
||||
$caPemPath, $caKeyPath, $caSrlParam, $csrPath, $crtPath, $confPath
|
||||
));
|
||||
|
||||
// If cert could not be created using runAsUser(), use run().
|
||||
if (strpos($result, 'Permission denied')) {
|
||||
$this->cli->run(sprintf(
|
||||
'openssl x509 -req -sha256 -days 730 -CA "%s" -CAkey "%s"%s -in "%s" -out "%s" -extensions v3_req -extfile "%s"',
|
||||
$caPemPath, $caKeyPath, $caSrlParam, $csrPath, $crtPath, $confPath
|
||||
));
|
||||
}
|
||||
|
||||
$this->trustCertificate($crtPath);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user