this post was submitted on 23 Jul 2023
50 points (96.3% liked)

Selfhosted

61593 readers
577 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

Detailed Rules Post

  1. Be civil.

  2. No spam.

  3. Posts are to be related to self-hosting.

  4. Don't duplicate the full text of your blog or readme if you're providing a link.

  5. Submission headline should match the article title.

  6. No trolling.

  7. Promotion posts require active participation, with an account that is at least 30 days old. F/LOSS without a paywall has exceptions, with requirements. See the rules link for details. Tags [CBH] or [AIP] are required, see the links in Rule 8 for details.

  8. AI-related discussions and AI-involved promotional posts have additional requirements for tagging, as noted in Rule 7 and the AI & Promotional Post Expanded Rules post, and find example disclosures here.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 3 years ago
MODERATORS
 

I have too many machines floating around, some virtual, some physical, and they're getting added and removed semi-frequently as I play around with different tools/try out ideas. One recurring pain point is I have no easy way to manage SSH keys around them, and it's a pain to deal with adding/removing/cycling keys. I know I can use AuthorizedKeysCommand on sshd_config to make the system fetch a remote key for validation, I know I could theoretically publish my pub key to github or alike, but I'm wondering if there's something more flexible/powerful where I can manage multiple users (essentially roles) such that each machine can be assigned a role and automatically allow access accordingly?

I've seen Keyper before, but the container haven't been updated for years, and the support discord owner actively kicks everyone from the server, even after asking questions.

Is there any other solution out there that would streamline this process a bit?

you are viewing a single comment's thread
view the rest of the comments
[–] kool_newt@lemm.ee 4 points 3 years ago (1 children)

This is a common pattern, typically called a "jump host" or "bastion host".

a script to cat my priv key through the relay

When it comes to security, I typically recommend against rolling your own. SSH already has agent forwarding option to do this securely and the -J option to accomplish the same without even needing to forward the key. The agent can seem complex at first, it's actually pretty simple and worth learning.

Feel free to message me if you have more questions, I've got lots of experience w/ SSH.

[–] InverseParallax@lemmy.world 2 points 3 years ago* (last edited 3 years ago) (1 children)

I did not know -J, I rolled my own because I've been doing it forever and many of my tricks (non-ssh included) aren't as easily portable across different os's.

For some reason ssh-copy-id has been failing for me sometimes lately because it can't reach the agent, while cat always works, but I never learned much about the user agent, let me look into that now, thanks for the tip!

[–] kool_newt@lemm.ee 1 points 3 years ago

I think -J is newer and may not work if you have distro versions older than like 5 years (eg. Centos 7 or before). There is a less convenient syntax that does the same thing though

$ ssh -o ProxyCommand="ssh -W %h:%p bastion-host" remote-host

See: https://www.redhat.com/sysadmin/ssh-proxy-bastion-proxyjump