2018-02-10 06:17:24 +00:00
|
|
|
// +build !windows
|
|
|
|
|
|
|
|
package certinject
|
|
|
|
|
|
|
|
import "github.com/hlandau/xlog"
|
|
|
|
|
2018-02-14 05:03:04 +00:00
|
|
|
// This package is used to add and remove certificates to the system trust
|
2018-02-10 06:17:24 +00:00
|
|
|
// store.
|
|
|
|
// Currently only supports NSS sqlite3 stores.
|
|
|
|
|
|
|
|
var log, Log = xlog.New("ncdns.certinject")
|
|
|
|
|
2018-02-14 05:03:04 +00:00
|
|
|
// InjectCert injects the given cert into all configured trust stores.
|
2018-02-10 06:17:24 +00:00
|
|
|
func InjectCert(derBytes []byte) {
|
|
|
|
|
2018-02-14 05:03:04 +00:00
|
|
|
if nssFlag.Value() {
|
|
|
|
injectCertNss(derBytes)
|
|
|
|
}
|
2018-02-10 06:17:24 +00:00
|
|
|
}
|
|
|
|
|
2018-02-14 05:03:04 +00:00
|
|
|
// CleanCerts cleans expired certs from all configured trust stores.
|
2018-02-10 06:17:24 +00:00
|
|
|
func CleanCerts() {
|
|
|
|
|
2018-02-14 05:03:04 +00:00
|
|
|
if nssFlag.Value() {
|
|
|
|
cleanCertsNss()
|
|
|
|
}
|
2018-02-10 06:17:24 +00:00
|
|
|
|
|
|
|
}
|