Breaking out of the Slack walled garden
how to use Slack via IRC since the gateway closed...


I’m old school cool. Real hackers chat on open, distributed platforms. Most technical discussion can be found on the Libera.chat IRC network. It’s not perfect, but the advantages clearly outweigh the drawbacks.

Recently, I needed to join an existing large “community” on the centralized, proprietary walled garden that is the Slack network.


The Problem:

Connecting to the the Slack server requires that you use either the proprietary client or their proprietary web app. There’s zero chance I will install the former on my machine, and the latter uses an absurd amount of browser memory and CPU. I’m already happy with my irssi experience, and I didn’t want to need another app.

Initially, Slack offered an IRC bridge as part of its embrace, extend, and extinguish strategy, but this is now closed.


The Solution:

Don’t use Slack! Move your team to Libera.chat or run your own private IRC server. This lets everyone use the client of their choice on the platform of their choice.

Luckily there’s a workaround if you need to infiltrate an existing Slack community. ;) Here’s how I did it.


Workaround: Step 1: Token:

Log into Slack via the web browser and get a “legacy token”. You can get one from this web page. Apparently an administrator needs to allow this per-user, but since nobdy was responsive, user 42wim pointed out that you could just sniff for the token being used in the web ui.

I was unable to find it using Firefox, but if you open up the Chrome Developer tools, under the Network section, there’s a WS (web socket) tab which will show you your token:

here's what finding your token looks like, they all seem to start with xoxs-

Do this with care, since I have no idea how to revoke this token if it is lost. Perhaps changing your password will cause it to change, but I haven’t tested it. Nobody knows how long this token will last, but if things stop working you know how to go find it again.


Workaround: Step 2: IRC Server:

Now we need to run a small local IRC server which speaks Slack protocol, and maps this to the standard IRC protocol that your IRC client will understand. There are three projects I’ve found that do this.

  1. https://github.com/42wim/matterircd/

  2. https://github.com/insomniacslk/irc-slack

  3. https://github.com/nolanlum/tanya/

They’re all easy to setup and install. I tested that the first two work, but I felt slightly more happy with the first option. They both happen to use golang, and once a recent version is installed, you can build a copy with:

go get github.com/42wim/matterircd

This produces a build of the latest git master, but if you’d prefer a released version you can look for the latest tag. In my case it was v0.17.3. You can then:

git clone --recursive github.com/42wim/matterircd
git checkout v0.17.3
go build

I experienced a number of crashes with wim promptly fixed, and I think things are now pretty stable. I’m currently running a git version: a0ab000e02cfaedc136acd1da34afacdb7bf1791. If you find any issues, wim has been very responsive in fixing them.

Both of these installation methods should produce a matterircd binary. The former will cause it to appear in your $GOPATH/bin/. This is often found at ~/go/bin/. The latter will produce it in your go build working directory. In either case, I copied that to the server where I run my IRC client. In that screen session I then ran it:

[james@computer ~]$ ./bin/matterircd
INFO[2018-06-19T15:51:04-04:00] Running version 0.18.2-dev                    module=matterircd
INFO[2018-06-19T15:51:04-04:00] WARNING: THIS IS A DEVELOPMENT VERSION. Things may break.  module=matterircd
INFO[2018-06-19T15:51:04-04:00] Listening on 127.0.0.1:6667                   module=matterircd

You could probably add a systemd service for this, but I didn’t bother.


Workaround: Step 3: IRC Client:

I use irssi but have never had great success getting the internal CLI to work properly. As a result, I disobeyed the instructions, quit irssi, and then edited the ~/.irssi/config file. I added the following sections…

In the chatnets = { ... }; block I added:

teamname = {
  type = "IRC";
  nick = "purpleidea";
};

In the servers = ( ... ); block I added:

{
  address = "localhost";
  chatnet = "teamname";
  password = "xoxs-your-secret-token-is-here...";
  port = "6667";
  use_ssl = "no";
  ssl_verify = "no";
  autoconnect = "yes";
},

In the channels = ( ... ); block I added:

{ name = "#chan1"; chatnet = "teamname"; autojoin = "yes"; },
{ name = "#whatever"; chatnet = "teamname"; autojoin = "yes"; },

In the above blocks you’ll naturally want to replace teamname with the name you’d like to give to this slack network. You’ll also need to replace the xoxs-your-secret-token-is-here... string with the value that you found in part 1.

Now start irssi. If all goes well, you should be connected! In the irssi status window you should see:

06:50 [teamname] -!- Irssi: Connecting to localhost [127.0.0.1] port 6667
06:50 [teamname] -!- Irssi: Connection to localhost established
06:50 [teamname] -!- Welcome! [email protected]
06:50 [teamname] -!- Your host is matterircd, running version 0.17.4-dev
06:50 [teamname] -!- This server was created Mon Jun 11 06:50:56 EDT 2018
06:50 [teamname] -!- matterircd 0.17.4-dev o o debugmode false
06:50 [teamname] -!- There are 3 users and 0 services on 1 servers
06:50 [teamname] -!- - matterircd Message of the Day -
06:50 [teamname] -!- End of /MOTD command.

In the screen window running matterircd you should see:

INFO[2018-06-19T15:51:16-04:00] New connection: 127.0.0.1:44958               module=matterircd

You can now join more channels and even direct message other users. The complete list of users should show up in a special &users channel. Most things work as expected.


Additional Information:

Some IRC clients (apparently Pidgin) convert a window close action into a Slack channel leave action. If that was an invite-only channel, you might need to be re-invited in order to re-join.

As I write this article, wim has added automatic token fetching to matterircd v0.18.0. I haven’t tested it, but if you’d rather use your password directly, this looks like it should do it. You’d probably want to replace the use of the token in the password = "xoxs-your-secret-token-is-here..."; line with your actual password.


Conclusion:

Hope you enjoyed this. Tell your friends to pick regular IRC instead.

Happy Hacking,

James


You can follow James on Mastodon for more frequent updates and other random thoughts.
You can follow James on Twitter for more frequent updates and other random thoughts.
You can support James on GitHub if you'd like to help sustain this kind of content.
You can support James on Patreon if you'd like to help sustain this kind of content.

June 22, 2018
1065 words


Categories
Tags
devops fedora golang irc irssi matterircd planetdevops planetfedora slack

Links...

M

Comments

Nothing yet.


Post a comment



(sorry but the spammers were getting too crazy!)

Thank you

Your comment has been submitted and will be published if it gets approved.

Click here to see the patch you generated.

OK