Skip to content

Commit 321fa31

Browse files
committed
add cert install on windows
1 parent 484433a commit 321fa31

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

certificates/certificates.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,28 @@ func InstallCertificates(certsDir *paths.Path) {
272272
log.Errorf("cannot install certificate in the system keychain: %s", err)
273273
}
274274
log.Infof("stdout: %s", stdoutStderr)
275+
// case "linux":
276+
// stdoutStderr, err := exec.Command("sudo", "apt-get", "install", "-y", "ca-certificates").CombinedOutput()
277+
// if err != nil {
278+
// log.Errorf("cannot install certificate in the system keychain: %s", err)
279+
// }
280+
// log.Infof("stdout: %s", stdoutStderr)
281+
// stdoutStderr, err = exec.Command("sudo", "cp", certsDir.String()+`/ca.cert.pem`, "/usr/local/share/ca-certificates").CombinedOutput()
282+
// if err != nil {
283+
// log.Errorf("cannot install certificate in the system keychain: %s", err)
284+
// }
285+
// log.Infof("stdout: %s", stdoutStderr)
286+
// stdoutStderr, err = exec.Command("sudo", "update-ca-certificates").CombinedOutput()
287+
// if err != nil {
288+
// log.Errorf("cannot install certificate in the system keychain: %s", err)
289+
// }
290+
// log.Infof("stdout: %s", stdoutStderr)
291+
case "windows":
292+
stdoutStderr, err := exec.Command("certmgr.exe", "-add", certsDir.String()+`/ca.cert.cer`, "-s", "-r", "currentUser", "root").CombinedOutput()
293+
if err != nil {
294+
log.Errorf("cannot install certificate in the system keychain: %s", err)
295+
}
296+
log.Infof("stdout: %s", stdoutStderr)
275297
default:
276298
log.Infof("cannot install certificate: OS not supported")
277299
}

0 commit comments

Comments
 (0)