Git Product home page Git Product logo

Comments (20)

TrueBrain avatar TrueBrain commented on May 21, 2024 1

Currently you indeed either have a single presence, or multi presence with IPv6 prefix. This is there not only for the connection limit, but also for bans etc. Using a single IP for multiple clients just doesn't feel right.

Allowing it is a relative small code change, but I am a bit reluctant to make it, as I am afraid people will misunderstand it, and use multi presence on public IRC networks. This will go horribly wrong :D

What you can also do, if your IRCd is local, is setup a /80 on your local address range .. so ::1:0:0:0/80 or something. That allows you to use multi presence, allow banning users, and "just works". Would that work for you?
Edit: localhost on modern kernels/OSes mostly already have an IPv6, even of your network doesn't. That is why this might work :)

If not, let me sleep on this :)

And happy you like this project. If there is anything you are missing, feel free to open an issue to request that feature (like you just did for thisone :D)

from dibridge.

TrueBrain avatar TrueBrain commented on May 21, 2024 1

I recently changed that if you use port 6697 it uses SSL, otherwise it does not. It seems I overlooked some remarks regarding this in the README; will fix soon :)

from dibridge.

poVoq avatar poVoq commented on May 21, 2024 1

Ah it adds a [d].

with

sysctl -w net.ipv6.ip_nonlocal_bind=1
ip route add local 2001:db8:100::/80 dev lo

and --irc-puppet-ip-range 2001:db8:100::/80

it seems to work!

from dibridge.

TrueBrain avatar TrueBrain commented on May 21, 2024 1

This bridge is not really meant to bridge more than one channel, as it will create new puppets for every channel.

But yeah, otherwise this setup will run fine, as far as I am aware. The project isn't that old, so there might be lingering bugs, but what you have now should be stable.

from dibridge.

TrueBrain avatar TrueBrain commented on May 21, 2024 1

Nothing a simple search can't answer for you, as it depend on your OS :)

Mostly, sysctl can be added to /etc/sysctl.conf.

Ip configuration really depends on the OS, and has no single answer. On could for example add it to their network manager or a startup script. For example in /etc/rc.local.

from dibridge.

dwfreed avatar dwfreed commented on May 21, 2024

Just allow as many connections as you want from the /64 the bridge uses? Any IRCd worth using can do that.

from dibridge.

poVoq avatar poVoq commented on May 21, 2024

Sorry, maybe I am just dense right now (its late), but how do I configure this? The readme sounds like this is disabled without using ipv6.

edit: I have no ipv6 setup at all right now as it would require re-engineering my entire network setup grown over the years...

from dibridge.

poVoq avatar poVoq commented on May 21, 2024

Hmm, I will look into that option of ipv6 on local host only. Thanks for suggesting it.

But normally the issue you describe is solved by the WebIRC Extension:
https://ircv3.net/specs/extensions/webirc.html

Maybe make that mandatory without ipv6 for puppets?

edit: and banning users only on the IRC side with them remaining on the Discord side would be a bit strange, no? Better ban them on Discord directly?

from dibridge.

TrueBrain avatar TrueBrain commented on May 21, 2024

Please bare in mind the reason I build this is another use case. If a user does something that causes a public IRC to kline that user, it would take all other users with it ;) so unique IPs really are important in my use case :)

I haven't seen any public IRC that supports WebIRC for 3rd parties, but I can see it working for your use case. So that might be a solid solution for your use case too.

But as I don't have a setup for it, I do not think I can find the motivation to add support for that. But I am not against someone making a Pull Request for it. If you are up for it, please do! Of course I can give support where needed :)

from dibridge.

poVoq avatar poVoq commented on May 21, 2024

Ok, I'll try if it works with localhost ip6 puppets first. Thanks for the quick answers :)

from dibridge.

TrueBrain avatar TrueBrain commented on May 21, 2024

Just curious, did you manage to get it to work over IPv6?

from dibridge.

poVoq avatar poVoq commented on May 21, 2024

Have not got around testing it yet.

Quick question: the readme sounds like it will only work with SSL connections? I guess on local host I could also connect the puppets via 6667, no?

from dibridge.

poVoq avatar poVoq commented on May 21, 2024

I tried it now, but it seems to have problems resolving the hostname on IPv6.

it is working fine as a simple bot bridge, but when starting it with --irc-puppet-ip-range ::1:0:0:0/80 I get this error when someone sends a message from Discord:

2022-09-12 19:14:11 INFO     [dibridge.irc_puppet.poVoq] Connecting to IRC from ::1:987b:7b2c:7197 ...
2022-09-12 19:14:11 ERROR    [asyncio] Task exception was never retrieved
future: <Task finished name='Task-21' coro=<IRCPuppet.connect() done, defined at /opt/dibridge/dibridge/irc_puppet.py:115> exception=gaierror(-5, 'No address associated with hostname')>
Traceback (most recent call last):
  File "/opt/dibridge/dibridge/irc_puppet.py", line 122, in connect
    await self.connection.connect(
  File "/home/dibridge/.local/lib/python3.10/site-packages/irc/client_aio.py", line 158, in connect
    transport, protocol = await connection
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1025, in create_connection
    infos = await self._ensure_resolved(
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1404, in _ensure_resolved
    return await loop.getaddrinfo(host, port, family=family, type=type,
  File "/usr/lib/python3.10/asyncio/base_events.py", line 860, in getaddrinfo
    return await self.run_in_executor(
  File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/lib/python3.10/socket.py", line 955, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -5] No address associated with hostname

I guess I could tell dibridge to connect to the IRC server on a local ipv6 address instead of the ipv4 only fully qualified DNS? Or is something else causing this? I don't have much experience with IPv6 so I have honestly no idea :(

from dibridge.

TrueBrain avatar TrueBrain commented on May 21, 2024

Well, your guess is right, so you are not far off. You cannot connect (without more configuration) to an IPv4 address via IPv6. You need to make sure it resolves to an IPv6 that is valid. My assumption was that it would be local host, so ::1 (or localhost) should work.

from dibridge.

poVoq avatar poVoq commented on May 21, 2024

With ::1 it refuses to connect because of a certificate error, but I guess allowing non SSL connection on port 6667 should fix that... lemme try that :)

from dibridge.

poVoq avatar poVoq commented on May 21, 2024

Ok that did work for the Ipv6 connection, but it still fails with an error on sending a message via the puppet:

2022-09-12 19:46:35 INFO     [dibridge.irc_puppet.poVoq] Connecting to IRC from ::1:987b:7b2c:7197 ...
2022-09-12 19:46:35 ERROR    [asyncio] Task exception was never retrieved
future: <Task finished name='Task-23' coro=<IRCPuppet.connect() done, defined at /opt/dibridge/dibridge/irc_puppet.py:115> exception=OSError(99, "error while attempting to bind on address ('::1:987b:7b2c:7197', 0, 0, 0): cannot assign requested address")>
Traceback (most recent call last):
  File "/opt/dibridge/dibridge/irc_puppet.py", line 122, in connect
    await self.connection.connect(
  File "/home/dibridge/.local/lib/python3.10/site-packages/irc/client_aio.py", line 158, in connect
    transport, protocol = await connection
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1064, in create_connection
    raise exceptions[0]
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1049, in create_connection
    sock = await self._connect_sock(
  File "/usr/lib/python3.10/asyncio/base_events.py", line 959, in _connect_sock
    raise my_exceptions.pop()
OSError: [Errno 99] error while attempting to bind on address ('::1:987b:7b2c:7197', 0, 0, 0): cannot assign requested address

from dibridge.

TrueBrain avatar TrueBrain commented on May 21, 2024

Please try with 2001:db8:100::/80. I have seen before that on localhost it doesn't always work as one might hope/like.

The above IP is of the "example IPv6 range", but otherwise a fully valid IPv6 (just not routable), so perfect for checking out if this works :)

PS: Also don't forget sysctl -w net.ipv6.ip_nonlocal_bind=1, as per README. See https://github.com/OpenTTD/dibridge#irc-server for what works on all machines I tested that on. You of course don't need the docker, but the rest is the same.

from dibridge.

poVoq avatar poVoq commented on May 21, 2024

I put sysctl -w net.ipv6.ip_nonlocal_bind=1 and now it seems to hang at the puppet creation step. But no crash.

Is it possible that it just has a name clash? The username I have on Discord is the same I have reserved on the IRC server.

Does the bridge make alt nicks like "user__" or so if the nick it tries to make is already taken or reserved?

Edit: time-out error after a while:

2022-09-12 20:01:56 INFO     [dibridge.irc_puppet.poVoq] Connecting to IRC from ::1:987b:7b2c:7197 ...
2022-09-12 20:04:06 ERROR    [asyncio] Task exception was never retrieved
future: <Task finished name='Task-18' coro=<IRCPuppet.connect() done, defined at /opt/dibridge/dibridge/irc_puppet.py:115> exception=TimeoutError(110, "Connect call failed ('::1', 6667, 0, 0)")>
Traceback (most recent call last):
  File "/opt/dibridge/dibridge/irc_puppet.py", line 122, in connect
    await self.connection.connect(
  File "/home/dibridge/.local/lib/python3.10/site-packages/irc/client_aio.py", line 158, in connect
    transport, protocol = await connection
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1064, in create_connection
    raise exceptions[0]
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1049, in create_connection
    sock = await self._connect_sock(
  File "/usr/lib/python3.10/asyncio/base_events.py", line 960, in _connect_sock
    await self.sock_connect(sock, address)
  File "/usr/lib/python3.10/asyncio/selector_events.py", line 499, in sock_connect
    return await fut
  File "/usr/lib/python3.10/asyncio/selector_events.py", line 534, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
TimeoutError: [Errno 110] Connect call failed ('::1', 6667, 0, 0)

from dibridge.

poVoq avatar poVoq commented on May 21, 2024

Would you suggest I just keep using it like that?

Is there any issue with this when running multiple instances of dibridge to bridge more than one channel?

from dibridge.

poVoq avatar poVoq commented on May 21, 2024

Any idea how to persist these settings on a server restart?

sysctl -w net.ipv6.ip_nonlocal_bind=1
ip route add local 2001:db8:100::/80 dev lo

from dibridge.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.