1 user browsing this thread: (0 members, and 1 guest).
|
How-to: Install and Configure Dropbear on the PCH
|
|
09-21-2008, 07:19 PM
(This post was last modified: 10-05-2008 08:52 PM by racanu.)
Post: #1
|
|||
|
|||
|
How-to: Install and Configure Dropbear on the PCH
Introduction
This guide aims to describe the steps I had to take to get dropbear installed on my system. I've searched a lot for this information and finally got it working. Most of what is described here can be found elsewhere. The added value is that it is all gathered together for the benefit of anyone who wants to do the same (including myself). I use my PopCornHour (PCH) as a networked-attached storage (NAS) where I place my media files but also other documents. My goal was to achieve a secure connection to PCH from outside my network and to be able to:
Everything I describe here is strictly tailored to my environment and my goals and may not be suitable for anything else. So use the guide wisely and don't take anything to the letter. My main work environment is Windows. I use Linux inside virtual machines and occasionaly boot a LiveCD. Building the Cross-compilation Toolchain Download and install VmWare. Download the Debian Etch 4.0 VmWare image (other distributions of your choice may also be used). Download the Syabas NMT (SMP8634) toolchain and place it in the ~/popcorn/smp directory. In the Debian image some packages were missing, so I had to install them: Code: apt-get install flexUnpack the toolchain: Code: cd ~/popcorn/smpRead the README file. Make sure your terminal window has at least 19 rows and 80 columns. Configure the build: Code: make menuconfigSelect Kernel Headers options (Linux 2.6.11.0 kernel headers) ---> Select Toolchain Options ---> Select uCLibc version 0.9.28.3 ---> Select binUtils version 2.17 ---> Select gcc version 4.0.4 ---> At this point the build can start: Code: makeWhen the build is done, the file toolchain-path.env will be created, that contains the environment settings necessary to use the toolchain. Make this file executable and run it or copy-paste it's contents into the command-line before starting any cross-compilation. Building Dropbear Create the ~/popcorn/dropbear directory and download the latest version of dropbear (at the time of writing this was dropbear-0.51.tar.gz). You can get it for example by using: Code: cd ~/popcorn/dropbearUnpack it: Code: tar xvzf dropbear-0.51.tar.gzRead the README, INSTALL and MULTI files. Configure the build: Code: ./configure --host=mipsel-linux --disable-zlibI needed to use --disable-zlib as I still haven't sorted out how to cross-compile it. Any hints are welcome! Update: I have been able to build and use zlib. See below. You shouldn't need to change anything in options.h at this point but have a look anyway at what settings are available. I have chosen to build a combined binary à la busybox: Code: make PROGRAMS="dropbear dbclient dropbearkey dropbearconvert scp" MULTI=1In the end, you will get a binary called dropbearmulti. This is all you need. It contains all of the above programs. Compiling and Using zlib I have been able to build zlib and then use it for dropbear so I am sharing this with you: Get zlib from the OpenWrt project and unpack it into a directory: Code: cd ~/popcornPrepare it for cross-compilation: Code: CC=mipsel-linux-gcc ./configureNow you're ready to make: Code: makeWhen the build is done you need 3 files: Code: zlib.hYou must make these files available to the toolchain. I chose to copy them to the directory where the toolchain was built: Code: cp zlib.h ~/popcorn/00_smp/smp86xx_toolchain.20080505/build_mipsel_nofpu/staging_dir/includeNow you can configure and build dropbear as described above without using --disable-zlib: Code: ./configure --host=mipsel-linuxInstalling Dropbear on the PCH From this point on, work moves to the PCH. All commands have to be issued on a telnet terminal connected to PCH. There are good tutorials on how to install and run telnetd on PCH so I will skip this. I've added /share/start_app.sh to the start() function in /mnt/syb8634/etc/ftpserver.sh. So start_app.sh will be executed at every reboot. One of the things I've added to start_app.sh is the following command: Code: cp -r -P -p /share/apps/start/* /This allows me to place whatever files (and softlinks) I need in /share/apps/start (i.e. on my internal harddisk) and have them copied to the root of the filesystem at startup. This is very important, as files like /etc/passwd, /etc/shadow, /etc/groups get overwritten at every startup, so user passwords, home directories and shell settings are lost and need to be refreshed every time. Beware! I'm no security expert and have no idea what kind of security risks this method involves! Gather your own information and make your own informed decision as to what to use and how. The contents of my /share/apps/start directory is listed here below: Code: root@PCH-A100 in /opt/sybhttpd/localhost.drives/HARD_DISK/apps/start # ls -AlREverything is prepared to be copied as-is to the root of the file system. Most likely, it would be more elegant to tar everything and untar it upon startup. I will consider that at some moment in the future. In ./etc/dropbear above, there are two key files that dropbear uses. To generate them, use: Code: dropbearkey -t rsa -s 1024 -f dropbear_rsa_host_keyFinally, to automatically start dropbear after reboot, add the following command at a convenient place in start_app.sh: Code: dropbear -a -p 22 &Now you should be able to connect to your PCH with an SSH client like PuTTY. Enjoy! Generating Passwords and Setting-up the Accounts The normal way of generating passwords is to use the passwd command. In my environment this doesn't work hoewever. I get an error saying: Code: passwd: An error occurred updating the password file.Not having had the time and skills to investigate what is wrong, I decided to be practical about it and find alternative ways. This is how I discovered the makepwd.pl perl script that generates passwords for me to paste into the shadow file. (Unfortunately I don't remember where I've got it from -- googled it but then forgot where I've found it and can't find it again. Also I don't know how to attach files to posts so I am pasting the code here): Code: #!perl -w --In the passwd file I've defined /bin/sh as shell for root, guest, nmt and ftpuser. Also, I have defined home directories for each of the above users in /mnt/syb8634/home/ Authenticating with a Pair of Keys To make it even easier to connect, and eliminate the need of typing the password at every connection, you can configure the system to authenticate using a pair of keys. Dropbear supports the OpenSSH authorized_keys method. To use this method you need to generate a pair of keys using for example PuTTYgen.
Quote:ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAwVa6M6cGVmUcLl2cFzkxEoJd06Ub4bVDsYrWvXhvUV+ZAM9uGuewZBDoAqNKJxoIn0Hyd0Nk/yU99UVv6NWV/5YSHtnf35LKds56j7cuzoQpFIdjNwdxAN0PCET/MG8qyskG/2IE2DPNIaJ3Wy+Ws4IZEgdJgPlTYUBWWtCWOGc= someone@hostname Place the file authorized_keys in a directory named .ssh in the home directory of the user that you want to login using this key. In PuTTY, under Connection|SSH|Auth add the private key you've saved earlier, PopCorn Private Key.ppk. Also, under Connection|Data specify the Auto-login username. This is the username that has the home directory where you've placed the authorized_keys file before. Greets, Adrian |
|||
|
09-21-2008, 07:56 PM
Post: #2
|
|||
|
|||
|
RE: How-to: Install and Configure Dropbear on the PCH
nice tutorial
----------------------------------------------------------------------------------------------------- Syabas Technology Inc. DBA Popcornhour |
|||
|
09-21-2008, 09:40 PM
Post: #3
|
|||
|
|||
| RE: How-to: Install and Configure Dropbear on the PCH | |||
|
09-21-2008, 10:19 PM
Post: #4
|
|||
|
|||
RE: How-to: Install and Configure Dropbear on the PCH
(09-21-2008 09:40 PM)spookt Wrote:(09-21-2008 07:56 PM)werner Wrote: nice tutorial Thanks for the enthousiastic reply. Glad to hear it helps someone. Hopefully there will be others to benefit from it. I certainly am very happy with the solution.Now my ambitions point to OpenSSH ![]() Forgot to mention that I use WinSCP with the SCP protocol (provided by dropbear) to transfer files. WinSCP also supports authentication with a pair of keys. Greets, Adrian. |
|||
|
09-27-2008, 06:51 PM
Post: #5
|
|||
|
|||
|
RE: How-to: Install and Configure Dropbear on the PCH
Hi all,
I have updated the tutorial: - there was an omission in the compilation of dropbear; I had forgotten to add --host=mipsel-linux - I have now been able to build and use zlib, so I've added that to the tutorial Greets, Adrian |
|||
|
10-02-2008, 05:21 AM
Post: #6
|
|||
|
|||
|
RE: How-to: Install and Configure Dropbear on the PCH
I'd like to say thanks for the info.
Also, I'd like to comment on some things. Under the make menuconfig, there is a typo, it should be clear that you are editing the UClibC, not UlibC. Also, you will want to change the option for kernel headers from 2.4.29 to 2.6.11.0 (since the latest PCH linux kernel is based on 2.6.15, I believe it will be better.) If you do 'make' and you get errors, as I did, scroll up to see if you get a message saying 'makeinfo is missing...' I know I have makeinfo installed, since typing 'makeinfo' at the command prompt told me it was in the path, and 'makeinfo --version' told me I have 4.11 installed. Googling, I found this post which says. Quote: Troubleshooting I followed the link to the other thread, and apparently make sees version 4.11 as older than version 4.4, and complains that it is out of date. It doesn't really complain that it is too old, it just says 'missing'. That post leads to another post here The solution is written as Quote:makeinfo version check The problem is that - with at least for now Ubuntu Hardy, and eventually other distros - texinfo was updated to version 4.11. binutils v1.7 and 1.8 and gcc etc have 'broken' regexp lines in the config that don't check versions > x.9 properly. This is not a bug in texinfo, but in binutils et al configure files, which assumes that texinfo 4.11 is older than texinfo 4.4. Buildroot will fail on an 'abstract' error 2 when building with make -j3 (or jobs = 3 in menuconfig) because the _actual error_ (binutils build) is buried 3 pages up by another job that is finishing. Unless your Linux distro goes straight to texinfo 5.x instead of > 4.10, assuming you update your system, then this will probably affect everyone using buildroot - eventually. Translation: the config files in binutils are broken. So you need to patch it, manually. Do the following $ cd ~/popcorn/smp/smp86xx_toolchain.20080505/toolchain/binutils $ cd 2.17 $ touch configure.patch now you need to edit the file you just created. So break out whatever you like to use: nano, vi, vim, or gedit... I like vi, but if you don't know the shortcuts to paste, then I suggest gedit. and paste in the patch code. You need to change the first line few lines in the code, since that example is for gumstix... I haven't figured out what to change it to, but you should then be able to....[/i][/size] Then move up three directories, $ cd ../../.. $ rm -rf toolchain_build_mipsel_nofpu and then repeat the 'make' command |
|||
|
10-03-2008, 12:32 AM
(This post was last modified: 10-03-2008 12:49 AM by fbv2.)
Post: #7
|
|||
|
|||
|
RE: How-to: Install and Configure Dropbear on the PCH
So I did a little reconnaissance work, and I think I solved the problem.
I first had to learn about diff and patch; if you're into linux and would like to know more yourself, go here. Basically, what I did was looked for a reference to this missing texinfo Code: ~/popcorn/smp/$ grep missing *I saw a reference to in a configure file in the toolchain_build_mipsel_nofpu/binutils-2.17 directory. I copied the configure file, opened it up, did a search to find the area in question... discovered it was on line 3641. Edited it by hand to look as it should. Did a diff command comparing the two files Code: diff configure configure-new > configure.diffThe output of the file I will show here: Quote: I then moved the configure.diff file to the toolchain/binutils/2.17 directory, and renamed it configure.patch Code: mv configure.diff ../../toolchain/binutils/2.17/configure.patchI then went back to ~popcorn/smp/smp86xx_toolchain.20080505 and removed the toolchain_build_mipsel_nofpu directory, and tried make again. It did ask me which file to patch, (I didn't figure out how to correctly tell it the where the configure file was), so I typed in "configure" and it continued on its merry way, and created the toolchain environment file. PS: I think it would be so nice (and critical) of SYABAS to update their toolchain by including this patch so that others don't run into any compilation problems in the future. BinUtils 2.18 is now out as stable, and I'm surprised they haven't had this problem before with building this toolchain since it lacks the patch. |
|||
|
10-03-2008, 01:42 AM
(This post was last modified: 10-03-2008 05:19 AM by fbv2.)
Post: #8
|
|||
|
|||
|
RE: How-to: Install and Configure Dropbear on the PCH
Grrr... the next problem I now face is compiling Zlib.a, which requires the misel-linux-gcc cross compiler. Just doing
Code: $ CC=mipsel-linux-gcc ./configureQuote: Checking for unistd.h... No. Since I'm building on an x86 machine it wants to use x86 libraries to build, but I need to build for the mipsel-linux architecture so I need to figure out how to get it to use that cross compiler. |
|||
|
10-03-2008, 10:12 AM
Post: #9
|
|||
|
|||
|
RE: How-to: Install and Configure Dropbear on the PCH
HI,
It is wery nice to compile dorpbear, BUT i don't want to do this. SO, would you be so kind to share the compiled dropbearmulti! Now i have the not-multi dropbear on my PCH: from http://groll.troll.free.fr/wiki/index.ph...e=Dropbear But it has no scp and i want to copy files using scp. Please help me, and share it! thanks bonym |
|||
|
10-03-2008, 10:30 AM
Post: #10
|
|||
|
|||
|
RE: How-to: Install and Configure Dropbear on the PCH
Why not put compiled binaries somethere, to not bother all users with compilation?
|
|||
|
10-03-2008, 07:34 PM
Post: #11
|
|||
|
|||
|
RE: How-to: Install and Configure Dropbear on the PCH
I stated some time ago threat about links to compiled system tools
http://www.networkedmediatank.com/showth...p?tid=7192 |
|||
|
10-03-2008, 08:25 PM
Post: #12
|
|||
|
|||
|
RE: How-to: Install and Configure Dropbear on the PCH
UPDATE
It was my bad.... the toolchain path WAS added... to the current session of that terminal window. If you have multiple TERMs open, the PATH is only exported to THAT one that you loaded it in. I was using a different TERM window, so it was trying to use GCC there. |
|||
|
10-05-2008, 08:55 PM
(This post was last modified: 10-05-2008 09:16 PM by racanu.)
Post: #13
|
|||
|
|||
|
RE: How-to: Install and Configure Dropbear on the PCH
Hi fbv2,
Thanks for pointing out the uClibc typo. I've corrected it in the tutorial together with the kernel headers selection, version 2.6.11.0. I haven't (yet) tried it out though but I reckon you have. Greets, Adrian. (10-03-2008 10:12 AM)bonym Wrote: HI, Hi bonym, In case you still need the binary, you can get it from here (temporarily): http://www.my-space-on-the.net/_share/dropbearmulti Greets, Adrian. |
|||
|
10-06-2008, 04:58 PM
Post: #14
|
|||
|
|||
|
RE: How-to: Install and Configure Dropbear on the PCH
Hi racanu,
Thank You! I'll try it soon. thx bonym |
|||
|
10-06-2008, 05:47 PM
Post: #15
|
|||
|
|||
RE: How-to: Install and Configure Dropbear on the PCH
(10-05-2008 08:55 PM)racanu Wrote: In case you still need the binary, you can get it from here (temporarily): http://www.my-space-on-the.net/_share/dropbearmulti Thank you |
|||
|
« Next Oldest | Next Newest »
|

NMT Wiki
Search
Member List
Help
[9 June 2010] C-200/A-200 NMJ UI PREVIEW (under development)











