mirror of
https://github.com/laravel/valet.git
synced 2026-02-04 16:10:08 +01:00
Remove Valet Certificate Authority on uninstall
This commit is contained in:
@@ -588,6 +588,35 @@ public function createCa($caExpireInDays)
|
||||
$this->trustCa($caPemPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* If CA and root certificates exist, remove them.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function removeCa()
|
||||
{
|
||||
$caPemPath = $this->caPath('LaravelValetCASelfSigned.pem');
|
||||
$caKeyPath = $this->caPath('LaravelValetCASelfSigned.key');
|
||||
$caSrlPath = $this->caPath('LaravelValetCASelfSigned.srl');
|
||||
|
||||
$cName = 'Laravel Valet CA Self Signed CN';
|
||||
|
||||
if ($this->files->exists($caKeyPath)) {
|
||||
$this->files->unlink($caKeyPath);
|
||||
}
|
||||
if ($this->files->exists($caPemPath)) {
|
||||
$this->files->unlink($caPemPath);
|
||||
}
|
||||
if ($this->files->exists($caSrlPath)) {
|
||||
$this->files->unlink($caSrlPath);
|
||||
}
|
||||
|
||||
$this->cli->run(sprintf(
|
||||
'sudo security delete-certificate -c "%s" /Library/Keychains/System.keychain',
|
||||
$cName
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and trust a certificate for the given URL.
|
||||
*
|
||||
|
||||
@@ -420,6 +420,8 @@ function (ConsoleCommandEvent $event) {
|
||||
}
|
||||
info('Removing certificates for all Secured sites...');
|
||||
Site::unsecureAll();
|
||||
info('Removing certificate authority...');
|
||||
Site::removeCa();
|
||||
info('Removing Nginx and configs...');
|
||||
Nginx::uninstall();
|
||||
info('Removing Dnsmasq and configs...');
|
||||
|
||||
Reference in New Issue
Block a user