Skip to content

Commit

Permalink
Merge pull request #12541 from masnax/system-certs
Browse files Browse the repository at this point in the history
Read system certs directly from `/etc/ssl`
  • Loading branch information
tomponline authored Nov 22, 2023
2 parents f86e644 + 56582e3 commit af38cb1
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions shared/network_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package shared

import (
"crypto/x509"
"os"
)

func systemCertPool() (*x509.CertPool, error) {
Expand All @@ -14,13 +13,5 @@ func systemCertPool() (*x509.CertPool, error) {
return nil, err
}

// Attempt to load the system's pool too (for snaps)
if PathExists("/var/lib/snapd/hostfs/etc/ssl/certs/ca-certificates.crt") {
snapCerts, err := os.ReadFile("/var/lib/snapd/hostfs/etc/ssl/certs/ca-certificates.crt")
if err == nil {
pool.AppendCertsFromPEM(snapCerts)
}
}

return pool, nil
}

0 comments on commit af38cb1

Please sign in to comment.