Chrooted Drop Bear HowTo
Chrooted Drop Bear HowToThis tutorial is being written to help you install Drop Bear to a chroot environment. It covers the below sections:
* Installation of Drop Bear
Drop BearDropbear is a relatively small SSH 2 server and client. It is an alternative lightweight program for openssh and it is designed for environments with low memory and processor resources, such as embedded systems. http://matt.ucc.asn.au/dropbear/dropbear.html
InstallationDownloadwget -c http://matt.ucc.asn.au/dropbear/releases/dropbear-0.52.tar.bz2
Extracttar jxf dropbear-0.52.tar.bz2
ConfigurationIn our installation we choose: /chroot/dropbear as the root path of our chroot environment. And for educational purposes only, we change the default TCP port of ssh to 2222: cd
dropbear-0.52
CompilationSimple as that: make
InstallationThe default installation process: make install
KeysThe next step is to create dss & rsa keys for dropbear ssh server. We must create the dropbear's key folder first: mkdir -pv /chroot/dropbear/etc/dropbear And then: /chroot/dropbear/bin/dropbearkey
-t dss -f /chroot/dropbear/etc/dropbear/dropbear.dss As you can see, we used the chroot environment path without the need of our distribution path hierarchy. The Drop Bear's keys are already installed to our chroot environment at once.
Shared LibrariesWe now have to check all the necessary shared libraries that dropbear needs to run inside a chroot environment: ldd /chroot/dropbear/sbin/dropbear
Chroot EnvironmentStructurecd
/chroot/dropbear/
Librariescp
/lib/libutil.so.1 lib/
Extra LibrariesThis libraries are mostly for the authentication process. cp
/lib/libnss_dns.so.2 lib/
FilesCopy necessaries files from root to chroot: cp
/etc/localtime etc/
DevicesWe now must be very careful with the next step of our process. We have to create all the necessary devices for dropbear to run. (Remember, we are always on the chroot path – eg. /chroot/dropbear.) mknod
dev/urandom c 1 9
UsersOf course we need to add users to our chroot dropbear setup. You can choose to add an existing user or you can create a new one. I prefer to add an existing user (eg. ebal): grep
^ebal /etc/passwd > etc/passwd
ShellEvery user needs a shell! But we don't need to install bash, we can simply use busybox. Busybox is a lightweight shell and combines a lot of common unix utils into a small executable binary file. cp
/etc/shells etc/
Mount PointsThis is the most important thing that we (you) have to do properly. The new environment needs access to terminals (this is necessary for a user to login) and to proc filesystem. mount
-o bind /dev/pts dev/pts/
RunFinally we are ready to run Drop Bear from a chroot enviroment: chroot
/chroot/dropbear/ \
DebugBut if something goes wrong, we can always debug the running process with strace: strace -f chroot /chroot/dropbear/ \
|



Recent comments
1 day 6 hours ago
1 day 6 hours ago
1 day 11 hours ago
1 day 18 hours ago
1 day 19 hours ago
1 day 20 hours ago
2 days 37 min ago
2 days 7 hours ago
2 days 11 hours ago
2 days 12 hours ago