pki.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624
  1. package nebula
  2. import (
  3. "crypto/fips140"
  4. "encoding/binary"
  5. "encoding/json"
  6. "errors"
  7. "fmt"
  8. "io"
  9. "log/slog"
  10. "net"
  11. "net/netip"
  12. "os"
  13. "slices"
  14. "strings"
  15. "sync/atomic"
  16. "time"
  17. "github.com/flynn/noise"
  18. "github.com/gaissmai/bart"
  19. "github.com/slackhq/nebula/cert"
  20. "github.com/slackhq/nebula/config"
  21. "github.com/slackhq/nebula/handshake"
  22. "github.com/slackhq/nebula/noiseutil"
  23. "github.com/slackhq/nebula/util"
  24. )
  25. type PKI struct {
  26. cs atomic.Pointer[CertState]
  27. caPool atomic.Pointer[cert.CAPool]
  28. l *slog.Logger
  29. }
  30. type CertState struct {
  31. v1Cert cert.Certificate
  32. v1Credential *handshake.Credential
  33. v2Cert cert.Certificate
  34. v2Credential *handshake.Credential
  35. initiatingVersion cert.Version
  36. privateKey []byte
  37. pkcs11Backed bool
  38. cipher string
  39. myVpnNetworks []netip.Prefix
  40. myVpnNetworksTable *bart.Lite
  41. myVpnAddrs []netip.Addr
  42. myVpnAddrsTable *bart.Lite
  43. myVpnBroadcastAddrsTable *bart.Lite
  44. }
  45. // errCertNeedsRestart marks a new cert that is refused on reload because only a restart can apply it
  46. var errCertNeedsRestart = errors.New("a restart is required to use the new cert")
  47. func NewPKIFromConfig(l *slog.Logger, c *config.C) (*PKI, error) {
  48. pki := &PKI{l: l}
  49. err := pki.reload(c, true, nil)
  50. if err != nil {
  51. return nil, err
  52. }
  53. c.RegisterReloadCallback(func(c *config.C, r *config.Reload) {
  54. // Compare with the running cipher, not the last config. A restart with one we can't run would fail, so say that
  55. // now rather than ask for one, and going back to the running one after a bad reload needs no restart
  56. if cipher := c.GetString("cipher", "aes"); !validCipher(cipher) {
  57. l.Error("Unknown cipher, a restart with it would fail", "cipher", cipher)
  58. r.Failed()
  59. } else if cipher == "chachapoly" && fipsOnly() {
  60. // newCipherSuite refuses it at startup
  61. l.Error("ChaChaPoly is not allowed in FIPS 140-only mode, a restart with it would fail", "cipher", cipher)
  62. r.Failed()
  63. } else if cipher != pki.getCertState().cipher {
  64. r.RestartRequiredIfChanged("cipher")
  65. }
  66. rErr := pki.reload(c, false, r)
  67. if rErr != nil {
  68. util.LogWithContextIfNeeded("Failed to reload PKI from config", rErr, l)
  69. }
  70. })
  71. return pki, nil
  72. }
  73. func (p *PKI) GetCAPool() *cert.CAPool {
  74. return p.caPool.Load()
  75. }
  76. func (p *PKI) getCertState() *CertState {
  77. return p.cs.Load()
  78. }
  79. // r is nil on the initial load
  80. func (p *PKI) reload(c *config.C, initial bool, r *config.Reload) error {
  81. before := p.cs.Load()
  82. err := p.reloadCerts(c, initial)
  83. if err != nil {
  84. if initial {
  85. return err
  86. }
  87. err.Log(p.l)
  88. if errors.Is(err, errCertNeedsRestart) {
  89. r.RestartRequired()
  90. } else {
  91. r.Failed()
  92. }
  93. } else if !initial {
  94. // A cert for a version we weren't running is accepted without comparing its networks to ours. The tun and the
  95. // lighthouse keep the networks they started with
  96. after := p.cs.Load()
  97. if !slices.Equal(before.myVpnNetworks, after.myVpnNetworks) {
  98. p.l.Warn("The new cert changes our networks, a restart is required to use them",
  99. "old_networks", before.myVpnNetworks, "new_networks", after.myVpnNetworks)
  100. r.RestartRequired()
  101. }
  102. }
  103. err = p.reloadCAPool(c)
  104. if err != nil {
  105. if initial {
  106. return err
  107. }
  108. err.Log(p.l)
  109. r.Failed()
  110. }
  111. return nil
  112. }
  113. // fipsOnly is fips140.Enforced, a variable so a test can run the FIPS 140-only reload check without GODEBUG
  114. var fipsOnly = fips140.Enforced
  115. // validCipher is true for the ciphers nebula can run. Each post-handshake CipherState in noiseutil hardcodes its own
  116. // nonce endianness, so there's nothing to set up for either.
  117. func validCipher(cipher string) bool {
  118. return cipher == "aes" || cipher == "chachapoly"
  119. }
  120. func (p *PKI) reloadCerts(c *config.C, initial bool) *util.ContextualError {
  121. var cipher string
  122. var currentState *CertState
  123. if initial {
  124. cipher = c.GetString("cipher", "aes")
  125. if !validCipher(cipher) {
  126. return util.NewContextualError(
  127. "unknown cipher",
  128. m{"cipher": cipher},
  129. nil,
  130. )
  131. }
  132. } else {
  133. // Cipher cant be hot swapped so just leave it at what it was before
  134. currentState = p.cs.Load()
  135. cipher = currentState.cipher
  136. }
  137. newState, err := newCertStateFromConfig(c, cipher)
  138. if err != nil {
  139. return util.NewContextualError("Could not load client cert", nil, err)
  140. }
  141. if currentState != nil {
  142. if newState.v1Cert != nil {
  143. if currentState.v1Cert == nil {
  144. //adding certs is fine, actually. Networks-in-common confirmed in newCertState().
  145. } else {
  146. // did IP in cert change? if so, don't set
  147. if !slices.Equal(currentState.v1Cert.Networks(), newState.v1Cert.Networks()) {
  148. return util.NewContextualError(
  149. "Networks in new cert was different from old",
  150. m{"new_networks": newState.v1Cert.Networks(), "old_networks": currentState.v1Cert.Networks(), "cert_version": cert.Version1},
  151. errCertNeedsRestart,
  152. )
  153. }
  154. if currentState.v1Cert.Curve() != newState.v1Cert.Curve() {
  155. return util.NewContextualError(
  156. "Curve in new v1 cert was different from old",
  157. m{"new_curve": newState.v1Cert.Curve(), "old_curve": currentState.v1Cert.Curve(), "cert_version": cert.Version1},
  158. errCertNeedsRestart,
  159. )
  160. }
  161. }
  162. }
  163. if newState.v2Cert != nil {
  164. if currentState.v2Cert == nil {
  165. //adding certs is fine, actually
  166. } else {
  167. // did IP in cert change? if so, don't set
  168. if !slices.Equal(currentState.v2Cert.Networks(), newState.v2Cert.Networks()) {
  169. return util.NewContextualError(
  170. "Networks in new cert was different from old",
  171. m{"new_networks": newState.v2Cert.Networks(), "old_networks": currentState.v2Cert.Networks(), "cert_version": cert.Version2},
  172. errCertNeedsRestart,
  173. )
  174. }
  175. if currentState.v2Cert.Curve() != newState.v2Cert.Curve() {
  176. return util.NewContextualError(
  177. "Curve in new cert was different from old",
  178. m{"new_curve": newState.v2Cert.Curve(), "old_curve": currentState.v2Cert.Curve(), "cert_version": cert.Version2},
  179. errCertNeedsRestart,
  180. )
  181. }
  182. }
  183. } else if currentState.v2Cert != nil {
  184. //newState.v1Cert is non-nil bc empty certstates aren't permitted
  185. if newState.v1Cert == nil {
  186. return util.NewContextualError("v1 and v2 certs are nil, this should be impossible", nil, err)
  187. }
  188. //if we're going to v1-only, we need to make sure we didn't orphan any v2-cert vpnaddrs
  189. if !slices.Equal(currentState.v2Cert.Networks(), newState.v1Cert.Networks()) {
  190. return util.NewContextualError(
  191. "Removing a V2 cert is not permitted unless it has identical networks to the new V1 cert",
  192. m{"new_v1_networks": newState.v1Cert.Networks(), "old_v2_networks": currentState.v2Cert.Networks()},
  193. errCertNeedsRestart,
  194. )
  195. }
  196. }
  197. }
  198. p.cs.Store(newState)
  199. if initial {
  200. p.l.Debug("Client nebula certificate(s)", "cert", newState)
  201. } else {
  202. p.l.Info("Client certificate(s) refreshed from disk", "cert", newState)
  203. }
  204. return nil
  205. }
  206. func (p *PKI) reloadCAPool(c *config.C) *util.ContextualError {
  207. caPool, err := loadCAPoolFromConfig(p.l, c)
  208. if err != nil {
  209. return util.NewContextualError("Failed to load ca from config", nil, err)
  210. }
  211. p.caPool.Store(caPool)
  212. p.l.Debug("Trusted CA fingerprints", "fingerprints", caPool.GetFingerprints())
  213. return nil
  214. }
  215. func (cs *CertState) GetDefaultCertificate() cert.Certificate {
  216. c := cs.getCertificate(cs.initiatingVersion)
  217. if c == nil {
  218. panic("No default certificate found")
  219. }
  220. return c
  221. }
  222. // DefaultVersion returns the preferred cert version for initiating handshakes.
  223. func (cs *CertState) DefaultVersion() cert.Version { return cs.initiatingVersion }
  224. // GetCredential returns the pre-computed handshake credential for the given version, or nil.
  225. func (cs *CertState) GetCredential(v cert.Version) *handshake.Credential {
  226. switch v {
  227. case cert.Version1:
  228. return cs.v1Credential
  229. case cert.Version2:
  230. return cs.v2Credential
  231. }
  232. return nil
  233. }
  234. func (cs *CertState) getCertificate(v cert.Version) cert.Certificate {
  235. switch v {
  236. case cert.Version1:
  237. return cs.v1Cert
  238. case cert.Version2:
  239. return cs.v2Cert
  240. }
  241. return nil
  242. }
  243. // newCipherSuite builds the noise.CipherSuite for the given curve and cipher.
  244. // When fips140Enforced is true (FIPS 140-only mode), non-approved algorithms
  245. // (Curve25519 and ChaChaPoly) are rejected with an error. Callers pass
  246. // fips140.Enforced() for fips140Enforced.
  247. func newCipherSuite(curve cert.Curve, pkcs11backed bool, cipher string, fips140Enforced bool) (noise.CipherSuite, error) {
  248. var dhFunc noise.DHFunc
  249. switch curve {
  250. case cert.Curve_CURVE25519:
  251. if fips140Enforced {
  252. return nil, errors.New("pki: use of Curve25519 is not allowed in FIPS 140-only mode")
  253. }
  254. dhFunc = noise.DH25519
  255. case cert.Curve_P256:
  256. if pkcs11backed {
  257. dhFunc = noiseutil.DHP256PKCS11
  258. } else {
  259. dhFunc = noiseutil.DHP256
  260. }
  261. default:
  262. return nil, fmt.Errorf("unsupported curve: %s", curve)
  263. }
  264. if cipher == "chachapoly" {
  265. if fips140Enforced {
  266. return nil, errors.New("pki: use of ChaChaPoly is not allowed in FIPS 140-only mode")
  267. }
  268. return noise.NewCipherSuite(dhFunc, noise.CipherChaChaPoly, noise.HashSHA256), nil
  269. }
  270. return noise.NewCipherSuite(dhFunc, noiseutil.CipherAESGCM, noise.HashSHA256), nil
  271. }
  272. func (cs *CertState) String() string {
  273. b, err := cs.MarshalJSON()
  274. if err != nil {
  275. return fmt.Sprintf("error marshaling certificate state: %v", err)
  276. }
  277. return string(b)
  278. }
  279. func (cs *CertState) MarshalJSON() ([]byte, error) {
  280. msg := []json.RawMessage{}
  281. if cs.v1Cert != nil {
  282. b, err := cs.v1Cert.MarshalJSON()
  283. if err != nil {
  284. return nil, err
  285. }
  286. msg = append(msg, b)
  287. }
  288. if cs.v2Cert != nil {
  289. b, err := cs.v2Cert.MarshalJSON()
  290. if err != nil {
  291. return nil, err
  292. }
  293. msg = append(msg, b)
  294. }
  295. return json.Marshal(msg)
  296. }
  297. func newCertStateFromConfig(c *config.C, cipher string) (*CertState, error) {
  298. var err error
  299. privPathOrPEM := c.GetString("pki.key", "")
  300. if privPathOrPEM == "" {
  301. return nil, errors.New("no pki.key path or PEM data provided")
  302. }
  303. rawKey, curve, isPkcs11, err := loadPrivateKey(privPathOrPEM)
  304. if err != nil {
  305. return nil, err
  306. }
  307. var rawCert []byte
  308. pubPathOrPEM := c.GetString("pki.cert", "")
  309. if pubPathOrPEM == "" {
  310. return nil, errors.New("no pki.cert path or PEM data provided")
  311. }
  312. if strings.Contains(pubPathOrPEM, "-----BEGIN") {
  313. rawCert = []byte(pubPathOrPEM)
  314. pubPathOrPEM = "<inline>"
  315. } else {
  316. rawCert, err = os.ReadFile(pubPathOrPEM)
  317. if err != nil {
  318. return nil, fmt.Errorf("unable to read pki.cert file %s: %s", pubPathOrPEM, err)
  319. }
  320. }
  321. var crt, v1, v2 cert.Certificate
  322. for {
  323. // Load the certificate
  324. crt, rawCert, err = loadCertificate(rawCert)
  325. if err != nil {
  326. return nil, err
  327. }
  328. if fips140.Enforced() && crt.Curve() != cert.Curve_P256 {
  329. return nil, fmt.Errorf("pki: use of %s is not allowed in FIPS 140-only mode", crt.Curve())
  330. }
  331. switch crt.Version() {
  332. case cert.Version1:
  333. if v1 != nil {
  334. return nil, fmt.Errorf("v1 certificate already found in pki.cert")
  335. }
  336. v1 = crt
  337. case cert.Version2:
  338. if v2 != nil {
  339. return nil, fmt.Errorf("v2 certificate already found in pki.cert")
  340. }
  341. v2 = crt
  342. default:
  343. return nil, fmt.Errorf("unknown certificate version %v", crt.Version())
  344. }
  345. if len(rawCert) == 0 || strings.TrimSpace(string(rawCert)) == "" {
  346. break
  347. }
  348. }
  349. if v1 == nil && v2 == nil {
  350. return nil, errors.New("no certificates found in pki.cert")
  351. }
  352. useInitiatingVersion := uint32(1)
  353. if v1 == nil {
  354. // The only condition that requires v2 as the default is if only a v2 certificate is present
  355. // We do this to avoid having to configure it specifically in the config file
  356. useInitiatingVersion = 2
  357. }
  358. rawInitiatingVersion := c.GetUint32("pki.initiating_version", useInitiatingVersion)
  359. var initiatingVersion cert.Version
  360. switch rawInitiatingVersion {
  361. case 1:
  362. if v1 == nil {
  363. return nil, fmt.Errorf("can not use pki.initiating_version 1 without a v1 certificate in pki.cert")
  364. }
  365. initiatingVersion = cert.Version1
  366. case 2:
  367. initiatingVersion = cert.Version2
  368. default:
  369. return nil, fmt.Errorf("unknown pki.initiating_version: %v", rawInitiatingVersion)
  370. }
  371. return newCertState(initiatingVersion, v1, v2, isPkcs11, curve, rawKey, cipher)
  372. }
  373. func newCertState(dv cert.Version, v1, v2 cert.Certificate, pkcs11backed bool, privateKeyCurve cert.Curve, privateKey []byte, cipher string) (*CertState, error) {
  374. cs := CertState{
  375. privateKey: privateKey,
  376. pkcs11Backed: pkcs11backed,
  377. cipher: cipher,
  378. myVpnNetworksTable: new(bart.Lite),
  379. myVpnAddrsTable: new(bart.Lite),
  380. myVpnBroadcastAddrsTable: new(bart.Lite),
  381. }
  382. if v1 != nil && v2 != nil {
  383. if !slices.Equal(v1.PublicKey(), v2.PublicKey()) {
  384. return nil, util.NewContextualError("v1 and v2 public keys are not the same, ignoring", nil, nil)
  385. }
  386. if v1.Curve() != v2.Curve() {
  387. return nil, util.NewContextualError("v1 and v2 curve are not the same, ignoring", nil, nil)
  388. }
  389. if v1.Networks()[0] != v2.Networks()[0] {
  390. return nil, util.NewContextualError("v1 and v2 networks are not the same", nil, nil)
  391. }
  392. cs.initiatingVersion = dv
  393. }
  394. if v1 != nil {
  395. if pkcs11backed {
  396. //NOTE: We do not currently have a method to verify a public private key pair when the private key is in an hsm
  397. } else {
  398. if err := v1.VerifyPrivateKey(privateKeyCurve, privateKey); err != nil {
  399. return nil, fmt.Errorf("private key is not a pair with public key in nebula cert: %w", err)
  400. }
  401. }
  402. v1hs, err := v1.MarshalForHandshakes()
  403. if err != nil {
  404. return nil, fmt.Errorf("error marshalling v1 certificate for handshake: %w", err)
  405. }
  406. ncs, err := newCipherSuite(v1.Curve(), pkcs11backed, cipher, fips140.Enforced())
  407. if err != nil {
  408. return nil, err
  409. }
  410. cs.v1Cert = v1
  411. cs.v1Credential = handshake.NewCredential(v1, v1hs, privateKey, ncs)
  412. if cs.initiatingVersion == 0 {
  413. cs.initiatingVersion = cert.Version1
  414. }
  415. }
  416. if v2 != nil {
  417. if pkcs11backed {
  418. //NOTE: We do not currently have a method to verify a public private key pair when the private key is in an hsm
  419. } else {
  420. if err := v2.VerifyPrivateKey(privateKeyCurve, privateKey); err != nil {
  421. return nil, fmt.Errorf("private key is not a pair with public key in nebula cert: %w", err)
  422. }
  423. }
  424. v2hs, err := v2.MarshalForHandshakes()
  425. if err != nil {
  426. return nil, fmt.Errorf("error marshalling v2 certificate for handshake: %w", err)
  427. }
  428. ncs, err := newCipherSuite(v2.Curve(), pkcs11backed, cipher, fips140.Enforced())
  429. if err != nil {
  430. return nil, err
  431. }
  432. cs.v2Cert = v2
  433. cs.v2Credential = handshake.NewCredential(v2, v2hs, privateKey, ncs)
  434. if cs.initiatingVersion == 0 {
  435. cs.initiatingVersion = cert.Version2
  436. }
  437. }
  438. var crt cert.Certificate
  439. crt = cs.getCertificate(cert.Version2)
  440. if crt == nil {
  441. // v2 certificates are a superset, only look at v1 if its all we have
  442. crt = cs.getCertificate(cert.Version1)
  443. }
  444. for _, network := range crt.Networks() {
  445. cs.myVpnNetworks = append(cs.myVpnNetworks, network)
  446. cs.myVpnNetworksTable.Insert(network)
  447. cs.myVpnAddrs = append(cs.myVpnAddrs, network.Addr())
  448. cs.myVpnAddrsTable.Insert(netip.PrefixFrom(network.Addr(), network.Addr().BitLen()))
  449. if network.Addr().Is4() {
  450. addr := network.Masked().Addr().As4()
  451. mask := net.CIDRMask(network.Bits(), network.Addr().BitLen())
  452. binary.BigEndian.PutUint32(addr[:], binary.BigEndian.Uint32(addr[:])|^binary.BigEndian.Uint32(mask))
  453. cs.myVpnBroadcastAddrsTable.Insert(netip.PrefixFrom(netip.AddrFrom4(addr), network.Addr().BitLen()))
  454. }
  455. }
  456. return &cs, nil
  457. }
  458. func loadPrivateKey(privPathOrPEM string) (rawKey []byte, curve cert.Curve, isPkcs11 bool, err error) {
  459. var pemPrivateKey []byte
  460. if strings.Contains(privPathOrPEM, "-----BEGIN") {
  461. pemPrivateKey = []byte(privPathOrPEM)
  462. privPathOrPEM = "<inline>"
  463. rawKey, _, curve, err = cert.UnmarshalPrivateKeyFromPEM(pemPrivateKey)
  464. if err != nil {
  465. return nil, curve, false, fmt.Errorf("error while unmarshaling pki.key %s: %s", privPathOrPEM, err)
  466. }
  467. } else if strings.HasPrefix(privPathOrPEM, "pkcs11:") {
  468. rawKey = []byte(privPathOrPEM)
  469. return rawKey, cert.Curve_P256, true, nil
  470. } else {
  471. pemPrivateKey, err = os.ReadFile(privPathOrPEM)
  472. if err != nil {
  473. return nil, curve, false, fmt.Errorf("unable to read pki.key file %s: %s", privPathOrPEM, err)
  474. }
  475. rawKey, _, curve, err = cert.UnmarshalPrivateKeyFromPEM(pemPrivateKey)
  476. if err != nil {
  477. return nil, curve, false, fmt.Errorf("error while unmarshaling pki.key %s: %s", privPathOrPEM, err)
  478. }
  479. }
  480. return
  481. }
  482. func loadCertificate(b []byte) (cert.Certificate, []byte, error) {
  483. c, b, err := cert.UnmarshalCertificateFromPEM(b)
  484. if err != nil {
  485. return nil, b, fmt.Errorf("error while unmarshaling pki.cert: %w", err)
  486. }
  487. if c.Expired(time.Now()) {
  488. return nil, b, fmt.Errorf("nebula certificate for this host is expired")
  489. }
  490. if len(c.Networks()) == 0 {
  491. return nil, b, fmt.Errorf("no networks encoded in certificate")
  492. }
  493. if c.IsCA() {
  494. return nil, b, fmt.Errorf("host certificate is a CA certificate")
  495. }
  496. return c, b, nil
  497. }
  498. func loadCAPoolFromConfig(l *slog.Logger, c *config.C) (*cert.CAPool, error) {
  499. caPathOrPEM := c.GetString("pki.ca", "")
  500. if caPathOrPEM == "" {
  501. return nil, errors.New("no pki.ca path or PEM data provided")
  502. }
  503. var caReader io.ReadCloser
  504. var err error
  505. if strings.Contains(caPathOrPEM, "-----BEGIN") {
  506. caReader = io.NopCloser(strings.NewReader(caPathOrPEM))
  507. } else {
  508. caReader, err = os.Open(caPathOrPEM)
  509. if err != nil {
  510. return nil, fmt.Errorf("unable to read pki.ca file %s: %s", caPathOrPEM, err)
  511. }
  512. }
  513. defer caReader.Close()
  514. caPool, err := cert.NewCAPoolFromPEMReader(caReader)
  515. if errors.Is(err, cert.ErrExpired) {
  516. var expired int
  517. for _, crt := range caPool.CAs {
  518. if crt.Certificate.Expired(time.Now()) {
  519. expired++
  520. l.Warn("expired certificate present in CA pool", "cert", crt)
  521. }
  522. }
  523. if expired >= len(caPool.CAs) {
  524. return nil, errors.New("no valid CA certificates present")
  525. }
  526. } else if err != nil {
  527. return nil, fmt.Errorf("error while adding CA certificate to CA trust store: %s", err)
  528. }
  529. bl := c.GetStringSlice("pki.blocklist", []string{})
  530. if len(bl) > 0 {
  531. for _, fp := range bl {
  532. caPool.BlocklistFingerprint(fp)
  533. }
  534. l.Info("Blocklisted certificates", "fingerprintCount", len(bl))
  535. }
  536. return caPool, nil
  537. }