Hits : 361
This tutorial is being written to help you install Drop Bear to a chroot environment.
It covers the below sections:
* Installation of Drop Bear
* Setup Drop Bear
* Setup Chroot Enviroment
* Debug Chrooted Drop Bear
Dropbear is a relatively small SSH 2 server and client.
It is an alternative lightweight program of
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
In our installation we choose: /chroot/dropbear as the root path of our chroot environment
And for educational purpose only, we change the default TCP port of ssh to 2222:
Simple as that:
The default installation process:
The next step is to create dss & rsa keys for dropbear ssh server.
We must create the dropbear's key folder first:
and then:
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.
We now have to check all the necessaries shared libraries that dropbear needs to run inside a chroot environment
This libraries are mostly for the authentication process.
Copy necessaries files from root to chroot
We now must be very careful with the next step of our process.
We have to create all the necessaries devices for dropbear to run
(Remember, we are always on the chroot path – eg. /chroot/dropbear)
Of course we need to add users to our chroot dropbear setup.
You can choose to add an existence user or you can create a new one.
I prefer to add an existence user (eg. ebal):
Every user needs a shell!
But we dont need to install bash, we can simple use busybox.
Busybox is a lightweight shell and combines a lot of common unix utils into a small executable binary file.
This 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.
Finally we are ready to run Drop Bear from a chroot enviroment:
But if something goes wrong, we can always debug the running process with strace: