Skip to content

feat(agent): Add SSH max timeout option for coder agent #6596

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

Merged
merged 2 commits into from
Mar 15, 2023

Conversation

bensejas
Copy link
Contributor

Context

We want to users re-authenticate after a set period of time. This is achievable on the browser side but not once users are connected through SSH.

Changes

Add an option to set a max timeout for SSH connections on the coder agent.

Future work

@github-actions
Copy link

github-actions bot commented Mar 14, 2023

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@bensejas
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@kylecarbs
Copy link
Member

Exciting! It'd be nice to print out to TTY sessions why the connection is closing as well.

Would adding an additional authentication step to keep a connection alive be of interest? We could make this experience super slick in the VS Code extension as well... essentially just hanging all SSH connections until the user refreshes an authentication token.

@bensejas
Copy link
Contributor Author

bensejas commented Mar 14, 2023

It'd be nice to print out to TTY sessions why the connection is closing as well.

I'll have a look 👀

Would adding an additional authentication step to keep a connection alive be of interest?

That would be nice user experience. We are using a mix of VS Code and Intellij at the moment but anything would be nice.

@kylecarbs
Copy link
Member

By the way @bensejas we're happy to merge with the functionality this has right now if it's blocking you. No need to wait for a bunch more features!

@bensejas
Copy link
Contributor Author

Awesome, that would be good. Thanks @kylecarbs

Copy link
Member

@kylecarbs kylecarbs left a comment

Choose a reason for hiding this comment

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

I was going to suggest we add a test, but I don't think that's overly required since the value is just being piped through.

Be weary that users may report disconnection issues though, because this will just terminate things!

agent/agent.go Outdated
@@ -78,6 +78,7 @@ type Options struct {
EnvironmentVariables map[string]string
Logger slog.Logger
AgentPorts map[int]string
SshMaxTimeout time.Duration
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
SshMaxTimeout time.Duration
SSHMaxTimeout time.Duration

@bensejas
Copy link
Contributor Author

@kylecarbs I fixed up the linting and updated the test snapshot. It looks like I don't have permission to run the test workflows to check.

@kylecarbs
Copy link
Member

Approved! I'll merge once passing.

@kylecarbs kylecarbs merged commit 7076dee into coder:main Mar 15, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Mar 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants