Skip to content

Allow webauthn to be passed when issuing certs for web-based scp#22864

Merged
avatus merged 3 commits intomasterfrom
michaelmyers/web_scp_with_mfa
Mar 16, 2023
Merged

Allow webauthn to be passed when issuing certs for web-based scp#22864
avatus merged 3 commits intomasterfrom
michaelmyers/web_scp_with_mfa

Conversation

@avatus
Copy link
Copy Markdown
Contributor

@avatus avatus commented Mar 10, 2023

Currently, the web UI cannot download files from the console due to lack of MFA support. After the addition of #22528, we can pass a webauthn assertion response to generate certs. This allows the frontend to pass a param that includes their webautn assertion response and if it is present, will issue new certs. If MFA is required on the server and this key is not passed in, they will receive a "mfa required for file transfer" error, rather than a nebulous "key not found" error.

A frontend PR for this is needed and will be PRd again this branch once #22529 is merged to avoid conflicts

Comment thread lib/web/files.go Outdated
}

if req.webauthn != "" {
f.issueSingleUseCert(req.webauthn, httpReq, tc)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Don't forget to check the error here

Comment thread lib/web/files.go Outdated
}

if mfaReq.Required && query.Get("webauthn") == "" {
return nil, trace.BadParameter("MFA required for file transfer.")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If MFA is required, and MFA wasn't provided, should this be trace.AccessDenied instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah that makes sense. My original idea for BadParameter was "you didnt send in the parameter that was needed". I think I was in dev mode of "I need to send this parameter" but from the actual user's perspective, it makes more sense to say "You don't have access" . Thanks 👍

Comment thread lib/web/files.go Outdated
Comment thread lib/web/files.go
cert, err := f.authClient.GenerateUserCerts(httpReq.Context(), proto.UserCertsRequest{
PublicKey: key.MarshalSSHPublicKey(),
Username: f.ctx.GetUser(),
Expires: time.Now().Add(time.Minute).UTC(),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is 1 minute enough? Should we add a little buffer to account for clock drift, or is 1m what we use elsewhere too?

Copy link
Copy Markdown
Contributor Author

@avatus avatus Mar 13, 2023

Choose a reason for hiding this comment

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

1m is used in the same way for testing connections in Discovery. I think 1m is fine as this cert is being used directly after this in the same request handler and no where else. I suppose we could make the expiry shorter if we needed, but doesn't need to be longer.

Comment thread lib/web/files.go
}

if req.webauthn != "" {
err = f.issueSingleUseCert(req.webauthn, httpReq, tc)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

At first it wasn't clear to me what happens to the single use cert that gets issued. Maybe a godoc on issueSingleUseCert that explains that it configures tc to use the new cert would help.

@public-teleport-github-review-bot public-teleport-github-review-bot Bot removed the request for review from timothyb89 March 13, 2023 21:55
@avatus avatus force-pushed the michaelmyers/web_scp_with_mfa branch from a839a78 to 6def1f4 Compare March 15, 2023 22:08
@avatus avatus enabled auto-merge March 15, 2023 22:12
@avatus avatus added this pull request to the merge queue Mar 15, 2023
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Mar 15, 2023
@avatus avatus enabled auto-merge March 16, 2023 01:31
@avatus avatus added this pull request to the merge queue Mar 16, 2023
Merged via the queue into master with commit 3f0c74b Mar 16, 2023
avatus added a commit that referenced this pull request Mar 16, 2023
)

* Allow webauthn to be passed when issuing certs for web-based scp

* Remove extra line
avatus added a commit that referenced this pull request Mar 16, 2023
)

* Allow webauthn to be passed when issuing certs for web-based scp

* Remove extra line
avatus added a commit that referenced this pull request Mar 16, 2023
) (#23196)

* Allow webauthn to be passed when issuing certs for web-based scp

* Remove extra line
zmb3 pushed a commit that referenced this pull request Mar 17, 2023
) (#23195)

* Allow webauthn to be passed when issuing certs for web-based scp

* Remove extra line
@avatus avatus deleted the michaelmyers/web_scp_with_mfa branch August 21, 2023 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants