My solution needs several things:
- ssh
- screen
- shell-access somewhere
When my laptop starts it automatically executes the following command:
screen -S irc_tunnel -d -m /home/housetier/bin/irc_proxy.sh
the shell-script contains only two lines:
#!/bin/bash
ssh -D 2048 -l housetier somehost.somewhere-on-the.net
After this I can tell my program (xchat in this case) to use localhost:2048 as a SOCKS5 proxy.
Of course I needed to enable password-less login on the target host. This setup works quite well, thanks to the powers of ssh.