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

Tools

When using an ssh-agent, you should definitely lock your station when you walk away. So.. :

Howto

  1. Remote setup
    1. Install screen and irssi on a server that doesn't get disconnected from the internet
    2. 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";
  };
  1. Download the following irssi plugins to your .irssi/scripts folder

  2. Link (as in "ln -s") the scripts from .irssi/scripts/autorun

  3. Edit awayproxy.pl and setup all the $config{} variables (at least emailfrom, emailto, sendmail and emailsubject)
  1. Remote launch
    1. Launch screen
    2. Launch irssi
    3. /away -all afk
    4. Detach from screen
  2. Local setup
    1. 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)

    2. 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 :

  1. 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
  2. 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...)

ScyrmAa/IrssiProxy (last edited 2010-08-25 08:53:01 by ScyrmAa)