Giter Site home page Giter Site logo

matrix-appservice-irc's Introduction

Matrix IRC Bridge

Docker Image Version (latest semver) Build Status #irc:matrix.org

This is an IRC bridge for Matrix. If you're upgrading from an old release, be sure to read the CHANGELOG as there may be breaking changes between releases.

This bridge will pass all IRC messages through to Matrix, and all Matrix messages through to IRC. It is highly configurable and is currently used on the matrix.org homeserver to bridge a number of popular IRC networks.

We maintain a list of bridged IRC networks here.

What does it do?

On startup, the bridge will join Matrix clients to the IRC channels specified in the configuration file. It will then listen for incoming IRC messages and forward them through to Matrix rooms Each real Matrix user is represented by an IRC client, and each real IRC client is represented by a Matrix user. Full two-way communication in channels and PMs are supported, along with a huge array of customisation options.

Usage

To learn how to use the bridge, see our usage guide.

Setting up your own bridge

You will need a Matrix homeserver to run this bridge. Any homeserver that supports the AS API should work.

See the getting started docs for instructions on how to set up the bridge.

Configuration

See the sample config file for an explanation of the configuration options available.

Documentation

Documentation can be found on GitHub Pages.

You can build the documentaion yourself by:

# Ensure that Rust is installed on your system.
# cargo install mdbook
mdbook build
sensible-browser book/index.html

Contributing

Please see the CONTRIBUTING file for information on contributing.

matrix-appservice-irc's People

Contributors

aidalgol avatar ara4n avatar bernardzhao avatar dakrone avatar dalcde avatar dbkr avatar delta1977 avatar emersonveenstra avatar erikjohnston avatar gdamjan avatar half-shot avatar heftig avatar illicitonion avatar jaller94 avatar jaywink avatar justinbot avatar kegsay avatar leonerd avatar lub avatar lukebarnard1 avatar mikaela avatar progval avatar silkeh avatar sohumb avatar sporksmith avatar t3chguy avatar tadzik avatar turt2live avatar vranki avatar xiretza avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

matrix-appservice-irc's Issues

Check connection notices don't lie

The irc bridge lies to you when it connects you and the target name is taken. It connected me as M-turt2live1 (cause M-turt2live was taken), but said it connected me as M-turt2live

By @ turt2live:matrix.org

NAMEs bucket doesn't seem to be popped

Commit: https://github.com/matrix-org/matrix-appservice-irc/tree/d1db5cc23e798bbbea97f5611c22425737543c35

Toml showed me some logs which indicated that the NAMEs bucket wasn't being processed (just pushed, and only 1 popped even though the request succeeded). It's possible that some refactoring has broken this so the bucket isn't purged, need to look into it more.

Manifests itself as initial IRC->M syncing not working even though it is enabled in the config (since it relies on that bucket).

The bot may violate IRC networks' terms of use

When trying to bridge between ircs://irc.indymedia.org/#ecobytes and #ecobytes:matrix.allmende.io, it has turned out the appservice is being banned quickly when forking into the virtual Matrix users.

At least the docs should carry a fair warning above the installation instructions, and provide instructions whom to speak with from popular IRC networks.

For Indymedia, it's #ircd. If this is a naming pattern that applies to all PoPs, the better.

Handle external entities

If you have Github set up to splat commits into an IRC channel, it's done by using bot users which never join the channel specified, but emit notices instead. The IRC AS treats this as a real user, provisions an account and sends a message from that bot user, but never parts it again, leading to lots and lots of GitHub123456789 users on the Matrix side.
We need to think of how we can gracefully do this, possibly by sending the messages from the AS itself? @appservice-irc:domain.com

https://matrix.org/jira/browse/BOTS-107

IRC invite-only channels and bans

At the moment, when a matrix-bridged user tries to join an IRC channel through the bridge, the bridge tries to make an equivalent IRC user join the channel on the IRC network. However, if the user fails to join the channel (eg. invite-only or banned user), the user will be allowed to enter the matrix room. As a consequence, if any other IRC-bridge user is allowed onto the IRC channel, the disallowed matrix user will be able to read all the messages sent to the IRC channel ; which is unexpected.

Example 1:

  • Matrix users M-A and M-B join IRC channel #I_#c
  • M-B is kickbanned from #I_#c via IRC
  • M-B can still read all the messages in #I_#c until it is kickbanned using matrix

Example 2:

  • Matrix user M-A joins invite-only channel #I_#c
  • Matrix user M-B, despite never having been invited into #I_#c, can just join the corresponding matrix room and listen to all the conversations, without any IRC user ever being aware he is there, given the equivalent IRC user cannot join the IRC channel.

I hope to be clear enough.

Thank you for all the work already done!

Re-invite matrix users who leave their PM room

If you have a PM room with an IRC user and then the Matrix user leaves the room, any subsequent messages the IRC user sends will be black holed effectively. We should invite the user who left back to the room (or create a new room and clobber, which may be easier to avoid constantly checking room state)

Track IRC users by hostmask, not by nick

IRC -> matrix user mapping should use the IRC user's ident (usually something like nick!user@host, which is also used for bans etc) instead of the current nick to identify IRC users. This is needed for #71 among other things.

Settings are mixed up between IRC servers

Settings are mixed up between IRC servers.
For example:

ircService:
  servers:
    irc.server1.net:
      port: 9999
    irc.server2.net:
      port: 6667

matrix-appservice-irc will sometimes try to connect to irc.server1.net on port 6667, or irc.server2.net on port 9999. It seems to be order dependent; I can get it to work by reordering the servers.

Erroneous nick changes on freenode

I've been trying to change my nick using the appservice (@appservice-irc:matrix.org) on the freenode server.

It doesn't change my nick, but informs me of some other nick change after a long time (3-9 minutes). I making a wild guess that the nick change request is getting timed out and NickServ is just sending the last nick change as response.

I've noticed this only on freenode. I tried on MozNet (@mozilla-irc:matrix.org) and it worked with no issues.

PS : I'm attaching a screenshot for reference.

screenshot from 2015-12-13 03-50-26

Track nick changes on IRC

IRC users changing nicks should not spawn new matrix users, rather update their display names.
#72 is needed for this.

DB performance when using `[email protected]` is not acceptable

This issue is currently blocking a release from develop to master, and is nominally affecting the Freenode deployment on Matrix.org (the other IRC networks like Moznet are running develop happily as their workloads are less intense).


The issue

When you try to run develop on the Freenode deployment, things start well but quickly begin to slow down to a crawl before almost stopping. Logs begin to slow down then stop. CPU usage on the box indicates it is spinning at 100% CPU usage.

Investigation

After CPU profiling with node-inspector, it became clear this was a problem with NeDB. It was starving the event loop from executing tasks because it kept running this function: https://github.com/louischatriot/nedb/blob/master/lib/datastore.js#L309

More investigation indicated that the cause of this was that the IRC bridge was triggering tens of thousands of find queries, which NeDB was attempting to service. Adding in trace logging to the DataStore calls indicates that this is a problem with getIrcChannelsForRoomId which would be called with around 1000 room IDs on startup. This triggers 2 find queries (one to fetch the mapping, one to fetch the mapped room data).

Proposed solutions

  • Batch find statements using $in - The bridge knows the full set of rooms it needs to query, but then queries them one at a time.
  • Change the database format to store 1 row per complete mapping, ditching the idea of room entries. This would halve the number of queries as a single find would produce all the data required, rather than triggering another find to retrieve the rest of the room data.

Generated regexes in appservice config accept any HS

The namespaces generated by the generate command are too liberal, in that they will also forward messages from remote rooms that have their own aliases.

For example, my AS is configured with a #freenode_ alias. I would expect it to only bridge channels that have a LOCAL alias e.g. #freenode_#matrix:cmc.im. However, the generated config :

namespaces:
  users:
    - exclusive: true
      regex: '@freenode_.*:.*'
  aliases:
    - exclusive: true
      regex: '#freenode_.*:.*'

means that my HS is sending events from #freenode_#matrixhq:matrix.org to my AS.

Generated config produces incomplete Required string fields

After generation of the appservice configuration YAML, which is to be loaded by the homeserver, the latter complains:

