mirror of
https://github.com/laravel/valet.git
synced 2026-02-06 16:50:09 +01:00
handle SSL .crt creation "Permission denied" failure
This commit is contained in:
@@ -304,10 +304,18 @@ function createCertificate($url)
|
|||||||
$caSrlParam = ' -CAserial ' . $caSrlPath;
|
$caSrlParam = ' -CAserial ' . $caSrlPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$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(
|
$this->cli->run(sprintf(
|
||||||
'openssl x509 -req -sha256 -days 730 -CA "%s" -CAkey "%s"%s -in "%s" -out "%s" -extensions v3_req -extfile "%s"',
|
'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
|
$caPemPath, $caKeyPath, $caSrlParam, $csrPath, $crtPath, $confPath
|
||||||
));
|
));
|
||||||
|
}
|
||||||
|
|
||||||
$this->trustCertificate($crtPath);
|
$this->trustCertificate($crtPath);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user