Categories
Hyperlinks

WRT54G History: The Router That Accidentally Went Open Source

How Linksys’ most famous router, the WRT54G, tripped into legendary status because of an undocumented feature that slipped through during a merger.
— Read on tedium.co/2021/01/13/linksys-wrt54g-router-history/

Categories
Information Technology

SSH/SFTP Rsync backups done with chroot

Rsync

Rsync, for those who aren’t familiar, is a file copy tool, which, after the first copy, will only send changes during subsequent updates. This makes it a very efficient tool, especially when used over an internet connection.

Anyway, to enable rsync from server A to server B, it is common to perform the login via key. This means that on Server A you’d generate a SSH keypair for your backup user, then copy the public key that was generated into the ~/.ssh/authorized_keys file for your backup user on Server B.

Because rsync is going to be executed automatically via cron script, it is necessary to create the key file without a password.

Jail

  • Configure your SSH server
    • Open up /etc/ssh/sshd_config
    • At the end of the file, tell SSH to create a chroot jail for your backup user:
      ChrootDirectory %h
      AllowTcpForwarding no
      PermitTunnel no
      X11Forwarding no

      Note, because of the way chroot works, you’ll need to make sure the chroot directory is owned by ROOT, even if it’s actually the home directory of your backup user.

  • Save, and restart your SSH server.

This gets you part of the way, you should now be able to SSH/SFTP into Server B using your backup user, and when connected, you will be restricted to the location set in ChrootDirectory.

Unfortunately, rsync needs more than this, and in order to copy files it’ll need access to the shell (I’m assuming bash), as well as the rsync application itself, together with whatever libraries are required.

Therefore, it becomes necessary to create a partial chroot image in the backup user’s chroot directory. You could do this the traditional way (e.g. by using something like debootstrap), which will create a mirror of your base operating system files in the chroot jail. However, this generally takes a few hundred megabytes at least, and if all you want is to copy some files, you don’t want to give access to more than you need.

Instead, I opt to create a skeleton chroot jail by hand.

The goal here is to mirror the filesystem of your server inside the chroot jail, so that if a file exists in /foo/bar, then you need to copy it to /home/backup-user/foo/bar, and make sure it’s owned by root.

  • Copy bash from /bin/bash to the directory /home/backup-user/bin/
  • Copy rsync (on my system this was in /usr/bin)
  • Next, you need to copy the symbolic link libraries to which these files are linked against. You can use the tool ldd to interrogate the executable and get a list of files to copy, e.g:
    root@server-b:/home/backup-user# ldd /bin/bash
        linux-vdso.so.1 =>  (0x00007fff52bff000)
        libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007f412810a000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f4127f06000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f4127b79000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f4128340000)

    Copy the files which have directories into the appropriate locations, e.g./lib/x86_64-linux-gnu/libtinfo.so.5 should go into/home/backup-user/lib/x86_64-linux-gnu/

  • Do the same for /usr/bin/rsync
Categories
Twitter

The #ubuntu 11.10 login screen…

Wade Murray @wademurray – 2011-09-03T22:37:13+00:00

The #ubuntu 11.10 login screen is aaaaamazing! I don’t even want to log in.

Posted using Twitter for iPhone

Categories
Twitter

Linux 2.8.0? I hope Torvalds…

Wade Murray @wademurray – 2011-05-23T22:01:56+00:00

Linux 2.8.0? I hope Torvalds just does it, the numbers have become too big. #linux

Posted using Twitter for iPad

Categories
Twitter

Maverick Meerkat Alpha 2 out….

Wade Murray @wademurray – 2010-07-01T17:25:23+00:00

Maverick Meerkat Alpha 2 out. Ubuntu 10.04 is so nice I don’t think I want to test Maverick.

Posted using Ping.fm

Categories
Twitter

Ubuntu 10.04 LTS Released -…

Wade Murray @wademurray – 2010-05-02T23:50:01+00:00

Ubuntu 10.04 LTS Released – The Ubuntu team is pleased to announce Ubuntu 10.04 LTS (Long-Term Support). This… http://tumblr.com/xoc9dh1ay

Posted using Twitter Web Client

Categories
Websites

Changing Servers

I’ve outgrown my webserver! I’ve been using an OpenVZ virtual private server through Network Redux out in Portland, Oregon. A friend recommended CoreNetworks.net located in East Lansing, Michigan. CoreNetworks.net has a dedicated server package that is quite affordable with many upgrades to what I currently have. Check out the comparison.

Network Redux VPS:

Debian 5.0
OpenVZ Hypervisor
256MB RAM
10GB Hard Drive
500 GB Transfer

CoreNetworks.net dedicated server:

Ubuntu Server 9.10
Intel 2.66GHz Processor
2048MB RAM
80GB Hard Drive
1,000 GB Transfer

Also, I’m going to have 3 public IP addresses to distribute among a few virtual machines that I’ll run. Maybe I’ll start using the server for something more than just web services.

Categories
Twitter

Debian GNU/Linux on my ASUS…

Wade Murray @wademurray – 2009-02-13T23:32:22+00:00

Debian GNU/Linux on my ASUS Eee PC 1000HA. http://wiki.debian.org/DebianEeePC

Posted using Twitter Web Client