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

systemd should document ways of locking down `systemctl --host` #13358

Open
kakra opened this issue Aug 19, 2019 · 9 comments
Open

systemd should document ways of locking down `systemctl --host` #13358

kakra opened this issue Aug 19, 2019 · 9 comments

Comments

@kakra
Copy link
Contributor

@kakra kakra commented Aug 19, 2019

Is your feature request related to a problem? Please describe.
We want to implement a management container that is sibling to other nspawn containers it manages. So far it was easy to get access to those containers using systemctl -H parenthost/machine restart some.service. We added an ssh-key so that machine can easily SSH to the host without requiring a password. But I wonder about security: I've found no documentation / clues about how to implement a wrapper or forced command on the SSH host side through authorized_key.

Describe the solution you'd like
systemd should come with an example wrapper or some documentation about how the SSH connection is actually used so admins can lock down such access with SSH forced commands.

@DemiMarie

This comment has been minimized.

Copy link

@DemiMarie DemiMarie commented Aug 20, 2019

The OpenSSH documentation has everything you need for this, in man 8 sshd. By disabling all forwarding, and forcing a specific command to be executed, it is possible to heavily lock-down key-based SSH. Such options can be specific to an individual SSH key, and need not be system-wide.

@kakra

This comment has been minimized.

Copy link
Contributor Author

@kakra kakra commented Aug 20, 2019

Yes, sure... I know how to do it because I'm using it all the time to lock down access by key, e.g. for backup access. All that's needed would be an example of which command systemctl -H ... actually sends to the SSH host (for both variants ... -H host/machine and ... -H host).

Actually, most other software has an example for this, i.e. borgbackup has an example. They don't say man 8 sshd has everything you need.

and forcing a specific command to be executed

Ah yes, here we are: Define "specific command".

Thanks. :-)

@boucman

This comment has been minimized.

Copy link
Contributor

@boucman boucman commented Aug 20, 2019

i'm pretty sure it's "systemd-stdio-bridge" which is used to connect it directly to dbus, but please check the source to make sure...

@kakra

This comment has been minimized.

Copy link
Contributor Author

@kakra kakra commented Aug 20, 2019

Okay, that's a starting point at least. I'll look into it and maybe create a patch for documentation. Thanks.

@doverride

This comment has been minimized.

Copy link
Contributor

@doverride doverride commented Aug 20, 2019

Yes something like this:

from="192.168.1.0/24",command="/usr/bin/systemd-stdio-bridge",no-port-forwarding,no-X11-forwarding,no-pty ssh-rsa ...
@kakra

This comment has been minimized.

Copy link
Contributor Author

@kakra kakra commented Sep 6, 2019

By coincidence, I found it's running ssh -xT -- HOSTNAME systemd-stdio-bridge --machine=MACHINENAME.

@melkamm12

This comment was marked as off-topic.

Copy link

@melkamm12 melkamm12 commented Dec 14, 2019

please sent ome gis projects every interested one via abiyuaxum@gmail.com

@foru007-del

This comment has been minimized.

Copy link

@foru007-del foru007-del commented Dec 14, 2019

I can't understand what are you people saying 😥😥

@foru007-del

This comment has been minimized.

Copy link

@foru007-del foru007-del commented Dec 14, 2019

Please tell me how could i learn this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
7 participants
You can’t perform that action at this time.