Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
umbynos committed Mar 30, 2023
1 parent 91b7734 commit 286cde5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion certificates/certificates.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,14 @@ func GenerateCertificates(certsDir *paths.Path) {
func InstallCertificates(certsDir *paths.Path) {
switch runtime.GOOS {
case "darwin":
stdoutStderr, err := exec.Command("/usr/bin/osascript", "-e", `'do shell script \"security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain `+certsDir.String()+`/ca.cert.pem\" with administration privileges'`).CombinedOutput()
command := fmt.Sprintf(`tell application "Terminal"
reopen
activate
delay 1
do script "sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain %s/ca.cert.pem; echo '\\nYou can now close this window.\\n\\n' ; exit" in front window
end tell`, certsDir.String())
log.Info("osascript", "-e", command)
stdoutStderr, err := exec.Command("osascript", "-e", command).CombinedOutput()
if err != nil {
log.Errorf("cannot install certificate in the system keychain: %s", err)
}
Expand Down

0 comments on commit 286cde5

Please sign in to comment.