Skip to content

Add certificate rotation to teleport openssh join oneshot command #24194

Merged
lxea merged 6 commits intomasterfrom
lxea/adcr-client
May 22, 2023
Merged

Add certificate rotation to teleport openssh join oneshot command #24194
lxea merged 6 commits intomasterfrom
lxea/adcr-client

Conversation

@lxea
Copy link
Copy Markdown
Contributor

@lxea lxea commented Apr 6, 2023

Will have a follow up pr that updates the scripts and tries to execute certificate rotation

@lxea lxea force-pushed the lxea/adcr-client branch 2 times, most recently from 127886c to c6bb6f5 Compare April 7, 2023 15:46
@lxea lxea marked this pull request as ready for review April 7, 2023 15:46
Comment thread lib/config/configuration.go Outdated
Comment thread lib/config/configuration.go Outdated
Comment thread tool/teleport/common/teleport.go Outdated
Comment thread tool/teleport/common/agentless.go Outdated
Comment thread tool/teleport/common/agentless.go Outdated
Comment thread tool/teleport/common/agentless.go Outdated
Comment thread tool/teleport/common/agentless.go Outdated
Comment thread tool/teleport/common/agentless.go Outdated
Comment thread tool/teleport/common/agentless.go Outdated
Comment thread tool/teleport/common/agentless.go Outdated
Comment thread lib/config/configuration.go Outdated
Comment thread tool/teleport/common/agentless.go Outdated
Comment thread tool/teleport/common/agentless.go Outdated
Comment thread tool/teleport/common/agentless.go Outdated
Comment thread tool/teleport/common/agentless.go Outdated
Comment thread tool/teleport/common/agentless.go Outdated
Comment thread tool/teleport/common/agentless.go Outdated
Comment thread tool/teleport/common/agentless.go Outdated
Comment thread tool/teleport/common/agentless.go Outdated
Comment thread tool/teleport/common/agentless.go Outdated
@lxea lxea force-pushed the lxea/adcr-client branch from c6bb6f5 to 2d245e9 Compare April 11, 2023 15:04
@r0mant r0mant requested review from espadolini and removed request for ryanclark April 11, 2023 15:12
@lxea lxea force-pushed the lxea/adcr-client branch from 2d245e9 to 5f0ef9e Compare April 11, 2023 15:34
Copy link
Copy Markdown
Collaborator

@r0mant r0mant left a comment

Choose a reason for hiding this comment

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

First pass, just comments about code organization for now, will do another pass to review the rotation logic in more detail.

Comment thread tool/teleport/common/agentless.go Outdated
Comment thread tool/teleport/common/agentless.go Outdated
Comment thread tool/teleport/common/agentless.go Outdated
Comment thread tool/teleport/common/agentless.go Outdated
Comment thread tool/teleport/common/teleport.go Outdated
Comment thread tool/teleport/common/agentless.go Outdated
@lxea lxea force-pushed the lxea/adcr-client branch from 5f0ef9e to 9a12f77 Compare April 11, 2023 15:44
@lxea lxea force-pushed the lxea/adcr-client branch 6 times, most recently from 2d0c8a3 to c31c72d Compare April 24, 2023 08:45
Comment thread lib/config/configuration.go Outdated
Comment thread lib/openssh/sshd.go Outdated
Comment thread lib/openssh/sshd.go Outdated
Comment thread lib/openssh/sshd.go Outdated
Comment thread lib/openssh/sshd.go Outdated
Comment thread lib/openssh/sshd.go Outdated
Comment thread lib/service/connect.go Outdated
Comment thread lib/service/servicecfg/config.go Outdated
Comment thread lib/service/connect.go
Comment thread lib/service/connect.go Outdated
Comment thread lib/config/configuration.go Outdated
Comment thread lib/openssh/sshd.go Outdated
Comment thread lib/openssh/sshd.go Outdated
Comment thread lib/service/connect.go Outdated
Comment thread lib/service/service.go Outdated
Comment thread lib/service/connect.go Outdated
Comment thread lib/service/connect.go Outdated
Comment thread tool/teleport/common/teleport.go Outdated
Comment thread lib/service/connect.go
Comment thread lib/service/connect.go
@lxea lxea force-pushed the lxea/adcr-client branch from 3566639 to 32dd4ce Compare April 26, 2023 10:03
@r0mant
Copy link
Copy Markdown
Collaborator

