mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 19:17:58 +00:00
Add hook for ENT tweaking of PKI contraints verification options. (#29048)
This commit is contained in:
@@ -4,7 +4,9 @@
|
|||||||
package issuing
|
package issuing
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/hashicorp/vault/sdk/logical"
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
@@ -33,7 +35,7 @@ func isCertificateVerificationDisabled() (bool, error) {
|
|||||||
return disable, nil
|
return disable, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func VerifyCertificate(parsedBundle *certutil.ParsedCertBundle) error {
|
func VerifyCertificate(ctx context.Context, storage logical.Storage, issuerId IssuerID, parsedBundle *certutil.ParsedCertBundle) error {
|
||||||
if verificationDisabled, err := isCertificateVerificationDisabled(); err != nil {
|
if verificationDisabled, err := isCertificateVerificationDisabled(); err != nil {
|
||||||
return err
|
return err
|
||||||
} else if verificationDisabled {
|
} else if verificationDisabled {
|
||||||
@@ -68,6 +70,10 @@ func VerifyCertificate(parsedBundle *certutil.ParsedCertBundle) error {
|
|||||||
DisableNameConstraintChecks: false,
|
DisableNameConstraintChecks: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := entSetCertVerifyOptions(ctx, storage, issuerId, &options); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
certificate, err := convertCertificate(parsedBundle.CertificateBytes)
|
certificate, err := convertCertificate(parsedBundle.CertificateBytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
19
builtin/logical/pki/issuing/issuing_stubs_oss.go
Normal file
19
builtin/logical/pki/issuing/issuing_stubs_oss.go
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
// Copyright (c) HashiCorp, Inc.
|
||||||
|
// SPDX-License-Identifier: BUSL-1.1
|
||||||
|
|
||||||
|
//go:build !enterprise
|
||||||
|
|
||||||
|
package issuing
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
ctx509 "github.com/google/certificate-transparency-go/x509"
|
||||||
|
"github.com/hashicorp/vault/sdk/logical"
|
||||||
|
)
|
||||||
|
|
||||||
|
//go:generate go run github.com/hashicorp/vault/tools/stubmaker
|
||||||
|
|
||||||
|
func entSetCertVerifyOptions(ctx context.Context, storage logical.Storage, issuerId IssuerID, options *ctx509.VerifyOptions) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@@ -432,7 +432,7 @@ func (b *backend) pathIssueSignCert(ctx context.Context, req *logical.Request, d
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := issuing.VerifyCertificate(parsedBundle); err != nil {
|
if err := issuing.VerifyCertificate(sc.GetContext(), sc.GetStorage(), issuerId, parsedBundle); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user