support proxy db tunnel mfa access#16958
Conversation
|
@greedy52 @smallinsky this is ready I think. I've addressed your feedback regarding adding some context before prompting the user for MFA and I've made the integration test more robust using a fake clock to mock cert expiration. |
|
@GavinFrazar can be reused for tsh proxy db though in current flow always renews the certs: Also the: ``Local proxy tunnel requires credentials to access database "postgres01"` log entry might be a bit confusing for a user. I would keep this more like a debug log because no user action is needed in this case. In case of MFA flow right now following message is printed: Could we emphasise in the log entry that local proxy that this is MFA flow ? @xinding33 Could you take a look at UX changes ? |
This is so we can check if the error is recoverable while preparing local proxy options. A tunneled local proxy can ignore the error because it does not rely on cert files - it can just renew its certs if necessary.
Done.
Done. See: |
smallinsky
left a comment
There was a problem hiding this comment.
Linter seems to fail on a = a + 1 rule but otherwise LGTM.
|
@GavinFrazar See the table below for backport results.
|
Closes #12538
This PR adds MFA support for
tsh proxy db --tunnel- the basic problem with MFA is that the certs are short-lived and expire after 1 minute, which means the local proxy only worked for 1 minute before this PR.I added middleware to
alpnproxy.LocalProxywhich is invoked when the proxy starts and then on each new connection to check/renew database certs.The database certs are kept in memory only, in preparation for approval of RFD 90 #16739.
The main thing I've left out of this PR is adjusting the TTL for database mfa certs, as that will required RFD approval before implementing.
edit: For now, the UX improves from a broken local proxy every minute, to an MFA check every minute. The RFD will significantly improve the UX further, I'm making this PR sooner than RFD approval since the middleware is needed to unblock Teleport Connect team.
@ravicious
edit:
UX Change
Before
local proxy:
mysql:
After:
local proxy:
mysql:
And local proxy without MFA required (doesn't print a prompt context message before "Tap any security key"):
OTP local proxy works too, but you need to pass an mfa auth preference (this is true for
tsh db loginas well)