matrix_1 | 2016-06-07 13:39:55,498 - synapse.storage.appservice - 238 - ERROR - - Failed to load appservice from '/data/appservice-registration-irc.yaml'
matrix_1 | 2016-06-07 13:39:55,498 - synapse.storage.appservice - 239 - ERROR - - "Required string field: 'id' (/data/appservice-registration-irc.yaml)"
matrix_1 | Traceback (most recent call last):
matrix_1 |   File "/usr/local/lib/python2.7/dist-packages/synapse/storage/appservice.py", line 215, in load_appservices
matrix_1 |     hostname, yaml.load(f), config_file
matrix_1 |   File "/usr/local/lib/python2.7/dist-packages/synapse/storage/appservice.py", line 155, in _load_appservice
matrix_1 |     field, config_filename,
matrix_1 | KeyError: "Required string field: 'id' (/data/appservice-registration-irc.yaml)"
matrix_1 | Traceback (most recent call last):
matrix_1 |   File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
matrix_1 |     "__main__", fname, loader, pkg_name)
matrix_1 |   File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
matrix_1 |     exec code in run_globals
matrix_1 |   File "/usr/local/lib/python2.7/dist-packages/synapse/app/homeserver.py", line 750, in <module>
matrix_1 |     main()
matrix_1 |   File "/usr/local/lib/python2.7/dist-packages/synapse/app/homeserver.py", line 745, in main
matrix_1 |     hs = setup(sys.argv[1:])
matrix_1 |   File "/usr/local/lib/python2.7/dist-packages/synapse/app/homeserver.py", line 420, in setup
matrix_1 |     hs.setup()
matrix_1 |   File "/usr/local/lib/python2.7/dist-packages/synapse/server.py", line 120, in setup
matrix_1 |     self.datastore = DataStore(self.get_db_conn(), self)
matrix_1 |   File "/usr/local/lib/python2.7/dist-packages/synapse/storage/__init__.py", line 178, in __init__
matrix_1 |     super(DataStore, self).__init__(hs)
matrix_1 |   File "/usr/local/lib/python2.7/dist-packages/synapse/storage/registration.py", line 29, in __init__
matrix_1 |     super(RegistrationStore, self).__init__(hs)
matrix_1 |   File "/usr/local/lib/python2.7/dist-packages/synapse/storage/appservice.py", line 39, in __init__
matrix_1 |     hs.config.app_service_config_files
matrix_1 |   File "/usr/local/lib/python2.7/dist-packages/synapse/storage/appservice.py", line 215, in load_appservices
matrix_1 |     hostname, yaml.load(f), config_file
matrix_1 |   File "/usr/local/lib/python2.7/dist-packages/synapse/storage/appservice.py", line 155, in _load_appservice
matrix_1 |     field, config_filename,
matrix_1 | KeyError: "Required string field: 'id' (/data/appservice-registration-irc.yaml)"

and indeed the configured configuration

url: 'http://matrix.allmende.io:9999'
as_token: 
hs_token: 
sender_localpart: appservice_irc
namespaces:
  users:
    - exclusive: true
      regex: '@indymedia_.*:.*'
  aliases:
    - exclusive: true
      regex: '#indymedia_.*:.*'
  rooms:
    - exclusive: false
      regex: '#ecobytes:matrix.allmende.io'

does not bring an id.

What have I done wrongly after filling out the config.yaml respective to my case?

Does not support IRC server password

I run a personal IRC server with a server password. Currently the 'appservicebot' is able to connect, but virtual users cannot as there's nowhere to specify a password for them.

!nick bug: Handle Bahamut's 435 error code

There's been reports of !nick commands just black holing and not changing nicks. After digging into this, it turns out that Bahamut will send a non-standard 435 response of the form:

<current_nick> <new_nick> <#channel> :Cannot change nickname while banned on channel

The bridge should feed this back to the client and cancel the NICK listener. This may require the node-irc library at https://github.com/matrix-org/node-irc to be updated to recognise this IRC code.

Propagate matrix display name changes to IRC (and vice versa)

https://matrix.org/jira/browse/BOTS-52

Matrix to irc propagation is hard because the two protocols scope names differently. Matrix allows per room display names but irc is per connection (global). We could manage this by just applying the most recent name change, but we need to accept mismatches are unavoidable.
Irc to matrix propagation is possible, though fiddly to implement (since the nick change necessitates a new user id, invites to all of the rooms the user was previously in, etc).

After thinking about this more, I wonder whether it would be more accurate to map Matrix user IDs to IRC user@host instead - in which case nick changes are just display name changes. Other points still hold though.

Doesn't work with guest access

2016-01-17 03:17:10 ERROR:client-connection [email protected]: {"command":"ERROR","rawCommand":"ERROR","commandType":"normal","args":["Closing Link: ns501493.ip-142-4-215.net (Invalid username [-qkkcjkomk])"]}

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.