Skip to content

Commit

Permalink
Forward standby/secondary issue/sign requests to primary (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
tr1ck3r committed Sep 30, 2020
1 parent f1ce113 commit f133fe0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions plugin/pki/path_issue_sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/hashicorp/errwrap"
"github.com/hashicorp/vault/sdk/framework"
"github.com/hashicorp/vault/sdk/helper/certutil"
"github.com/hashicorp/vault/sdk/helper/consts"
"github.com/hashicorp/vault/sdk/helper/errutil"
"github.com/hashicorp/vault/sdk/logical"
)
Expand Down Expand Up @@ -189,6 +190,12 @@ func (b *backend) pathSignVerbatim(ctx context.Context, req *logical.Request, da
}

func (b *backend) pathIssueSignCert(ctx context.Context, req *logical.Request, data *framework.FieldData, role *roleEntry, useCSR, useCSRValues bool) (*logical.Response, error) {
// If storing the certificate and on a performance standby or secondary, forward this request on to the primary
if !role.NoStore && b.System().ReplicationState().
HasState(consts.ReplicationPerformanceStandby|consts.ReplicationPerformanceSecondary) {
return nil, logical.ErrReadOnly
}

format := getFormat(data)
if format == "" {
return logical.ErrorResponse(
Expand Down

0 comments on commit f133fe0

Please sign in to comment.