Thursday·22·March·2012
Tools for CLI Road Warriors: Tunnels //at 19:49 //by abe
Sometime the network you’re connected to is either untrusted (e.g. wireless) or castrated in some way. In both cases you want a tunnel to your trusted home base.
Following I’ll show you three completely different tunneling tools which may helpful while travelling.
sshuttle
sshuttle is a tool somewhere in between of automatic port forward and VPN. It tunnels arbitrary TCP connections and DNS through an SSH tunnel without requiring root access on the remote end of the SSH connection.
So it’s perfect for redirecting most of your traffic through an SSH tunnel to your favourite SSH server, e.g. to ensure your local privacy when you are online via a public, unencrypted WLAN (i.e. easy to sniff for everyone).
It runs on Linux and MacOS X and only needs a Python interpreter on the remote side. Requires root access (usually via sudo) on the client side, though.
It’s currently available at least in Debian Unstable and Testing (Wheezy) as well as in Ubuntu since 11.04 Natty.
Miredo
Miredo is an free and open-source implementation of Microsoft’s NAT-traversing Teredo IPv6 tunneling protocol for at least Linux, FreeBSD, NetBSD and MacOS X.
Miredo includes not only a Teredo client but also a Teredo server
implementation. The developer of Miredo also runs a public Miredo
server, so you don’t even need to install a server somewhere. If you
run Debian or Ubuntu you just need to do apt-get
install miredo
as root and you have IPv6 connectivity. It’s
that easy.
So it’s perfect to get a dynamic IPv6 tunnel for your laptop or mobile phone independently where you are and without the need to register any IPv6 tunnel or configure the Miredo client.
I usually use Miredo on my netbooks to be able to access my boxes at home (which are behind an IPv4 NAT router which is also an SixXS IPv6 tunnel endpoint) from whereever I am.
iodine
iodine is likely the most undermining tool in this set. It tunnels IPv4 over DNS, allowing you to make arbitrary network connections if you are on a network where nothing but DNS requests is allowed (i.e. only DNS packets reach the internet).
This is often the case on wireless LANs with landing page. They redirect all web traffic to the landing page. But the network’s routers try to avoid poisoning the client’s DNS cache with different DNS replies as they would get after the user is logged in. So DNS packets usually pass even the local network’s DNS servers unchanged, just TCP and other UDP packets are redirected until logging in.
With an iodine tunnel, it is possible get a network connection to the outside on such a network anyway. On startup iodine tries to automatically find the best parameters (MTU, request type, etc.) for the current environmenent. However that may fail if any DNS server in between imposes DNS request rate limits.
To be able to start such a tunnel you need to set up an iodine daemon somewhere on the internet. Choose a server which is not already a DNS server.
iodine is available in many distributions, e.g. in
Debian and in Ubuntu.
Tagged as: autossh, Debian, GitHub, iodine, IPv6, Miredo, NAT, Python, Squeeze, SSH, sshuttle, Testing, Ubuntu, Unstable, VPN
// show without comments // write a comment
Related stories
Wednesday·21·March·2012
aptitude-gtk will likely vanish //at 01:06 //by abe
As Christian already wrote, there’s an Aptitude revival ongoing. We already saw this young team releasing aptitude 0.6.5 about 6 weeks ago, more commits have been made, and now we’re heading towards an 0.6.6 release quickly.
But this revival mostly covers the well-known and loved curses interface (TUI) of aptitude and not the seldomly installed GTK interface, which unfortunately never really took off:
While aptitude itself (i.e. the curses and commandline interface) is installed on nearly 99% of all Debian installations which take part in Debian’s “Popularity Contest” statistics, aptitude-gtk is only installed on 0.42% of all these installations.
One reason is likely that aptitude-gtk still hasn’t all the neat features of the curses interface. And another reason is probably that it’s still quite buggy.
Since nobody from the current Aptitude Team has the experience, leisure or time to resurrect (or even complete) aptitude-gtk, the plan is to stop building aptitude-gtk from the aptitude source package soon, i.e. to remove it from Debian for now.
Like the even less finished Qt interface of aptitude, its code will stay in the VCS, but will be unmaintained unless someone steps up to continue aptitude-gtk (or aptitude-qt, or both), maybe even as its own source package.
So if you like aptitude-gtk so much that you’re still using it and want to continue using it, please think about contributing by joining the Aptitude Team and getting aptitude’s GUI interface(s) back in shape.
Another option would be to find a mentor so that resurrecting (one of) aptitude’s GUI interfaces could become (again) a potential project at Debian’s participation at Google’s Summer of Code.
Please direct any questions about aptitude-gtk or aptitude-qt to the
Aptitude Development Mailing List. Or even better, join the discussion in this thread.
Tagged as: aptitude, aptitude-gtk, Debian, Google, GSoC, Planet Debian, removal, Summer of Code, Wheezy
// show without comments // write a comment
Related stories
Tuesday·20·March·2012
Happy Birthday GNU Screen! //at 23:46 //by abe
According to this Usenet posting, GNU Screen became 25 years old today. (Found via Fefe.)
And no, it’s not dead. In contrary, the reaction on the mailing list to bug fixes with patches is usually impressingly prompt. :-)
I took this occassion and uploaded a current git snapshot of GNU Screen to Debian Experimental.
Bug #644788 (screen 4.1.0 can’t attach to a running or detached screen 4.0.3 session) is still an issue with that snapshot, but gladly upstream seems to work on a solution for it. There’s even talk about a 4.1.0 beta release soon — although that hasn’t happened yet.
Have fun!
Tagged as: anniversary, birthday, Debian, Experimental, Git, GNU, GNU Screen, screen, snapshot, upload
// show without comments // write a comment
Related stories
Wednesday·14·March·2012
SSH Multiplexer: parallel-ssh //at 03:10 //by abe
There are many SSH multiplexers in Debian and most of them have one or two features which make them unique and especially useful for that one use case. I use some of them regularily (I even maintain the Debian package of one of them, namely pconsole :-) and I’ll present then and when one of them here.
For non-interactive purposes I really like parallel-ssh aka
pssh. It takes a file of hostnames and a bunch of common ssh
parameters as parameters, executes the given command in parallel in up
to 32 threads (by default, adjustable with -p
) and waits
by default for 60 seconds (adjustable with -t
). For
example to restart hobbit-client on all hosts in kiva.txt,
the following command is suitable:
$ parallel-ssh -h kiva.txt -l root /etc/init.d/hobbit-client restart [1] 19:56:03 [FAILURE] kiva6 Exited with error code 127 [2] 19:56:04 [SUCCESS] kiva [3] 19:56:04 [SUCCESS] kiva4 [4] 19:56:04 [SUCCESS] kiva2 [5] 19:56:04 [SUCCESS] kiva5 [6] 19:56:04 [SUCCESS] kiva3 [7] 19:57:03 [FAILURE] kiva1 Timed out, Killed by signal 9
(Coloured “Screenshots” done with ANSI HTML Adapter from the package aha.)
You easily see on which hosts the command failed and partially also why: On kiva6 hobbit-client is not installed and therefore the init.d script is not present. kiva1 is currently offline so the ssh connection timed out.
If you want to see the output of the commands, you have a two choices. Which one to choose depends on the expected amount of output:
If you don’t expect a lot of output, the -i
(or
--inline
) option for inline aggregated output is probably
the right choice:
$ parallel-ssh -h kiva.txt -l root -t 10 -i uptime [1] 20:30:20 [SUCCESS] kiva 20:30:20 up 7 days, 5:51, 0 users, load average: 0.12, 0.08, 0.06 [2] 20:30:20 [SUCCESS] kiva2 20:30:20 up 7 days, 5:50, 0 users, load average: 0.19, 0.08, 0.02 [3] 20:30:20 [SUCCESS] kiva3 20:30:20 up 7 days, 5:49, 0 users, load average: 0.10, 0.06, 0.06 [4] 20:30:20 [SUCCESS] kiva4 20:30:20 up 7 days, 5:49, 0 users, load average: 0.25, 0.17, 0.14 [5] 20:30:20 [SUCCESS] kiva6 20:30:20 up 7 days, 5:49, 10 users, load average: 0.16, 0.08, 0.02 [6] 20:30:21 [SUCCESS] kiva5 20:30:21 up 7 days, 5:49, 0 users, load average: 3.11, 3.36, 3.06 [7] 20:30:29 [FAILURE] kiva1 Timed out, Killed by signal 9
If you expect a lot of output you can give directories with the
-o
(or --outdir
) and -e
(or
--errdir
) option:
$ parallel-ssh -h kiva.txt -l root -t 20 -o kiva-output lsb_release -a [1] 20:36:51 [SUCCESS] kiva [2] 20:36:51 [SUCCESS] kiva2 [3] 20:36:51 [SUCCESS] kiva3 [4] 20:36:51 [SUCCESS] kiva4 [5] 20:36:53 [SUCCESS] kiva6 [6] 20:36:54 [SUCCESS] kiva5 [7] 20:37:10 [FAILURE] kiva1 Timed out, Killed by signal 9 $ ls -l kiva-output total 24 -rw-r--r-- 1 abe abe 98 Aug 28 20:36 kiva -rw-r--r-- 1 abe abe 0 Aug 28 20:36 kiva1 -rw-r--r-- 1 abe abe 98 Aug 28 20:36 kiva2 -rw-r--r-- 1 abe abe 98 Aug 28 20:36 kiva3 -rw-r--r-- 1 abe abe 98 Aug 28 20:36 kiva4 -rw-r--r-- 1 abe abe 102 Aug 28 20:36 kiva5 -rw-r--r-- 1 abe abe 100 Aug 28 20:36 kiva6 $ cat kiva-output/kiva5 Distributor ID: Debian Description: Debian GNU/Linux 6.0.2 (squeeze) Release: 6.0.2 Codename: squeeze
The only annoying thing IMHO is that the host list needs to be in a file. With zsh, bash and the original ksh (but neither tcsh, pdksh nor mksh), you can circumvent this restriction with one of the following command lines:
$ parallel-ssh -h <(printf "host1\nhost2\nhost3\n…") -l root uptime […] $ parallel-ssh -h <(echo host1 host2 host3 … | xargs -n1) -l root uptime […]
And in zsh there’s an even easier way to type this:
$ parallel-ssh -h <(print -l host1 host2 host3 …) -l root uptime […]
In addition to parallel-ssh
the pssh
package also contains some more ssh based tools:
parallel-scp
andparallel-rsync
for parallel copying files onto a set of hosts.parallel-slurp
for fetching files in parallel from a list of hosts.parallel-nuke
to kill a bunch of processes in parallel on a set of machines.
I though think that parallel-ssh
is by far the most
useful tool from the pssh package. (Probably no wonder
as it’s the most generic one. :-)
Tagged as: aha, Multiplexer, parallel-ssh, pconsole, pssh, SSH, UUUT
// show without comments // write a comment