December 26, 2010 19:26
Posted by Jeremy Durham
A few weeks back, I bought a DNS-321 with the idea of turning it into a sub $200 RAID 1 Time Machine and replacement for my Linux box that was serving Git repositories.
I purchased the DNS-321 for 60 bucks from TigerDirect with a $20 rebate, and managed to get two 1.5TB Western Digital 5400rpm hard drives from Micro Center for $60 a piece. The fun had just begun.
The first thing on the list was to “fun_plug” the DNS-321, which is incredibly trivial and allows you to get root on the device via telnet. “Hacking” the DNS-321 is not required to setup Time Machine, but is essential for installing and configuring Gitosis. Rooting the device is covered very well on the DNS 323 wiki.
Setting up Gitosis was a bit less trivial. First, you need to install Python, setuptools, and PERL from the fun_plug packages. Git depends on PERL, and Gitosis depends on Python and setuptools. You can get Python and setuptools from plord’s repository.
Once the dependencies are installed, you need to fetch git using wget:
After decompressing, git must be configured to install into /ffp, so run:
After configuring, git must be built with NO_NSEC because of the version of libc used by the DNS-321, so run:
NO_NSEC=YesPlease make install
Once git has been installed, which takes a while, you need to clone gitosis:
git clone git://github.com/res0nat0r/gitosis.git
You can pretty much follow the directions at scie.nti.st, with a few caveats:
When adding a user, you need to use the syntax appropriate for BusyBox’s adduser:
adduser -S -g 'git version control' -D -h /mnt/HD_a2/git
After this user is added, you need to run:
to permanently store the git user.
Make sure that you create git’s home directory on the NAS and set the appropriate privileges. You don’t want to accidentally delete the directory when you’re browsing the NAS one day.
The last tweak I had to make was an unfortunate one, but I couldn’t think of a more reasonable way of doing it. I had to disable StrictModes in OpenSSH, because the git user’s home directory is not located in /home. I tried mounting /mnt/HD_a2/git to /home/git or symlinking /mnt/HD_a2/git to /home/git, but neither of those worked. This can be done via editing /ffp/etc/ssh/sshd_config and adding:
Once you’re done with that remember to restart OpenSSH and you should be good to go. I hope you enjoy your RAID 1 Gitosis repository on your DNS-321 as much as I am enjoying mine. After updating this site to Ruby 1.9 and Rails 3, I began deploying exclusively from my DNS-321.