Permissions: a certificates role
A template for tokens and users that get certificates for other hosts (jarl cert get): certificates:write, to narrow with names= in the web UI's "Insert a template…", or --role certificates in the CLI. The token form's template filter no longer counts "*" as covering certificates, as the server doesn't. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b367e0c830
commit
310ed8061e
7 files changed
+29
-4
No files matched your search
@@ -135,6 +135,16 @@ func TestRoleTemplatesValid(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestCertificatesRole(t *testing.T) {
|
||||
p := &Principal{User: &model.User{Grants: RoleTemplates["certificates"]}}
|
||||
if !p.Can(Action{Resource: ResCerts, Write: true, Name: "web01.adbraun.lol"}) {
|
||||
t.Error("the certificates role can't get a certificate")
|
||||
}
|
||||
if p.Can(Action{Resource: ResRecords, Write: true, Zone: "adbraun.lol."}) || p.Can(Action{Resource: ResZones, Zone: "adbraun.lol."}) {
|
||||
t.Error("the certificates role reaches beyond certificates")
|
||||
}
|
||||
}
|
||||
|
||||
func TestCertificateGrants(t *testing.T) {
|
||||
g, err := ParseGrant("certificates:write names=*.adbraun.lol")
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user