Skip to content

Instantly share code, notes, and snippets.

@oelna

oelna/readme.md Secret

Last active September 29, 2020 13:33
Show Gist options
  • Save oelna/117032d7ecba1b4caae929a136139f12 to your computer and use it in GitHub Desktop.
Save oelna/117032d7ecba1b4caae929a136139f12 to your computer and use it in GitHub Desktop.
Install UnrealIRCd on Uberspace 7

Setting up UnrealIRCd on Uberspace 7

Map a domain you'll be using for the server

You'll be getting a LetsEncrypt SSL cert in the process.

uberspace web domain add irc.host.tld

Get some free ports

I think needed 3, for http, https and websockets

uberspace port add

Set web backend

I'm not sure whether I needed to set for the websocket port, or all three.

uberspace web backend set irc.host.tld --http --port 47363

Download the source for UnrealIRCd

Using wget, extract archive after.

wget --trust-server-names https://www.unrealircd.org/downloads/unrealircd-latest.tar.gz
tar xzvf unrealircd-5.0.6.tar.gz
cd unrealircd-5.0.6

Some configuration. All three steps in order. Make sure you let the wizard generate the SSL certs for you. I have no idea how to do that manually afterwards.

./Config
make
make install

ONLY IF YOU DID NOT CREATE THE SSL CERTS! I missed the certs the first time and instead symlinked my LetsEncrypt certs, but this is bad for actual IRC servers I believe. Use with caution.

cd ~/unrealircd/conf/tls
ln -s ~/etc/certificates/irc.host.tld.crt ./server.cert.pem
ln -s ~/etc/certificates/irc.host.tld.key ./server.key.pem

Copy example config file to make a new one

cd ~/unrealircd
cp conf/examples/example.conf conf/unrealircd.conf

Walk through the config file

Use https://www.unrealircd.org/docs/Configuration as a guide.

Generate cloak keys (add to line 451+ of unrealircd.conf)

./unrealircd gencloak

Load the websocket module

Add websocket module to unrealircd.conf I added it to the very end of the file.

loadmodule "websocket";

Set an email as kline address in line 461 of unrealircd.conf

Change unrealircd.conf as per https://www.unrealircd.org/docs/Using_Let%27s_Encrypt_with_UnrealIRCd Set the ports you opened and note the path to your LetsEncrypt certs in the listen blocks.

listen {
	ip *;
	port 47361;
	options {
		websocket {
			type text;
		}
	};
}

/* IRC SSL/TLS */
listen {
	ip *;
	port 47362;
	options { tls; };
	tls-options {
		certificate "../../etc/certificates/irc.host.tld.crt";
		key "../../etc/certificates/irc.host.tld.key";
	};
}

/* Websockets with WSS */
listen {
	ip *;
	port 47363;
	options {
		tls;
		websocket {
			type text;
		}
	};
	tls-options {
		certificate "../../etc/certificates/irc.host.tld.crt";
		key "../../etc/certificates/irc.host.tld.key";
		options { no-client-certificate; };
	};
}

Start the server

./unrealircd start should show:

Configuration loaded.
Initializing TLS..
Dynamic configuration initialized.. booting IRCd.
UnrealIRCd is now listening on the following addresses/ports:
IPv4: *:47363(SSL/TLS), *:47362(SSL/TLS), *:47361(SSL/TLS), *:43180
IPv6: *:47363(SSL/TLS), *:47362(SSL/TLS), *:47361(SSL/TLS), *:43180
UnrealIRCd started.

Keep it running

Add server restart to crontab (crontab -e) https://www.unrealircd.org/docs/Cron_job

*/5 * * * * /home/yourusername/unrealircd/unrealircd croncheck
@reboot /home/yourusername/unrealircd/unrealircd croncheck

When config is changed

If the server is running and you changed the config, you need to rehash! (Some settings require a full restart, with stop and start, such as server name changes)

./unrealircd rehash

Misc

Is this needed?

set {
    ssl {
        sts-policy {
            port 47362;
            duration 5m; /* you can always increase this later */
        };
    };
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment