You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recently on spire project, we needed to combine two matchers logic to correctly set the spire-server authorization logic, which should authorize spiffe ID that is either a member of the server trust domain or be included in a permissive list of admin IDs. Since the go-spiffe library doesn't provide this feature by default, we had to create a custom matcher and adapt it to a tlsconfig.Authorizer:
// matchMemberOrOneOf is a custom spiffeid.Matcher which will validate that the peerSpiffeID belongs to the server// trust domain or if it is included in the admin_ids configuration permissive list.funcmatchMemberOrOneOf(trustDomain spiffeid.TrustDomain, adminIds...spiffeid.ID) spiffeid.Matcher {
permissiveIDsSet:=make(map[spiffeid.ID]struct{})
for_, adminID:=rangeadminIds {
permissiveIDsSet[adminID] =struct{}{}
}
returnfunc(peerID spiffeid.ID) error {
if!peerID.MemberOf(trustDomain) {
if_, ok:=permissiveIDsSet[peerID]; !ok {
returnfmt.Errorf("unexpected trust domain in ID %q", peerID)
}
}
returnnil
}
}
...tlsconfig.AdaptMatcher(matchMemberOrOneOf(e.TrustDomain, e.AdminIDs...))
This feature request proposes to add new mechanisms to go-spiffe library so that we could combine authorizers into logical clauses; I find it valuable to have at least AND and OR combinators, something like:
Recently on spire project, we needed to combine two matchers logic to correctly set the spire-server authorization logic, which should authorize spiffe ID that is either a member of the server trust domain or be included in a permissive list of admin IDs. Since the go-spiffe library doesn't provide this feature by default, we had to create a custom matcher and adapt it to a
tlsconfig.Authorizer
:This feature request proposes to add new mechanisms to go-spiffe library so that we could combine authorizers into logical clauses; I find it valuable to have at least
AND
andOR
combinators, something like:I am willing to open a PR on this in case of approval, and I would like to get some opinions here. What do you think?
The text was updated successfully, but these errors were encountered: