forked from TrueCloudLab/certificates
Add K8sSA SSH user policy back
According to the docs, the K8sSA provisioner can be configured to issue SSH user certs.
This commit is contained in:
parent
5f0dc42b1e
commit
d8776d8f7f
2 changed files with 8 additions and 2 deletions
|
@ -56,6 +56,7 @@ type K8sSA struct {
|
||||||
ctl *Controller
|
ctl *Controller
|
||||||
x509Policy policy.X509Policy
|
x509Policy policy.X509Policy
|
||||||
sshHostPolicy policy.HostPolicy
|
sshHostPolicy policy.HostPolicy
|
||||||
|
sshUserPolicy policy.UserPolicy
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetID returns the provisioner unique identifier. The name and credential id
|
// GetID returns the provisioner unique identifier. The name and credential id
|
||||||
|
@ -148,6 +149,11 @@ func (p *K8sSA) Init(config Config) (err error) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initialize the SSH allow/deny policy engine for user certificates
|
||||||
|
if p.sshUserPolicy, err = policy.NewSSHUserPolicyEngine(p.Options.GetSSHOptions()); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize the SSH allow/deny policy engine for host certificates
|
// Initialize the SSH allow/deny policy engine for host certificates
|
||||||
if p.sshHostPolicy, err = policy.NewSSHHostPolicyEngine(p.Options.GetSSHOptions()); err != nil {
|
if p.sshHostPolicy, err = policy.NewSSHHostPolicyEngine(p.Options.GetSSHOptions()); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -298,7 +304,7 @@ func (p *K8sSA) AuthorizeSSHSign(ctx context.Context, token string) ([]SignOptio
|
||||||
// Require and validate all the default fields in the SSH certificate.
|
// Require and validate all the default fields in the SSH certificate.
|
||||||
&sshCertDefaultValidator{},
|
&sshCertDefaultValidator{},
|
||||||
// Ensure that all principal names are allowed
|
// Ensure that all principal names are allowed
|
||||||
newSSHNamePolicyValidator(p.sshHostPolicy, nil),
|
newSSHNamePolicyValidator(p.sshHostPolicy, p.sshUserPolicy),
|
||||||
), nil
|
), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,7 @@ func Test_normalizeAndValidateEmailConstraint(t *testing.T) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "fail/idna-internationalized-domain",
|
name: "fail/idna-internationalized-domain",
|
||||||
constraint: `mail@xn--bla.local`,
|
constraint: "mail@xn--bla.local",
|
||||||
want: "",
|
want: "",
|
||||||
wantErr: true,
|
wantErr: true,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue