4 ms·
I don't. When I was setting this up I didn't find any guides or blogs about doing this so I thought it was not of interest to anyone. So I just went about imple
by X86BSD 9y ago
I don't. When I was setting this up I didn't find any guides or blogs about doing this so I thought it was not of interest to anyone. So I just went about implementing it a piece at a time. Installing pam_jail, then getting /etc/pam.d/sshd configured to use it (which is a one-line addition, very easy). Now by default pam_jail simply puts the user into a jail of their home directory. This is where you can go a few routes with this. If simply jailing the user on the host OS to their home directory is all you are interested in doing you can stop there. Configure FreeBSD to not allow users to see other processes, user processes and group processes not owned by them, and they won't know anyone else is on the system.
security.bsd.see_other_gids
security.bsd.see_other_uids
The above are the two sysctl's you want to enable.
A simple ps will show you all the shells that are in a jail.
Tue 19 7:19PM priyanka.setecastronomy ~> ps -x
PID TT STAT TIME COMMAND
30308 - S 0:00.05 sshd: oracle@pts/0 (sshd)
Now you have the tty he/she is on (pts/0). There are many ways to get that including ps so use whatever method you prefer to get the tty.
Fire up watch to snoop on the tty.
Tue 19 7:48PM priyanka.setecastronomy ~> doas watch pts/0
And boom, you can watch the ankle biter do his/her thing.
You can do this on the host as described, because that is how pam_jail works. But if you prefer for some reason to make an actual jail with VNET etc and do this simply forward ssh on the host to the jail's IP. If you do rate limiting you will already be configuring pf or ipfw anyway so an extra line to forward 22 to the jail host is not big deal.
Yeah this is a crappy write-up but it's spur of the moment and in a HN reply post so it's worth the price paid.
I'm happy to answer questions or help you if you get stuck anyway I can just message me. It's pretty simple to do.
If this is in a corporate setting I would consult with legal before doing this. The world is a whacky place these days, and if the ankle biter does something evil from your honeypot jail you may be liable.
- artursapek 9y agoYou know what would be cool? Piping these sessions to a web frontend and letting people watch these attempts in real time (or recorded) using a JS terminal emulator to display it all. I would sit there and watch that.
- X86BSD 9y agoThat would be pretty cool!
- askz 9y agoNeat! I'd love to help!
- dotancohen 9y agoI would pipe it to an LCD in an old fish tank. Oh, look honey, this one's trying to use GNU options! Here's one who thinks he's on Ubuntu! Wow, I didn't know VIM could do _that_!
- nl5874 9y agoTake a look at http://honeycast.io/#!/0f9465db-3c01-49ba-9d81-16b1fd68627c http://honeycast.io/#!/0f9465db-3c01-49ba-9d81-16b1fd68627c. We are working on a new version of our honeypot software. The feature you mention will be supported.
- artursapek 9y agoWow, everything I think of already exists. Nice.
- samstave 9y agoThis is great and should be something everyone should know how to do. Please write a more formal write-up
- clan 9y agoMiss World 2000 has "Too many secrets"... Love those references. If you have not seen it yet go watch Sneakers (1992). I am getting old - I remember when it was fresh :-)