Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mfa: don't check MFA for teleport services in UpsertKubeService #6129

Merged
merged 1 commit into from
Mar 24, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/auth/auth_with_roles.go
Original file line number Diff line number Diff line change
Expand Up @@ -2625,8 +2625,14 @@ func (a *ServerWithRoles) UpsertKubeService(ctx context.Context, s services.Serv
if err != nil {
return trace.Wrap(err)
}
_, isService := a.context.Checker.(BuiltinRoleSet)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can only kube service do this? There's hasBuiltinRole if you wanted to check for only kube service here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kube or Proxy.
We already have this enforced in e.g. https://github.com/gravitational/teleport/blob/master/lib/auth/permissions.go#L547, I'd rather not duplicate that authz logic here.

isMFAVerified := a.context.Identity.GetIdentity().MFAVerified != ""
mfaParams := services.AccessMFAParams{
Verified: a.context.Identity.GetIdentity().MFAVerified != "",
// MFA requirement only applies to users.
//
// Builtin services (like proxy_service and kube_service) are not gated
// on MFA and only need to pass the RBAC action check above.
Verified: isService || isMFAVerified,
AlwaysRequired: ap.GetRequireSessionMFA(),
}
for _, kube := range s.GetKubernetesClusters() {
Expand Down