r0mant commented May 2, 2023

@lxea Is this ready for another review?

@lxea
Copy link
Copy Markdown
Contributor Author

lxea commented May 2, 2023

@lxea Is this ready for another review?

Yeah, I think i've gotten most of the comments

@espadolini espadolini self-requested a review May 2, 2023 11:09
@lxea lxea force-pushed the lxea/adcr-client branch from 32dd4ce to 73d7161 Compare May 2, 2023 12:13
@r0mant r0mant requested review from r0mant and russjones May 2, 2023 15:54
@lxea lxea force-pushed the lxea/adcr-client branch 5 times, most recently from 45340c3 to 44d52f8 Compare May 16, 2023 11:13
Copy link
Copy Markdown
Collaborator

@r0mant r0mant left a comment

Choose a reason for hiding this comment

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

lgtm

@lxea Can you please also write an integration test for this? Right now it's very lightly tested so I'm concerned there will be regressions.

We can do it in a follow-up PR. The test would configure/start this new openssh_service and make sure it fetches proper credentials from the cluster, places them where needed and calls the provided restart command.

Comment thread lib/config/configuration.go Outdated
Comment thread lib/openssh/sshd.go Outdated
Comment thread lib/service/connect.go Outdated
@lxea lxea force-pushed the lxea/adcr-client branch from 44d52f8 to 2e05c3d Compare May 16, 2023 15:28
@espadolini espadolini self-requested a review May 16, 2023 16:03
Comment thread lib/config/configuration.go Outdated
Comment thread lib/openssh/sshd.go Outdated
Comment on lines 155 to 160
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This tripped me up really badly, as it's a very common unsafe file manipulation pattern - writeTempAndRename creates files with restrictive 600 permissions already, so this is fine (if unnecessary), but it's not documented to do so. Add some docs to writeTempAndRename to clarify that this is the case.

Comment thread lib/openssh/sshd.go Outdated
Comment thread lib/openssh/sshd.go Outdated
Comment thread lib/openssh/sshd.go Outdated
Comment thread lib/openssh/sshd.go Outdated
Comment thread lib/service/connect.go Outdated
Comment thread lib/service/connect.go Outdated
Comment thread lib/service/servicecfg/openssh.go Outdated
Comment thread lib/service/servicecfg/openssh.go Outdated
@lxea lxea force-pushed the lxea/adcr-client branch 2 times, most recently from 8ca8905 to c14d42a Compare May 17, 2023 14:26
Copy link
Copy Markdown
Contributor

@espadolini espadolini left a comment

Choose a reason for hiding this comment

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

LGTM other than figuring out what's up with the shutdown.

Alex McGrath added 6 commits May 22, 2023 11:06
Fix agentless test

Resolve comments

refactor to use existing rotation/backend

resolve comments

resolve comments

Use a comma separated additional-principals

resolve comments

resolve some comments

resolve comments

resolve comments

add sshd_test

remove openssh from config.Configure

just use current time for registerServer rotation

resolve comments
@lxea lxea force-pushed the lxea/adcr-client branch from 0fa836c to 8d55488 Compare May 22, 2023 10:06
@lxea lxea added this pull request to the merge queue May 22, 2023
Merged via the queue into master with commit 237954a May 22, 2023
@lxea lxea deleted the lxea/adcr-client branch May 22, 2023 12:39
@public-teleport-github-review-bot
Copy link
Copy Markdown

@lxea See the table below for backport results.

Branch Result
branch/v13 Failed

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.

5 participants