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

find /root/.ssh/authorized_keys on top of agent keys #151

Closed
anarcat opened this issue Feb 19, 2020 · 4 comments · Fixed by #153
Closed

find /root/.ssh/authorized_keys on top of agent keys #151

anarcat opened this issue Feb 19, 2020 · 4 comments · Fixed by #153

Comments

@anarcat
Copy link
Contributor

anarcat commented Feb 19, 2020

We use grml-debootstrap as a simple installer here. It means we're running on a remote rescue shell, which we login to over SSH. It has no SSH keys in an agent because there's no agent running, so ssh-add -L fails when we pass -sshcopyid.

But we do have keys in /root/.ssh/authorized_keys because that's how our bootstrap works. So could we instead be a little smarter here and find those keys automatically?

@mika
Copy link
Member

mika commented Feb 25, 2020

Yes I totally agree, the ssh-add -L approach is not really user friendly and ssh-ing into the system is something we definitely want to have working as simple as possible without opening a security hole though, also see #139

I'd appreciate any work in this area!

@anarcat
Copy link
Contributor Author

anarcat commented Feb 25, 2020

without opening a security hole though, also see #139

... what are we concerned about here specifically? password logins are disabled, right?

I'd appreciate any work in this area!

this simple post-script could be merged into grml-bootstrap fairly easily:

AUTHORIZED_KEYS_SOURCE=${AUTHORIZED_KEYS_SOURCE:-$HOME/.ssh/authorized_keys}
AUTHORIZED_KEYS_TARGET=${AUTHORIZED_KEYS_TARGET:-$MNTPOINT/root/.ssh/}
echo "I: copying $AUTHORIZED_KEYS_SOURCE to "$AUTHORIZED_KEYS_TARGET""
mkdir -p "$AUTHORIZED_KEYS_TARGET"
chmod 0700 "$AUTHORIZED_KEYS_TARGET"
cp $AUTHORIZED_KEYS_SOURCE "$AUTHORIZED_KEYS_TARGET"

@mika
Copy link
Member

mika commented Feb 25, 2020

... what are we concerned about here specifically? password logins are disabled, right?

Yeah, password logins as user root no longer work, while this has been something that users relied on in the past.

this simple post-script could be merged into grml-bootstrap fairly easily:

LGTM, would you mind providing a PR for integration? :)

@anarcat
Copy link
Contributor Author

anarcat commented Feb 25, 2020

sure, see #153!

@mika mika closed this as completed in 07e835e Jun 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants