[SOLVED] Trying to get any websocket IRC client to work with UnrealIRCd

If your UnrealIRCd is up and running but you have a question about it, then use this forum.
(NOT for installation or connecting issues! Use the other forum instead.)

Moderator: Supporters

Post Reply
barryn
Posts: 10
Joined: Tue Oct 15, 2024 4:05 am

[SOLVED] Trying to get any websocket IRC client to work with UnrealIRCd

Post by barryn »

I have tried the example client at: https://www.unrealircd.org/files/dev/ws ... lircd.html
I also tried KiwiIRC following the instructions at https://www.unrealircd.org/docs/WebSocket_support. I know my IRC server is running because I can connect using other types of clients. I have verified the websocket port I am using is open. I added these lines to my unrealircd.conf:

Code: Select all

loadmodule "websocket";
loadmodule "webserver";
listen {
    ip *;
    port 8000;
    options {
        tls;
        websocket { type text; } // type must be either 'text' or 'binary'
    };
    tls-options {
        certificate "/home/irc/unrealircd/conf/tls/server.cert.pem";
        key "/home/irc/unrealircd/conf/tls/server.key.pem";
        options {
            no-client-certificate;
        };
    };
};
The output from the server at startup and the output from netstat both show my server listening for connection on port 8000. The certificate is valid and I can connect to the IRC server using TLS, just not with any websocket client. Any ideas what could be wrong?
barryn
Posts: 10
Joined: Tue Oct 15, 2024 4:05 am

Re: Trying to get any websocket IRC client to work with UnrealIRCd

Post by barryn »

PS: The lounge works, but it has it's own proxy server.
CrazyCat
Posts: 272
Joined: Thu Apr 28, 2005 1:05 pm
Location: France
Contact:

Re: Trying to get any websocket IRC client to work with UnrealIRCd

Post by CrazyCat »

Can you show your kiwiirc config.json ? Particularly the startupOptions block. And did you set disconnectOnSaslFail to false ?
barryn
Posts: 10
Joined: Tue Oct 15, 2024 4:05 am

Re: Trying to get any websocket IRC client to work with UnrealIRCd

Post by barryn »

My config.json

Code: Select all

    "startupOptions" : {
        "server": "redacted.redacted.com",
        "port": 8000,
        "tls": true,
        "direct": true,
        "channel": "#kiwiirc-default",
        "nick": "kiwi-n?"
    },
Where does disconnectOnSaslFail need to be set? I have not set it and I don't see that option in either config.json or unrealircd.conf? I don't recall this being mentioned in the instructions but maybe I missed it.
barryn
Posts: 10
Joined: Tue Oct 15, 2024 4:05 am

Re: Trying to get any websocket IRC client to work with UnrealIRCd

Post by barryn »

Here is the full config.json with the server name redacted.

Code: Select all

{
    "windowTitle": "Kiwi IRC - The web IRC client",
    "startupScreen": "welcome",
    "kiwiServer": "https://redacted.redacted.com/kiwiirc",
    "restricted": false,
    "theme": "Default",
    "themes": [
        { "name": "Default", "url": "static/themes/default" },
        { "name": "Dark", "url": "static/themes/dark" },
        { "name": "Coffee", "url": "static/themes/coffee" },
        { "name": "GrayFox", "url": "static/themes/grayfox" },
        { "name": "Nightswatch", "url": "static/themes/nightswatch" },
        { "name": "Osprey", "url": "static/themes/osprey" },
        { "name": "Radioactive", "url": "static/themes/radioactive" },
        { "name": "Sky", "url": "static/themes/sky" },
        { "name": "Elite", "url": "static/themes/elite" }
    ],
    "startupOptions" : {
        "server": "redacted.redacted.com",
        "port": 8000,
        "tls": true,
        "direct": true,
        "channel": "#kiwiirc-default",
        "nick": "kiwi-n?"
    },
    "embedly": {
        "key": ""
    },
    "plugins": [
        { "name": "customise", "url": "static/plugins/customise.html" }
    ]
}
CrazyCat
Posts: 272
Joined: Thu Apr 28, 2005 1:05 pm
Location: France
Contact:

Re: Trying to get any websocket IRC client to work with UnrealIRCd

Post by CrazyCat »

Add "disconnectOnSaslFail": false, before the embedly block:

Code: Select all

    "startupOptions" : {
        "server": "redacted.redacted.com",
        "port": 8000,
        "tls": true,
        "direct": true,
        "channel": "#kiwiirc-default",
        "nick": "kiwi-n?"
    },
    "disconnectOnSaslFail": false,
    "embedly": {
        "key": ""
    },
I don't think it'll really help but you can test (https://github.com/kiwiirc/kiwiirc/issu ... -497105109 for explanation of this setting)
If it doesn't work, give me the url of your kiwiirc so I can try to analyse the trouble.
barryn
Posts: 10
Joined: Tue Oct 15, 2024 4:05 am

Re: Trying to get any websocket IRC client to work with UnrealIRCd

Post by barryn »

After you reply to this I will edit this post and remove the URL.
URL removed.
Last edited by barryn on Wed Oct 16, 2024 11:34 am, edited 1 time in total.
barryn
Posts: 10
Joined: Tue Oct 15, 2024 4:05 am

Re: Trying to get any websocket IRC client to work with UnrealIRCd

Post by barryn »

This is the relevant section of unrealircd.conf

Code: Select all

loadmodule "websocket";
loadmodule "webserver";
listen {
    ip *;
    port 8000;
    options {
        tls;
        websocket { type text; } // type must be either 'text' or 'binary'
    };
    tls-options {
        certificate "/home/irc/unrealircd/conf/tls/server.cert.pem";
        key "/home/irc/unrealircd/conf/tls/server.key.pem";
        options {
            no-client-certificate;
        };
    };
};
barryn
Posts: 10
Joined: Tue Oct 15, 2024 4:05 am

Re: Trying to get any websocket IRC client to work with UnrealIRCd

Post by barryn »

I tried a websocket type of binary also, and that did not work either.
CrazyCat
Posts: 272
Joined: Thu Apr 28, 2005 1:05 pm
Location: France
Contact:

Re: Trying to get any websocket IRC client to work with UnrealIRCd

Post by CrazyCat »

Well, first you have an error with a call to customise.html which doesn't exists (plugin section of config.json).

And when trying to connect, you have a security error (NS_ERROR_CONTENT_BLOCKED) which should explain why it doesn't work

source of the error: your server returns a canonical name which is not from the same domain, so most of the browsers block that
Last edited by CrazyCat on Wed Oct 16, 2024 11:47 am, edited 2 times in total.
barryn
Posts: 10
Joined: Tue Oct 15, 2024 4:05 am

Re: Trying to get any websocket IRC client to work with UnrealIRCd

Post by barryn »

Bookmark it, I am removing the URL now.
barryn
Posts: 10
Joined: Tue Oct 15, 2024 4:05 am

Re: Trying to get any websocket IRC client to work with UnrealIRCd

Post by barryn »

I got it working, I needed the unset the header "Content-Security-Policy" on the web server. :( It didn't throw any error on the page, it would just never connect to the IRC server.
Syzop
UnrealIRCd head coder
Posts: 2181
Joined: Sat Mar 06, 2004 8:57 pm
Location: .nl
Contact:

Re: Trying to get any websocket IRC client to work with UnrealIRCd

Post by Syzop »

I made the same mistake when updating the Content-Security-Policy header (CSP) on unrealircd.org a while back.
To fix it I added this to the Content-Security-Polic header string: connect-src wss://irc.unrealircd.org/;
Then https://www.unrealircd.org/files/dev/ws ... lircd.html was able to connect to irc.unrealircd.org again.
Though by that I broke the ability for it to connect to other sites, and since that websocket demo on unrealircd.org is a test tool I should probably allow all websocket destinations.

By the way, bit off-topic but you can see such errors in Firefox and Chrome in the web developer console. CTRL+SHIFT+I (that's a capital i) and then click the "Console" tab. If you then reload the page or try/click something that doesn't work you will see an error printed there. Just mentioning it so you don't bang your head against the wall too much next time ;D
barryn
Posts: 10
Joined: Tue Oct 15, 2024 4:05 am

Re: Trying to get any websocket IRC client to work with UnrealIRCd

Post by barryn »

Thanks! I guess we can close this and leave it as a closed issue that others can find. I also created this custom fork of Kiwi IRC with minor changes to the default config.json and updates to the README.md.

Updated Kiwi IRC with notes about using it with Unreal IRC
Post Reply