Support installing into Java's root store (#38)

This commit is contained in:
Adam Shannon
2018-07-29 21:22:27 -05:00
committed by Filippo Valsorda
parent fd504a1868
commit ae768be874
2 changed files with 129 additions and 0 deletions

22
main.go
View File

@@ -105,6 +105,10 @@ func (m *mkcert) Run(args []string) {
warning = true
log.Printf("Warning: the local CA is not installed in the %s trust store! ⚠️", NSSBrowsers)
}
if hasJava && !m.checkJava() {
warning = true
log.Println("Warning: the local CA is not installed in the Java trust store! ⚠️")
}
if warning {
log.Println("Run \"mkcert -install\" to avoid verification errors ‼️")
}
@@ -179,6 +183,15 @@ func (m *mkcert) install() {
}
printed = true
}
if hasJava && !m.checkJava() {
if hasKeytool {
m.installJava()
log.Println("The local CA is now installed in Java's trust store! ☕️")
} else {
log.Println(`Warning: "keytool" is not available, so the CA can't be automatically installed in Java's trust store! ⚠️`)
}
printed = true
}
if printed {
log.Print("")
}
@@ -195,6 +208,15 @@ func (m *mkcert) uninstall() {
log.Print("")
}
}
if hasJava {
if hasKeytool {
m.uninstallJava()
} else {
log.Print("")
log.Println(`Warning: "keytool" is not available, so the CA can't be automatically uninstalled from Java's trust store (if it was ever installed)! ⚠️`)
log.Print("")
}
}
if m.uninstallPlatform() {
log.Print("The local CA is now uninstalled from the system trust store(s)! 👋")
log.Print("")