Skip to content
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

Added new OpenSSH break glass admin management operations guide #49804

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

deusxanima
Copy link
Contributor

Added guide with instructions on how to configure OpenSSH break glass access with Teleport CA signed certificates for out-of-band access if Teleport server resources or cluster servers become unavailable and/or unresponsive.

Copy link

github-actions bot commented Dec 5, 2024

🤖 Vercel preview here: https://docs-5h5xxnof7-goteleport.vercel.app/docs

sudo visudo
```

3. Grant limited sudo permissions:
Copy link
Contributor

Choose a reason for hiding this comment

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

There is no way to grant limited permissions while allowing for emergency system maintenance; case in point, we suggest systemctl which, as root, can just spawn any command with root privileges as a unit (among many other ways) and we suggest vim, which can just edit /etc/sudoers to begin with.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm...great points. Would it make more sense then to just remove this section entirely?

Copy link
Contributor

Choose a reason for hiding this comment

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

Honestly, sometimes people want a little security theatre - restricted shells are a very common request.

With that said, I think for break glass access having command restrictions may inhibit people from fixing issues and it's best to just allow root permissions through sudo. Any use of the break glass access should always be audited via sshd access logs anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

great feedback. I'll clean it up and put up a new version with the recommended changes/feedback

Run the following after logging into Teleport via `tsh login` as the impersonating user:

```bash
tctl auth sign --ttl 24h --user=breakglass --out=/safe/path/breakglass --format openssh
Copy link
Contributor

Choose a reason for hiding this comment

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

This user certificate is (or, at least, I really hope is) issued by the user CA, which is the signer that signs all the user certs that are given out to users, but above we configured opensshd to trust the openssh CA, which signs certificates that are only ever in possession of the proxy - a regular user won't be able to obtain such a certificate.

Copy link
Contributor Author

@deusxanima deusxanima Dec 6, 2024

Choose a reason for hiding this comment

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

Interesting. From what I can see, it looks like the CA that's exported with the proxy via the https://proxy.example.com/webapi/auth/export?type=openssh endpoint, is of type "user" instead of OpenSSH according to the extension appended at the end:
e.g.:

cert-authority ssh-rsa <my_ca> clustername=alen.teleport.sh&type=user

I can confirm that passing type=user instead during the export produces a different CA, but if the former is not expected to work with user certs generated via tctl auth sign ... --format openssh, there may be another problem altogether as I can get it to work reliably right now (unless again I'm turned around on this and misunderstanding, which very likely could be the case)

Run the following after logging into Teleport via `tsh login` as the impersonating user:

```bash
tctl auth sign --ttl 24h --user=breakglass --out=/safe/path/breakglass --format openssh
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the cluster admin supposed to renew this break glass cert every day? If not, how are you supposed to get a certificate signed by the control plane if the control plane is down?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That was my recommendation a bit further down in this section:

Rotate both keys and certificates regularly, making sure to refresh both before the expiration TTL

Copy link
Contributor

@webvictim webvictim Dec 7, 2024

Choose a reason for hiding this comment

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

We probably need to make this a lot more obvious so people don't inadvertently get locked out. Maybe describe how to run the command as a cron job or systemd timer which will write a certificate every 12 hours so it can be picked up?

It would also be good to describe how to do this end to end with a machine ID job - that can be a task for version 2 of the guide though.

2. Create an authorized_principals file for the `breakglass` user

```bash
echo "breakglass" | sudo tee /etc/ssh/authorized_principals/breakglass
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of this whole machinery, can't we just create a breakglass user and make it trust the appropriate CA by putting it in ~breakglass/.ssh/authorized_keys with the appropriate principals restriction?

Copy link
Contributor

Choose a reason for hiding this comment

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

We could even do that for the root user, and make it require a principal of root-breakglass or something that won't accidentally be assigned as a login name to regular Teleport users.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Instead of this whole machinery, can't we just create a breakglass user and make it trust the appropriate CA by putting it in ~breakglass/.ssh/authorized_keys with the appropriate principals restriction?

I actually had this in the original setup but after some discussion with a few other folks went with the authorized_principals approach instead for the PR. Happy to switch it back if you think it simplifies things, and I like your recommendation of also doing the same thing for the root user so if makes sense to switch back I can tackle both at once in the updated commit.

Copy link
Contributor

@webvictim webvictim left a comment

Choose a reason for hiding this comment

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

Comments

@ptgott
Copy link
Contributor

ptgott commented Dec 18, 2024

Hi @deusxanima, would this PR address #3760? It's one of our oldest docs issues, so it'd be great to see it cleared!

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.

4 participants