Skip to content

Commit

Permalink
caddypki: Fix caddy trust command to use the correct API endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
francislavoie committed Apr 26, 2022
1 parent a8bb4a6 commit a3f46bb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/caddypki/command.go
Expand Up @@ -133,7 +133,7 @@ func cmdTrust(fl caddycmd.Flags) (int, error) {
ca := CA{
log: caddy.Log(),
root: rootCert,
rootCertPath: adminAddr + path.Join(adminPKIEndpointBase, caID, "certificates"),
rootCertPath: adminAddr + path.Join(adminPKIEndpointBase, "ca", caID),
}

// Install the cert!
Expand Down Expand Up @@ -207,7 +207,7 @@ func cmdUntrust(fl caddycmd.Flags) (int, error) {

// rootCertFromAdmin makes the API request to fetch the root certificate for the named CA via admin API.
func rootCertFromAdmin(adminAddr string, caID string) (*x509.Certificate, error) {
uri := path.Join(adminPKIEndpointBase, caID, "certificates")
uri := path.Join(adminPKIEndpointBase, "ca", caID)

// Make the request to fetch the CA info
resp, err := caddycmd.AdminAPIRequest(adminAddr, http.MethodGet, uri, make(http.Header), nil)
Expand Down

0 comments on commit a3f46bb

Please sign in to comment.