-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Always issue relogin and per-session mfa requests for the root cluster URI #42355
Changes from 4 commits
95f5beb
263c323
68c79ec
d3ad8ef
404976b
239d3b5
31cdaba
a6b7484
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -263,7 +263,7 @@ func (s *Service) ResolveClusterURI(uri uri.ResourceURI) (*clusters.Cluster, *cl | |
|
||
// Custom MFAPromptConstructor gets removed during the calls to Login and LoginPasswordless RPCs. | ||
// Those RPCs assume that the default CLI prompt is in use. | ||
clusterClient.MFAPromptConstructor = s.NewMFAPromptConstructor(cluster.URI.String()) | ||
clusterClient.MFAPromptConstructor = s.NewMFAPromptConstructor(cluster.URI) | ||
return cluster, clusterClient, nil | ||
} | ||
|
||
|
@@ -346,7 +346,7 @@ func (s *Service) createGateway(ctx context.Context, params CreateGatewayParams) | |
LocalPort: params.LocalPort, | ||
OnExpiredCert: s.reissueGatewayCerts, | ||
KubeconfigsDir: s.cfg.KubeconfigsDir, | ||
MFAPromptConstructor: s.NewMFAPromptConstructor(targetURI.String()), | ||
MFAPromptConstructor: s.NewMFAPromptConstructor(targetURI), | ||
ClusterClient: clusterClient, | ||
} | ||
|
||
|
@@ -370,7 +370,7 @@ func (s *Service) createGateway(ctx context.Context, params CreateGatewayParams) | |
// per-session MFA checks. | ||
func (s *Service) reissueGatewayCerts(ctx context.Context, g gateway.Gateway) (tls.Certificate, error) { | ||
reloginReq := &api.ReloginRequest{ | ||
RootClusterUri: g.TargetURI().GetClusterURI().String(), | ||
RootClusterUri: g.TargetURI().GetRootClusterURI().String(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is correct, the relogin request should always use the URI of a root cluster. Otherwise the login modal targets a leaf cluster (but through the root cluster, not directly) and I'm not sure what really happens there. Perhaps the handlers for login should also verify if they received URI to a root cluster rather than a leaf? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Good idea, added. |
||
Reason: &api.ReloginRequest_GatewayCertExpired{ | ||
GatewayCertExpired: &api.GatewayCertExpired{ | ||
GatewayUri: g.URI().String(), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's fine for now, but in a completely new code it'd have been better to convert the string into
uri.ResourceURI
, then check if it points to a root cluster and only then calls.DaemonService.ResolveClusterURI
.