Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.

Commit

Permalink
extract public ca certificate to file
Browse files Browse the repository at this point in the history
  • Loading branch information
bonifaido committed May 13, 2024
1 parent e568736 commit 179ed8e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions internal/cli/cmd/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"crypto/x509/pkix"
"encoding/json"
"os"
"path"

"emperror.dev/errors"
"github.com/bufbuild/protovalidate-go"
Expand Down Expand Up @@ -104,6 +105,12 @@ func (c *agentCommand) runCommander(ctx context.Context) error {
return err
}

publicCAPemPath := path.Dir(caPEMPath) + "/public_ca.crt"

if err := os.WriteFile(publicCAPemPath, ca.GetTrustAnchor().GetPEM(), 0644); err != nil {
return errors.WrapIf(err, "could not write CA certificate to file")
}

csrSign, err := commands.CSRSign(ca, c.cli.Configuration().Agent.DefaultCertTTLDuration)
if err != nil {
return err
Expand Down

0 comments on commit 179ed8e

Please sign in to comment.