-
Notifications
You must be signed in to change notification settings - Fork 30
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
[idea] Alternative way to ssh into jails by using jexec users on the host #38
Comments
revisiting this i think it would be a good step in the direction of 'container-ization'. containers are defined as being 'managed from the outside' whereas 'traditional' virtualisation is 'managed from the inside'. it would need to be a per-jail configuration, obviously. basically it would mean, we have a) ssh access via proxy command + sshd inside jail a) would be convenient for cases where devops have full access to the jailhost anyway at any rate, i want to take another look and most importantly test the abovementioned shell script. this post is just a public reminder for me to do this :) |
It would probably be quite hard to get working with Fabric, one would have to fiddle with env.shell somehow. Not impossible, but tricky to get right. |
I have very little experience with this sort of thing and don't know if this works, but could this be done with ssh key commands? cat .ssh/authorized_keys
... Where 'sbin/script' will receive the name of the jail through stdin (probably from 'ploy ssh') and run ezjail console. This assumes the script is running checks to make sure the specified value doesn't contain special shell characters or anything. Of course, you don't want the root account to always redirect to a jail, so you could have a dedicated user that has the NOPASSWD privilege to run ezjail console. The script can even be expanded to limit certain ssh keys to one set of jails (ploy ssh is still specifying one jail; the arguments after script are the list of allowed jails) cat /home/jail/.ssh/authorized_keys
If the jail requested by 'ploy ssh' isn't specified in the arguments, it prints an error, logs a message, and halts. What do you think? Does this make any sense? |
Instead of launching sshd on every jail, allow sshing into various jails by using jexec. One approach to accomplish this is to add dedicated users on the host system (use either user name or gecos to define jail name).
E.g.
/etc/group
on host:/usr/local/etc/sudoers
on host:/etc/master.passwd
on host:The following shell script could be used in the example above (/usr/local/bin/jexecsh):
This takes advantage of jail names being defined in FreeBSD 10 (my.jail.name turns into my_jail_name).
Instead of using name/gecos, different mechanisms could be used to determine which jail to use to execute commands, including the users home directory (pwd) or storing it in a dedicated configuration file like
$HOME/.jexec
or simply adding dedicated commands to.ssh/authorized_keys
.One could think of other mechanisms of multiplexing jexec calls for multiple jails over a single user (or various users for accountability). The advantage of the approach above is, that is allows for a relatively natural syntax when accessing the jail from the outside:
Yet another approach could be playing with Match rules in the host's
/etc/ssh/sshd_config
.Discuss ;)
The text was updated successfully, but these errors were encountered: