From 3af02dfba889a91ecdf33b9344c746108c0cca9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?kroko=20/=20Reinis=20Adovi=C4=8Ds?= Date: Thu, 8 Feb 2018 20:26:53 +0200 Subject: [PATCH] unsecure also by trying to match cert email --- cli/Valet/Site.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/cli/Valet/Site.php b/cli/Valet/Site.php index 3ed72fc..aa9f813 100644 --- a/cli/Valet/Site.php +++ b/cli/Valet/Site.php @@ -226,8 +226,8 @@ function createCa() )); $this->cli->runAsUser(sprintf( - 'openssl req -new -newkey rsa:2048 -days 730 -nodes -x509 -subj "/C=/ST=/O=%s/localityName=/commonName=%s/organizationalUnitName=Developers/emailAddress=noreply@valet.test/" -keyout %s -out %s', - $oName, $cName, $caKeyPath, $caPemPath + 'openssl req -new -newkey rsa:2048 -days 730 -nodes -x509 -subj "/C=/ST=/O=%s/localityName=/commonName=%s/organizationalUnitName=Developers/emailAddress=%s/" -keyout %s -out %s', + $oName, $cName, 'rootcertificate@laravel.valet', $caKeyPath, $caPemPath )); $this->trustCa($caPemPath); } @@ -285,8 +285,8 @@ function createPrivateKey($keyPath) function createSigningRequest($url, $keyPath, $csrPath, $confPath) { $this->cli->runAsUser(sprintf( - 'openssl req -new -key %s -out %s -subj "/C=/ST=/O=/localityName=/commonName=%s/organizationalUnitName=/emailAddress=/" -config %s', - $keyPath, $csrPath, $url, $confPath + 'openssl req -new -key %s -out %s -subj "/C=/ST=/O=/localityName=/commonName=%s/organizationalUnitName=/emailAddress=%s%s/" -config %s', + $keyPath, $csrPath, $url, $url, '@laravel.valet', $confPath )); } @@ -363,6 +363,10 @@ function unsecure($url) $this->cli->run(sprintf('sudo security delete-certificate -c "%s" /Library/Keychains/System.keychain', $url)); $this->cli->run(sprintf('sudo security delete-certificate -c "*.%s" /Library/Keychains/System.keychain', $url)); + $this->cli->run(sprintf( + 'sudo security find-certificate -e "%s%s" -a -Z | grep SHA-1 | sudo awk \'{system("security delete-certificate -Z "$NF" /Library/Keychains/System.keychain")}\'', + $url, '@laravel.valet' + )); } }