FruitieX/teleirc

SASL plain fails

wxl opened this issue · 7 comments

wxl commented

Trying to connect to Freenode with SASL seems to be failing with the current master. Unfortunately, no amount of logging (we've got it on silly and run with -vvv) provides any other detail about what goes wrong. The bot does connect to Freenode fine, with the right nick (we did try setting config.ircNick to a different value and it works fine). We also added a config.ircPerformCmds = ['NICKSERV identify username password']; and can identify to services fine. The problem is it's too late in the whole process, making joining channels that are +r impossible. SASL is a requirement for us.

config.ircOptions = {
    nick: 'lubot',
    userName: 'lubot',
    realName: 'Lubuntu Telegram Bridge',
    port: 6697,
    password: 'REDACTED',
    localAddress: null,
    showErrors: true,
    autoRejoin: true,
    autoConnect: true,
    channels: [], // auto generated, do not touch
    secure: true,
    selfSigned: false,
    certExpired: false,
    floodProtection: true,
    floodProtectionDelay: 1000,
    sasl: true,
    stripColors: true,
    channelPrefixes: '&#!',
    messageSplit: 512,
    encoding: ''
};

I am not a coder and I can only say that it's working for me on freenode and PirateIRC. However, I seem to be on 0820653 (develop) instead of master.

As a workaround, I think you can try config.ircPerformCmds = ['NICKSERV identify NICK REDACTED', 'CHANSERV invite #channel', 'JOIN #channel']; where ChanServ invite hopefully delays the joining enough that the bot gets identified and is able to join.

Another option as a workaround would be adapting something like https://github.com/matrix-org/matrix-appservice-irc/wiki/End-user-FAQ#i-am-a-chanop-and-have-a-spam-problem-how-can-i-fix-it-without-affecting-matrix-users instead of +r.

wxl commented

And I'm no IRCop but I'm pretty sure services can do little to "slow down" the order of events. The other alternatives/modes are not really good ones in this case, except perhaps +q $~a.

Anyways, we were previously using release versions. At one point the SASL worked. At some point later we upgraded and it failed to work, but worked around this by simply identifying with NickServ. And then Freenode got hit by spam left and ride and pretty much all of it went +r. Since the most recent release version failed to work, we tried master in hopes of a best case scenario.

wxl commented

I do notice that as a by product of our old config being from an old version, some things aren't in it:

config.relayEdited = false;
config.externalWebServer = false;
config.imgurLinkCacheSize = 1000; // yes we are using imgur

I assume that the lack of anhy definition of these in our config file would not cause problems?

wxl commented

So it looks like the change of IRC frameworks has caused the problem. I went back through all the tags and 0.4.6 works great, but not 0.4.8. I tried the develop branch and it didn't work, either. I inevitably end up with problems like:

error: channel * not found in config!           // not an asterisk in our config
error: channel lubot-test not found in config!  // this is the value we set for config.ircNick
wxl commented

A minimal config.js, just sufficient enough to get it to join IRC fails. This might be good for folks that want to test. I did leave all of the bits in config.ircOptions just to be sure:

var config = {};
module.exports = config;

config.logLevel = 'silly';
config.ircNick = 'teleirc-test';
config.ircServer = 'chat.freenode.net';
config.ircOptions = {
    nick: 'your-account', // set this to an account you have control over
    userName: 'test',
    realName: 'test',
    port: 6697,
    localAddress: null,
    debug: true,
    showErrors: true,
    autoRejoin: false,
    autoConnect: true,
    channels: [], // auto generated, do not touch
    secure: true,
    selfSigned: false,
    certExpired: false,
    floodProtection: true,
    floodProtectionDelay: 1000,
    sasl: true,
    stripColors: true,
    channelPrefixes: '&#!',
    messageSplit: 512,
    encoding: '',
    password: 'your-password' // set this to the password of the account you have
};

And I'm no IRCop but I'm pretty sure services can do little to "slow down" the order of events.

I meant that sending the command takes time during which the first command hopefully may get executed and the join may be successfull.

error: channel * not found in config! // not an asterisk in our config

These aren't actual errors (#251) and shouldn't prevent the bot from working.

wxl commented

I meant that sending the command takes time during which the first command hopefully may get executed and the join may be successfull.

I see what you're saying now. I doubt that sending to ChanServ is going to make much of a difference, especially given that in order to join successfully, ChanServ will have had to respond first. Services are never that quit. In aliases, I've used wait commands, but that's not really an option here. Put another way: logically it's sound, but it's not guarantee to work in all conditions.

These aren't actual errors (#251) and shouldn't prevent the bot from working.

Well, that's reassuring. It would certainly seem sensible to catch those and throw them into /dev/null instead of echoing them back on the console.

To that end, I noticed that there's quite a bit of chattiness from the old IRC framework. That is actually really nice because you could see what was going on. In this current framework, everything's about all but invisible. It might be nice to include some kind of logging in the code, like:

Trying to connect to ircs://some.server:6697 as some-nick (some-user/Some Real Name)…
Successful!

and so on, at least for the higher log levels. Would be really handy for debugging.

Since authentication is often a concern people have, it would also be reasonable to try to catch any messages from NickServ and log these as well. From what I can tell, the API has everything we need.

That said, JS is not my cup of tea, so I'll leave this to the experts. 🍵