irssi proxy + ssh_agent + autossh
This howto is not user-friendly and you need to (know what a shell is, and) be able to perform basic shell operations to make it work.
Goal
- not being disconnected from irc channels I care about
- being able to connect from a local client
- not missing messages
- do it as securely as I can figure out at this time
Tools
- screen
- irssi
- autossh
- ssh (and ssh-agent, which you should setup by yourself)
When using an ssh-agent, you should definitely lock your station when you walk away. So.. :
- Your favorite among xscreensaver, xlock, etc.
Howto
- Remote setup
- Install screen and irssi on a server that doesn't get disconnected from the internet
Setup irssi proxy by adding a "proxy" stub in the "settings" part of .irssi/config, looking like this (choose your own ports & password):
proxy = {
irssiproxy_ports = "Indymedia=8881 freenode=8882";
irssiproxy_password = "password";
};Download the following irssi plugins to your .irssi/scripts folder
Link (as in "ln -s") the scripts from .irssi/scripts/autorun
- Edit awayproxy.pl and setup all the $config{} variables (at least emailfrom, emailto, sendmail and emailsubject)
- Remote launch
- Launch screen
- Launch irssi
- /away -all afk
- Detach from screen
- Local setup
Launch (or setup a script to automatically launch) autossh like this: autossh -f -N -L 8881:localhost:8881 -L 8882:localhost:8882 you@example.com (you need to be able to automatically connect to this host, so this presumes that you have a key setup for this host and that ssh-agent is running)
- Install irssi (or your favorite client) and instead of having it connect to freenode, set it up to connect to localhost and connect to the ports (one per network) chosen above, using the password chosen above
That should be it.
Just for fun: extra KDE setup
I run KDE 4 and I wanted to have ssh-agent and the tunnel to be setup automatically when I login. Here's the way :
Setup the agent to start automatically upon login (you will get asked for a password at login) by putting the following into ~/.kde/env/ssh_agent.sh :
eval `/usr/bin/ssh-agent` # It's not necessary to put the default key here, this # is only an example for people that have more than one key ssh-add ~/.ssh/id_dsa
Copy (and adapt) this into ~/.kde/Autostart/assh.sh :
export AUTOSSH_PIDFILE=/home/scyrma/.kde/Autostart/assh.pid PID=$(cat $AUTOSSH_PIDFILE | tr -d '[:blank:]') if [ -a /proc/$PID/exe ] ; then if (ls -al /proc/$PID/exe | grep autossh) ; then killall -s SIGUSR1 autossh; fi else autossh -f -N -L 8881:localhost:8881 -L 8882:localhost:8882 you@example.com fi
Result (at least for me...)
- when you launch your local irc client:
- you are set as not being away anymore
- you will see a backlog of messages sent to your nick ("nick: ...")
- when you disconnect your local irc client:
- you will be set as away
- any message sent to your nick will be forwarded to you by email
Extra link for bonus fun (or is it the other way around?)
How to get notifications with libnotify : http://anarcat.koumbit.org/2008-03-29-my-version-libnotify-irssi
Le Wiki Koumbit