3 Home
mnemonikk edited this page 2010-12-08 04:17:57 -08:00

rcirc :connect-function fork

My fork of rcirc supports a new :connect-function parameter in rcirc-server-alist. By overriding the default connect function (open-network-stream), you can specify any arbitrary method to connect to an IRC server.

Connecting with SSL

The easiest way to get started is using the function open-tls-stream which is defined in the tls library. You need the gnutls binary for this:

(require 'tls)
(setq rcirc-server-alist '(("irc.freenode.net" :port 6697 :connect-function open-tls-stream :channels ("#rcirc"))))

This example defines a new irc-open-tls-stream function which calls out to the socat program to establish an SSL connection:

(defun irc-open-tls-stream (name buffer host service)
  (start-process name buffer "socat" "STDIO" (concat "OPENSSL:" host ":" service ",verify=0")))

(setq rcirc-server-alist '(("irc.freenode.net" :port 6697 :connect-function irc-open-tls-stream :channels ("#rcirc"))))

Connecting through an HTTP proxy

The proxychains program does some magic tricks to get network activity to go out through an HTTP proxy. This example uses proxychains in front of socat to make a plain (non-SSL) connection:

(defun irc-open-proxied-stream (name buffer host service)
  (start-process name buffer "proxychains" "socat" "STDIO" (format "OPENSSL:%s:%d,verify=0" host service)))

(setq rcirc-server-alist '(("irc.freenode.net" :connect-function irc-open-proxied-stream :channels ("#rcirc"))))

Connecting with SSL, presenting a client certificate, with an SSH connection to a remote server

This crazy example (which I actually use) first establshes an SSH connection to a remote host, then runs socat from that machine, presenting a client certificate to the IRC server to authenticate. It also makes sure the remote host presents a valid SSL certificate.

(defun irc-open-crazy-stream (name buffer host service)
  (start-process name buffer "ssh" "remotehost" "socat" "STDIO" 
    (format "OPENSSL:%s:%d,cert=/home/neale/ircauth.key,cafile=/home/neale/irc.pem" host service)))

(setq rcirc-server-alist '(("irc.wotzit.net" :port 994 :connect-function irc-open-crazy-stream)))