Skip to content

Commit 0fb49c3

Browse files
cleanup
1 parent 218d688 commit 0fb49c3

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

path_certs.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -329,12 +329,13 @@ func (b *keyfactorBackend) pathIssueSignCert(ctx context.Context, req *logical.R
329329
var valid bool
330330
var hasSuffix bool
331331

332+
// check the allowed domains for a match.
332333
for _, v := range role.AllowedDomains {
333334
b.Logger().Warn(v)
334-
if strings.HasSuffix(cn.(string), v) {
335+
if strings.HasSuffix(cn.(string), v) { // if it has the suffix..
335336
hasSuffix = true
336-
if cn.(string) == v || role.AllowSubdomains {
337-
valid = true
337+
if cn.(string) == v || role.AllowSubdomains { // and there is an exact match, or subdomains are allowed..
338+
valid = true // then it is valid
338339
}
339340
}
340341
}
@@ -350,9 +351,6 @@ func (b *keyfactorBackend) pathIssueSignCert(ctx context.Context, req *logical.R
350351
return nil, err_resp
351352
}
352353

353-
b.Logger().Warn("role.AllowedBaseDomain = " + role.AllowedBaseDomain)
354-
b.Logger().Warn("domain for cert = " + cn.(string))
355-
356354
for u := range dns_sans {
357355
if !strings.Contains(dns_sans[u], role.AllowedBaseDomain) || strings.Contains(dns_sans[u], role.AllowedBaseDomain) && !role.AllowSubdomains {
358356
return nil, fmt.Errorf("Subject Alternative Name " + dns_sans[u] + " not allowed for provided role")

0 commit comments

Comments
 (0)