1
0
mirror of https://github.com/laravel/valet.git synced 2026-02-04 16:10:08 +01:00

Bring in changes to mirror #1358

This commit is contained in:
Matt Stauffer
2023-02-07 21:39:32 -05:00
parent b588ef30f8
commit 719ff07eec
3 changed files with 24 additions and 0 deletions

View File

@@ -511,6 +511,27 @@ public function createCa(int $caExpireInDays): void
$this->trustCa($caPemPath);
}
/**
* If CA and root certificates exist, remove them.
*/
public function removeCa(): void
{
foreach (['pem', 'key', 'srl'] as $ending) {
$path = $this->caPath('LaravelValetCASelfSigned.' . $ending);
if ($this->files->exists($path)) {
$this->files->unlink($path);
}
}
$cName = 'Laravel Valet CA Self Signed CN';
$this->cli->run(sprintf(
'sudo security delete-certificate -c "%s" /Library/Keychains/System.keychain',
$cName
));
}
/**
* Create and trust a certificate for the given URL.
*

View File

@@ -512,6 +512,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...');

View File

@@ -778,6 +778,7 @@ public function test_force_uninstall_command()
$site = Mockery::mock(RealSite::class);
$site->shouldReceive('unsecureAll')->once();
$site->shouldReceive('removeCa')->once();
$site->shouldReceive('uninstallLoopback')->once();
$nginx = Mockery::mock(Nginx::class);