Skip to content

Commit 6d48a90

Browse files
Remove certificates from the keychain using the systray icon
1 parent 8fc4e4a commit 6d48a90

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

systray/systray_real.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,15 @@ func (s *Systray) start() {
6464
s.updateMenuItem(mRmCrashes, config.LogsIsEmpty())
6565

6666
mGenCerts := systray.AddMenuItem("Generate and Install HTTPS certificates", "HTTPS Certs")
67+
mRemoveCerts := systray.AddMenuItem("Remove HTTPS certificates", "")
6768
// On linux/windows chrome/firefox/edge(chromium) the agent works without problems on plain HTTP,
6869
// so we disable the menuItem to generate/install the certificates
6970
if runtime.GOOS != "darwin" {
7071
s.updateMenuItem(mGenCerts, true)
72+
s.updateMenuItem(mRemoveCerts, true)
7173
} else {
7274
s.updateMenuItem(mGenCerts, config.CertsExist())
75+
s.updateMenuItem(mRemoveCerts, !config.CertsExist())
7376
}
7477

7578
// Add pause/quit
@@ -103,6 +106,15 @@ func (s *Systray) start() {
103106
cert.DeleteCertificates(certDir)
104107
}
105108
s.Restart()
109+
case <-mRemoveCerts.ClickedCh:
110+
err := cert.UninstallCertificates()
111+
if err != nil {
112+
log.Errorf("cannot uninstall certificates something went wrong: %s", err)
113+
} else {
114+
certDir := config.GetCertificatesDir()
115+
cert.DeleteCertificates(certDir)
116+
}
117+
s.Restart()
106118
case <-mPause.ClickedCh:
107119
s.Pause()
108120
case <-mQuit.ClickedCh:

0 commit comments

Comments
 (0)