blob: b49d11cc22452e7e9fe3bf06295c2f1831fbf243 [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
242 #mappings:
243 # 1:many mappings from IRC channels to room IDs on this IRC server.
244 # The matrix room must already exist. Your matrix client should expose
245 # the room ID in a "settings" page for the room.
246 #"#thepub": ["!kieouiJuedJoxtVdaG:localhost"]
247
248 # Configuration for virtual matrix users. The following variables are
249 # exposed:
250 # $NICK => The IRC nick
251 # $SERVER => The IRC server address (e.g. "irc.example.com")
252 matrixClients:
253 # The user ID template to use when creating virtual matrix users. This
254 # MUST have $NICK somewhere in it.
255 # Optional. Default: "@$SERVER_$NICK".
256 # Example: "@irc.example.com_Alice:example.com"
257 userTemplate: "@freenode_$NICK"
258 # The display name to use for created matrix clients. This should have
259 # $NICK somewhere in it if it is specified. Can also use $SERVER to
260 # insert the IRC domain.
261 # Optional. Default: "$NICK (IRC)". Example: "Alice (IRC)"
262 displayName: "$NICK"
263 # Number of tries a client can attempt to join a room before the request
264 # is discarded. You can also use -1 to never retry or 0 to never give up.
265 # Optional. Default: -1
266 joinAttempts: -1
267
268 # Configuration for virtual IRC users. The following variables are exposed:
269 # $LOCALPART => The user ID localpart ("alice" in @alice:localhost)
270 # $USERID => The user ID
271 # $DISPLAY => The display name of this user, with excluded characters
272 # (e.g. space) removed. If the user has no display name, this
273 # falls back to $LOCALPART.
274 ircClients:
275 # The template to apply to every IRC client nick. This MUST have either
276 # $DISPLAY or $USERID or $LOCALPART somewhere in it.
277 # Optional. Default: "M-$DISPLAY". Example: "M-Alice".
278 nickTemplate: "$DISPLAY"
279 # True to allow virtual IRC clients to change their nick on this server
280 # by issuing !nick <server> <nick> commands to the IRC AS bot.
281 # This is completely freeform: it will NOT follow the nickTemplate.
282 allowNickChanges: true
283 # The max number of IRC clients that will connect. If the limit is
284 # reached, the client that spoke the longest time ago will be
285 # disconnected and replaced.
286 # Optional. Default: 30.
287 maxClients: 30
288 # IPv6 configuration.
289 ipv6:
290 # Optional. Set to true to force IPv6 for outgoing connections.
291 only: false
292 # Optional. The IPv6 prefix to use for generating unique addresses for each
293 # connected user. If not specified, all users will connect from the same
294 # (default) address. This may require additional OS-specific work to allow
295 # for the node process to bind to multiple different source addresses
296 # e.g IP_FREEBIND on Linux, which requires an LD_PRELOAD with the library
297 # https://github.com/matrix-org/freebindfree as Node does not expose setsockopt.
298 # prefix: "2001:0db8:85a3::" # modify appropriately
299 #
300 # The maximum amount of time in seconds that the client can exist
301 # without sending another message before being disconnected. Use 0 to
302 # not apply an idle timeout. This value is ignored if this IRC server is
303 # mirroring matrix membership lists to IRC. Default: 172800 (48 hours)
304 idleTimeout: 10800
305 # The number of millseconds to wait between consecutive reconnections if a
306 # client gets disconnected. Setting to 0 will cause the scheduling to be
307 # disabled, i.e. it will be scheduled immediately (with jitter.
308 # Otherwise, the scheduling interval will be used such that one client
309 # reconnect for this server will be handled every reconnectIntervalMs ms using
310 # a FIFO queue.
311 # Default: 5000 (5 seconds)
312 reconnectIntervalMs: 5000
313 # The number of concurrent reconnects if a user has been disconnected unexpectedly
314 # (e.g. a netsplit). You should set this to a reasonably high number so that
315 # bridges are not waiting an eternity to reconnect all its clients if
316 # we see a massive number of disconnect. This is unrelated to the reconnectIntervalMs
317 # setting above which is for connecting on restart of the bridge. Set to 0 to
318 # immediately try to reconnect all users.
319 # Default: 50
320 concurrentReconnectLimit: 50
321 # The number of lines to allow being sent by the IRC client that has received
322 # a large block of text to send from matrix. If the number of lines that would
323 # be sent is > lineLimit, the text will instead be uploaded to matrix and the
324 # resulting URI is treated as a file. As such, a link will be sent to the IRC
325 # side instead of potentially spamming IRC and getting the IRC client kicked.
326 # Default: 3.
327 lineLimit: 3
328 # A list of user modes to set on every IRC client. For example, "RiG" would set
329 # +R, +i and +G on every IRC connection when they have successfully connected.
330 # User modes vary wildly depending on the IRC network you're connecting to,
331 # so check before setting this value. Some modes may not work as intended
332 # through the bridge e.g. caller ID as there is no way to /ACCEPT.
333 # Default: "" (no user modes)
334 # userModes: "R"
335
336 # Configuration for an ident server. If you are running a public bridge it is
337 # advised you setup an ident server so IRC mods can ban specific matrix users
338 # rather than the application service itself.
339 ident:
340 # True to listen for Ident requests and respond with the
341 # matrix user's user_id (converted to ASCII, respecting RFC 1413).
342 # Default: false.
343 enabled: false
344 # The port to listen on for incoming ident requests.
345 # Ports below 1024 require root to listen on, and you may not want this to
346 # run as root. Instead, you can get something like an Apache to yank up
347 # incoming requests to 113 to a high numbered port. Set the port to listen
348 # on instead of 113 here.
349 # Default: 113.
350 port: 1113
351 # The address to listen on for incoming ident requests.
352 # Default: 0.0.0.0
353 address: "::"
354
355 # Configuration for logging. Optional. Default: console debug level logging
356 # only.
357 logging:
358 # Level to log on console/logfile. One of error|warn|info|debug
359 level: "debug"
360 # The file location to log to. This is relative to the project directory.
361 logfile: "debug.log"
362 # The file location to log errors to. This is relative to the project
363 # directory.
364 errfile: "errors.log"
365 # Whether to log to the console or not.
366 toConsole: true
367 # The max number of files to keep. Files will be overwritten eventually due
368 # to rotations.
369 maxFiles: 5
370
371 # Optional. Enable Prometheus metrics. If this is enabled, you MUST install `prom-client`:
372 # $ npm install prom-client@6.3.0
373 # Metrics will then be available via GET /metrics on the bridge listening port (-p).
374 metrics:
375 # Whether to actually enable the metric endpoint. Default: false
376 enabled: true
377 # When collecting remote user active times, which "buckets" should be used. Defaults are given below.
378 # The bucket name is formed of a duration and a period. (h=hours,d=days,w=weeks).
379 remoteUserAgeBuckets:
380 - "1h"
381 - "1d"
382 - "1w"
383
384 # The nedb database URI to connect to. This is the name of the directory to
385 # dump .db files to. This is relative to the project directory.
386 # Required.
387 databaseUri: "nedb://data"
388
389 # Configuration options for the debug HTTP API. To access this API, you must
390 # append ?access_token=$APPSERVICE_TOKEN (from the registration file) to the requests.
391 #
392 # The debug API exposes the following endpoints:
393 #
394 # GET /irc/$domain/user/$user_id => Return internal state for the IRC client for this user ID.
395 #
396 # POST /irc/$domain/user/$user_id => Issue a raw IRC command down this connection.
397 # Format: new line delimited commands as per IRC protocol.
398 #
399 debugApi:
400 # True to enable the HTTP API endpoint. Default: false.
401 enabled: false
402 # The port to host the HTTP API.
403 port: 11100
404
405 # Configuration for the provisioning API.
406 #
407 # GET /_matrix/provision/link
408 # GET /_matrix/provision/unlink
409 # GET /_matrix/provision/listlinks
410 #
411 provisioning:
412 # True to enable the provisioning HTTP endpoint. Default: false.
413 enabled: true
414 # The number of seconds to wait before giving up on getting a response from
415 # an IRC channel operator. If the channel operator does not respond within the
416 # allotted time period, the provisioning request will fail.
417 # Default: 300 seconds (5 mins)
418 requestTimeoutSeconds: 300
419
420 # WARNING: The bridge needs to send plaintext passwords to the IRC server, it cannot
421 # send a password hash. As a result, passwords (NOT hashes) are stored encrypted in
422 # the database.
423 #
424 # To generate a .pem file:
425 # $ openssl genpkey -out passkey.pem -outform PEM -algorithm RSA -pkeyopt rsa_keygen_bits:2048
426 #
427 # The path to the RSA PEM-formatted private key to use when encrypting IRC passwords
428 # for storage in the database. Passwords are stored by using the admin room command
429 # `!storepass server.name passw0rd. When a connection is made to IRC on behalf of
430 # the Matrix user, this password will be sent as the server password (PASS command).
431 #passwordEncryptionKeyPath: "passkey.pem"
432
433 # Config for Matrix -> IRC bridging
434 matrixHandler:
435 # Cache this many matrix events in memory to be used for m.relates_to messages (usually replies).
436 eventCacheSize: 4096
437
438# Options here are generally only applicable to large-scale bridges and may have
439# consequences greater than other options in this configuration file.
440advanced:
441 # The maximum number of HTTP(S) sockets to maintain. Usually this is unlimited
442 # however for large bridges it is important to rate limit the bridge to avoid
443 # accidentally overloading the homeserver. Defaults to 1000, which should be
444 # enough for the vast majority of use cases.
445 maxHttpSockets: 1000