blob: 49c07f8d4878167e8ec67c8a81034df88353f39c [file] [log] [blame]
Piotr Dobrowolskic39fb042019-05-17 09:13:56 +02001# Configuration specific to AS registration. Unless other marked, all fields
2# are *REQUIRED*.
3homeserver:
4 # The URL to the home server for client-server API calls, also used to form the
5 # media URLs as displayed in bridged IRC channels:
6 url: "http://localhost:8008"
7 #
8 # The URL of the homeserver hosting media files. This is only used to transform
9 # mxc URIs to http URIs when bridging m.room.[file|image] events. Optional. By
10 # default, this is the homeserver URL, specified above.
11 #
12 # media_url: "http://media.repo:8008"
13
14 # Drop Matrix messages which are older than this number of seconds, according to
15 # the event's origin_server_ts.
16 # If the bridge is down for a while, the homeserver will attempt to send all missed
17 # events on reconnection. These events may be hours old, which can be confusing to
18 # IRC users if they are then bridged. This option allows these old messages to be
19 # dropped.
20 # CAUTION: This is a very coarse heuristic. Federated homeservers may have different
21 # clock times and hence produce different origin_server_ts values, which may be old
22 # enough to cause *all* events from the homeserver to be dropped.
23 # Default: 0 (don't ever drop)
24 dropMatrixMessagesAfterSecs: 300 # 5 minutes
25
26 # The 'domain' part for user IDs on this home server. Usually (but not always)
27 # is the "domain name" part of the HS URL.
28 domain: "localhost"
29
30 # Should presence be enabled for matrix clients on this bridge. If disabled on the
31 # homeserver then it should also be disabled here to avoid excess traffic.
32 # Default: true
33 enablePresence: true
34
35# Configuration specific to the IRC service
36ircService:
37 servers:
38 # The address of the server to connect to.
39 irc.freenode.net:
40 # A human-readable short name. This is used to label IRC status rooms
41 # where matrix users control their connections.
42 # E.g. 'ExampleNet IRC Bridge status'.
43 # It is also used in the Third Party Lookup API as the instance `desc`
44 # property, where each server is an instance.
45 name: "Freenode"
46
47 # An ID for uniquely identifying this server amongst other servers being bridged.
48 networkId: "freenode"
49
50 # URL to an icon used as the network icon whenever this network appear in
51 # a network list. (Like in the riot room directory, for instance.)
52 # icon: https://example.com/images/hash.png
53
54 # The port to connect to. Optional.
55 port: 6697
56 # Whether to use SSL or not. Default: false.
57 ssl: true
58 # Whether or not IRC server is using a self-signed cert or not providing CA Chain
59 sslselfsign: false
60 # Should the connection attempt to identify via SASL (if a server or user password is given)
61 # If false, this will use PASS instead. If SASL fails, we do not fallback to PASS.
62 sasl: false
63 # Whether to allow expired certs when connecting to the IRC server.
64 # Usually this should be off. Default: false.
65 allowExpiredCerts: false
66 # A specific CA to trust instead of the default CAs. Optional.
67 #ca: |
68 # -----BEGIN CERTIFICATE-----
69 # ...
70 # -----END CERTIFICATE-----
71
72 #
73 # The connection password to send for all clients as a PASS (or SASL, if enabled above) command. Optional.
74 # password: 'pa$$w0rd'
75 #
76 # Whether or not to send connection/error notices to real Matrix users. Default: true.
77 sendConnectionMessages: true
78
79 quitDebounce:
80 # Whether parts due to net-splits are debounced for delayMs, to allow
81 # time for the netsplit to resolve itself. A netsplit is detected as being
82 # a QUIT rate higher than quitsPerSecond. Default: false.
83 enabled: false
84 # The maximum number of quits per second acceptable above which a netsplit is
85 # considered ongoing. Default: 5.
86 quitsPerSecond: 5
87 # The time window in which to wait before bridging a QUIT to Matrix that occurred during
88 # a netsplit. Debouncing is jittered randomly between delayMinMs and delayMaxMs so that the HS
89 # is not sent many requests to leave rooms all at once if a netsplit occurs and many
90 # people to not rejoin.
91 # If the user with the same IRC nick as the one who sent the quit rejoins a channel
92 # they are considered back online and the quit is not bridged, so long as the rejoin
93 # occurs before the randomly-jittered timeout is not reached.
94 # Default: 3600000, = 1h
95 delayMinMs: 3600000 # 1h
96 # Default: 7200000, = 2h
97 delayMaxMs: 7200000 # 2h
98
99 # A map for conversion of IRC user modes to Matrix power levels. This enables bridging
100 # of IRC ops to Matrix power levels only, it does not enable the reverse. If a user has
101 # been given multiple modes, the one that maps to the highest power level will be used.
102 modePowerMap:
103 o: 50
104
105 botConfig:
106 # Enable the presence of the bot in IRC channels. The bot serves as the entity
107 # which maps from IRC -> Matrix. You can disable the bot entirely which
108 # means IRC -> Matrix chat will be shared by active "M-Nick" connections
109 # in the room. If there are no users in the room (or if there are users
110 # but their connections are not on IRC) then nothing will be bridged to
111 # Matrix. If you're concerned about the bot being treated as a "logger"
112 # entity, then you may want to disable the bot. If you want IRC->Matrix
113 # but don't want to have TCP connections to IRC unless a Matrix user speaks
114 # (because your client connection limit is low), then you may want to keep
115 # the bot enabled. Default: true.
116 # NB: If the bot is disabled, you SHOULD have matrix-to-IRC syncing turned
117 # on, else there will be no users and no bot in a channel (meaning no
118 # messages to Matrix!) until a Matrix user speaks which makes a client
119 # join the target IRC channel.
120 # NBB: The bridge bot IRC client will still join the target IRC network so
121 # it can service bridge-specific queries from the IRC-side e.g. so
122 # real IRC clients have a way to change their Matrix display name.
123 # See https://github.com/matrix-org/matrix-appservice-irc/issues/55
124 enabled: false
125 # The nickname to give the AS bot.
126 nick: "hswaw_matrix"
127 # The password to give to NickServ or IRC Server for this nick. Optional.
128 # password: "helloworld"
129 #
130 # Join channels even if there are no Matrix users on the other side of
131 # the bridge. Set to false to prevent the bot from joining channels which have no
132 # real matrix users in them, even if there is a mapping for the channel.
133 # Default: true
134 joinChannelsIfNoUsers: false
135
136 # Configuration for PMs / private 1:1 communications between users.
137 privateMessages:
138 # Enable the ability for PMs to be sent to/from IRC/Matrix.
139 # Default: true.
140 enabled: true
141 # Prevent Matrix users from sending PMs to the following IRC nicks.
142 # Optional. Default: [].
143 # exclude: ["Alice", "Bob"] # NOT YET IMPLEMENTED
144
145 # Should created Matrix PM rooms be federated? If false, only users on the
146 # HS attached to this AS will be able to interact with this room.
147 # Optional. Default: true.
148 federate: false
149
150 # Configuration for mappings not explicitly listed in the 'mappings'
151 # section.
152 dynamicChannels:
153 # Enable the ability for Matrix users to join *any* channel on this IRC
154 # network.
155 # Default: false.
156 enabled: true
157 # Should the AS create a room alias for the new Matrix room? The form of
158 # the alias can be modified via 'aliasTemplate'. Default: true.
159 createAlias: true
160 # Should the AS publish the new Matrix room to the public room list so
161 # anyone can see it? Default: true.
162 published: true
163 # What should the join_rule be for the new Matrix room? If 'public',
164 # anyone can join the room. If 'invite', only users with an invite can
165 # join the room. Note that if an IRC channel has +k or +i set on it,
166 # join_rules will be set to 'invite' until these modes are removed.
167 # Default: "public".
168 joinRule: public
169 # This will set the m.room.related_groups state event in newly created rooms
170 # with the given groupId. This means flares will show up on IRC users in those rooms.
171 # This should be set to the same thing as namespaces.users.group_id in irc_registration.
172 # This does not alter existing rooms.
173 # Leaving this option empty will not set the event.
174 groupId: +freenode:hackerspace.pl
175 # Should created Matrix rooms be federated? If false, only users on the
176 # HS attached to this AS will be able to interact with this room.
177 # Default: true.
178 federate: false
179 # The room alias template to apply when creating new aliases. This only
180 # applies if createAlias is 'true'. The following variables are exposed:
181 # $SERVER => The IRC server address (e.g. "irc.example.com")
182 # $CHANNEL => The IRC channel (e.g. "#python")
183 # This MUST have $CHANNEL somewhere in it.
184 # Default: '#irc_$SERVER_$CHANNEL'
185 aliasTemplate: "#freenode_$CHANNEL"
186 # A list of user IDs which the AS bot will send invites to in response
187 # to a !join. Only applies if joinRule is 'invite'. Default: []
188 # whitelist:
189 # - "@foo:example.com"
190 # - "@bar:example.com"
191 #
192 # Prevent the given list of channels from being mapped under any
193 # circumstances.
194 # exclude: ["#foo", "#bar"]
195
196 # Configuration for controlling how Matrix and IRC membership lists are
197 # synced.
198 membershipLists:
199 # Enable the syncing of membership lists between IRC and Matrix. This
200 # can have a significant effect on performance on startup as the lists are
201 # synced. This must be enabled for anything else in this section to take
202 # effect. Default: false.
203 enabled: true
204
205 # Syncing membership lists at startup can result in hundreds of members to
206 # process all at once. This timer drip feeds membership entries at the
207 # specified rate. Default: 10000. (10s)
208 floodDelayMs: 10000
209
210 global:
211 ircToMatrix:
212 # Get a snapshot of all real IRC users on a channel (via NAMES) and
213 # join their virtual matrix clients to the room.
214 initial: true
215 # Make virtual matrix clients join and leave rooms as their real IRC
216 # counterparts join/part channels. Default: false.
217 incremental: true
218
219 matrixToIrc:
220 # Get a snapshot of all real Matrix users in the room and join all of
221 # them to the mapped IRC channel on startup. Default: false.
222 initial: true
223 # Make virtual IRC clients join and leave channels as their real Matrix
224 # counterparts join/leave rooms. Make sure your 'maxClients' value is
225 # high enough! Default: false.
226 incremental: true
227
228 # Apply specific rules to Matrix rooms. Only matrix-to-IRC takes effect.
229 #rooms:
230 # - room: "!fuasirouddJoxtwfge:localhost"
231 # matrixToIrc:
232 # initial: false
233 # incremental: false
234
235 # Apply specific rules to IRC channels. Only IRC-to-matrix takes effect.
236 #channels:
237 # - channel: "#foo"
238 # ircToMatrix:
239 # initial: false
240 # incremental: false
241
Piotr Dobrowolski3d5bb6f2021-02-13 19:57:18 +0100242 # Should the bridge ignore users which are not considered active on the bridge
243 # during startup
244 ignoreIdleUsersOnStartup:
245 enabled: true
246 # How many hours can a user be considered idle for before they are considered
247 # ignoreable
248 idleForHours: 72
249 # A regex which will exclude matching MXIDs from this check.
250 # exclude: "foobar"
251
Piotr Dobrowolskic39fb042019-05-17 09:13:56 +0200252 #mappings:
253 # 1:many mappings from IRC channels to room IDs on this IRC server.
254 # The matrix room must already exist. Your matrix client should expose
255 # the room ID in a "settings" page for the room.
256 #"#thepub": ["!kieouiJuedJoxtVdaG:localhost"]
257
258 # Configuration for virtual matrix users. The following variables are
259 # exposed:
260 # $NICK => The IRC nick
261 # $SERVER => The IRC server address (e.g. "irc.example.com")
262 matrixClients:
263 # The user ID template to use when creating virtual matrix users. This
264 # MUST have $NICK somewhere in it.
265 # Optional. Default: "@$SERVER_$NICK".
266 # Example: "@irc.example.com_Alice:example.com"
267 userTemplate: "@freenode_$NICK"
268 # The display name to use for created matrix clients. This should have
269 # $NICK somewhere in it if it is specified. Can also use $SERVER to
270 # insert the IRC domain.
271 # Optional. Default: "$NICK (IRC)". Example: "Alice (IRC)"
272 displayName: "$NICK"
273 # Number of tries a client can attempt to join a room before the request
274 # is discarded. You can also use -1 to never retry or 0 to never give up.
275 # Optional. Default: -1
276 joinAttempts: -1
277
278 # Configuration for virtual IRC users. The following variables are exposed:
279 # $LOCALPART => The user ID localpart ("alice" in @alice:localhost)
280 # $USERID => The user ID
281 # $DISPLAY => The display name of this user, with excluded characters
282 # (e.g. space) removed. If the user has no display name, this
283 # falls back to $LOCALPART.
284 ircClients:
285 # The template to apply to every IRC client nick. This MUST have either
286 # $DISPLAY or $USERID or $LOCALPART somewhere in it.
287 # Optional. Default: "M-$DISPLAY". Example: "M-Alice".
288 nickTemplate: "$DISPLAY"
289 # True to allow virtual IRC clients to change their nick on this server
290 # by issuing !nick <server> <nick> commands to the IRC AS bot.
291 # This is completely freeform: it will NOT follow the nickTemplate.
292 allowNickChanges: true
293 # The max number of IRC clients that will connect. If the limit is
294 # reached, the client that spoke the longest time ago will be
295 # disconnected and replaced.
296 # Optional. Default: 30.
297 maxClients: 30
298 # IPv6 configuration.
299 ipv6:
300 # Optional. Set to true to force IPv6 for outgoing connections.
301 only: false
302 # Optional. The IPv6 prefix to use for generating unique addresses for each
303 # connected user. If not specified, all users will connect from the same
304 # (default) address. This may require additional OS-specific work to allow
305 # for the node process to bind to multiple different source addresses
306 # e.g IP_FREEBIND on Linux, which requires an LD_PRELOAD with the library
307 # https://github.com/matrix-org/freebindfree as Node does not expose setsockopt.
308 # prefix: "2001:0db8:85a3::" # modify appropriately
309 #
310 # The maximum amount of time in seconds that the client can exist
311 # without sending another message before being disconnected. Use 0 to
312 # not apply an idle timeout. This value is ignored if this IRC server is
313 # mirroring matrix membership lists to IRC. Default: 172800 (48 hours)
314 idleTimeout: 10800
315 # The number of millseconds to wait between consecutive reconnections if a
316 # client gets disconnected. Setting to 0 will cause the scheduling to be
317 # disabled, i.e. it will be scheduled immediately (with jitter.
318 # Otherwise, the scheduling interval will be used such that one client
319 # reconnect for this server will be handled every reconnectIntervalMs ms using
320 # a FIFO queue.
321 # Default: 5000 (5 seconds)
322 reconnectIntervalMs: 5000
323 # The number of concurrent reconnects if a user has been disconnected unexpectedly
324 # (e.g. a netsplit). You should set this to a reasonably high number so that
325 # bridges are not waiting an eternity to reconnect all its clients if
326 # we see a massive number of disconnect. This is unrelated to the reconnectIntervalMs
327 # setting above which is for connecting on restart of the bridge. Set to 0 to
328 # immediately try to reconnect all users.
329 # Default: 50
330 concurrentReconnectLimit: 50
331 # The number of lines to allow being sent by the IRC client that has received
332 # a large block of text to send from matrix. If the number of lines that would
333 # be sent is > lineLimit, the text will instead be uploaded to matrix and the
334 # resulting URI is treated as a file. As such, a link will be sent to the IRC
335 # side instead of potentially spamming IRC and getting the IRC client kicked.
336 # Default: 3.
337 lineLimit: 3
338 # A list of user modes to set on every IRC client. For example, "RiG" would set
339 # +R, +i and +G on every IRC connection when they have successfully connected.
340 # User modes vary wildly depending on the IRC network you're connecting to,
341 # so check before setting this value. Some modes may not work as intended
342 # through the bridge e.g. caller ID as there is no way to /ACCEPT.
343 # Default: "" (no user modes)
344 # userModes: "R"
345
346 # Configuration for an ident server. If you are running a public bridge it is
347 # advised you setup an ident server so IRC mods can ban specific matrix users
348 # rather than the application service itself.
349 ident:
350 # True to listen for Ident requests and respond with the
351 # matrix user's user_id (converted to ASCII, respecting RFC 1413).
352 # Default: false.
353 enabled: false
354 # The port to listen on for incoming ident requests.
355 # Ports below 1024 require root to listen on, and you may not want this to
356 # run as root. Instead, you can get something like an Apache to yank up
357 # incoming requests to 113 to a high numbered port. Set the port to listen
358 # on instead of 113 here.
359 # Default: 113.
360 port: 1113
361 # The address to listen on for incoming ident requests.
362 # Default: 0.0.0.0
363 address: "::"
364
365 # Configuration for logging. Optional. Default: console debug level logging
366 # only.
367 logging:
368 # Level to log on console/logfile. One of error|warn|info|debug
369 level: "debug"
370 # The file location to log to. This is relative to the project directory.
371 logfile: "debug.log"
372 # The file location to log errors to. This is relative to the project
373 # directory.
374 errfile: "errors.log"
375 # Whether to log to the console or not.
376 toConsole: true
377 # The max number of files to keep. Files will be overwritten eventually due
378 # to rotations.
379 maxFiles: 5
380
381 # Optional. Enable Prometheus metrics. If this is enabled, you MUST install `prom-client`:
382 # $ npm install prom-client@6.3.0
383 # Metrics will then be available via GET /metrics on the bridge listening port (-p).
384 metrics:
385 # Whether to actually enable the metric endpoint. Default: false
386 enabled: true
387 # When collecting remote user active times, which "buckets" should be used. Defaults are given below.
388 # The bucket name is formed of a duration and a period. (h=hours,d=days,w=weeks).
389 remoteUserAgeBuckets:
390 - "1h"
391 - "1d"
392 - "1w"
393
Piotr Dobrowolskic39fb042019-05-17 09:13:56 +0200394 # Configuration options for the debug HTTP API. To access this API, you must
395 # append ?access_token=$APPSERVICE_TOKEN (from the registration file) to the requests.
396 #
397 # The debug API exposes the following endpoints:
398 #
399 # GET /irc/$domain/user/$user_id => Return internal state for the IRC client for this user ID.
400 #
401 # POST /irc/$domain/user/$user_id => Issue a raw IRC command down this connection.
402 # Format: new line delimited commands as per IRC protocol.
403 #
404 debugApi:
405 # True to enable the HTTP API endpoint. Default: false.
406 enabled: false
407 # The port to host the HTTP API.
408 port: 11100
409
410 # Configuration for the provisioning API.
411 #
412 # GET /_matrix/provision/link
413 # GET /_matrix/provision/unlink
414 # GET /_matrix/provision/listlinks
415 #
416 provisioning:
417 # True to enable the provisioning HTTP endpoint. Default: false.
418 enabled: true
419 # The number of seconds to wait before giving up on getting a response from
420 # an IRC channel operator. If the channel operator does not respond within the
421 # allotted time period, the provisioning request will fail.
422 # Default: 300 seconds (5 mins)
423 requestTimeoutSeconds: 300
424
425 # WARNING: The bridge needs to send plaintext passwords to the IRC server, it cannot
426 # send a password hash. As a result, passwords (NOT hashes) are stored encrypted in
427 # the database.
428 #
429 # To generate a .pem file:
430 # $ openssl genpkey -out passkey.pem -outform PEM -algorithm RSA -pkeyopt rsa_keygen_bits:2048
431 #
432 # The path to the RSA PEM-formatted private key to use when encrypting IRC passwords
433 # for storage in the database. Passwords are stored by using the admin room command
434 # `!storepass server.name passw0rd. When a connection is made to IRC on behalf of
435 # the Matrix user, this password will be sent as the server password (PASS command).
436 #passwordEncryptionKeyPath: "passkey.pem"
437
438 # Config for Matrix -> IRC bridging
439 matrixHandler:
440 # Cache this many matrix events in memory to be used for m.relates_to messages (usually replies).
441 eventCacheSize: 4096
442
443# Options here are generally only applicable to large-scale bridges and may have
444# consequences greater than other options in this configuration file.
445advanced:
446 # The maximum number of HTTP(S) sockets to maintain. Usually this is unlimited
447 # however for large bridges it is important to rate limit the bridge to avoid
448 # accidentally overloading the homeserver. Defaults to 1000, which should be
449 # enough for the vast majority of use cases.
450 maxHttpSockets: 1000
Piotr Dobrowolski57349d22020-03-21 22:15:18 +0100451
452database:
453 engine: "nedb"
454 connectionString: "nedb:///data"