From fe9226deaa9a14f65aed98ec1b99b9a316b299a4 Mon Sep 17 00:00:00 2001 From: MadCamel Date: Sat, 14 Apr 2018 11:22:03 -0400 Subject: [PATCH] Added socat wrapper for easy connection to SSL/ipv6 servers --- sample.conf | 3 +++ socat.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100755 socat.sh diff --git a/sample.conf b/sample.conf index 3392794..c64274b 100644 --- a/sample.conf +++ b/sample.conf @@ -6,6 +6,9 @@ set ctimeout 60 ; ; add some servers to the serverlist ; +; We don't currently support SSL or ipv6 but there's an easy workaround +; see socat.sh + servergroup undernet server amsterdam.nl.eu.undernet.org 6663 server amsterdam2.nl.eu.undernet.org 6663 diff --git a/socat.sh b/socat.sh new file mode 100755 index 0000000..9816896 --- /dev/null +++ b/socat.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Simple wrapper that alows energymech to connect to SSL and/or ipv6 servers +# Run it before running energymech + +# Listen port. In the energymech config put 'server localhost 6003' +LPORT=6003 + +# IRC server/port to connect to. This can be a hostname, ipv4, or ipv6 address +# Examples. Pick one. + +# Freenode, with SSL and valid/signed server certificate +# Will prefer ipv6 if available +IRCSERVER=OPENSSL:irc.freenode.net:6697,pf=ip6 + +# Freenode, prefer ipv4 +# IRCSERVER=OPENSSL:irc.freenode.net:6697,pf=ip4 + +# ipv4 server with self-signed SSL certificate +# Use this noverify option if you're having trouble with SSL.. +# IRCSERVER=OPENSSL:69.132.46.1:6697,noverify + +# Raw ipv6 address, no SSL +# IRCSERVER=TCP6:[2a01:128:79d:1::8]:6667 + + +SOCAT=`which socat` +if [ -z "$SOCAT" ]; then + echo socat not found, please install it + echo On Debian: sudo apt-get install socat + echo On Redhat: sudo yum install socat + echo Or you can build it from source and add it to your \$PATH + exit 1 +fi + +PIDFILE=socat.pid +kill `cat $PIDFILE 2>/dev/null` >/dev/null 2>&1 +${SOCAT} TCP4-LISTEN:${LPORT},reuseaddr,fork,bind=127.0.0.1 ${IRCSERVER} >socat.log 2>&1 $PIDFILE + +echo running. Check socat.log if you are having problems