Raw YAML - Releases: latest, v25.11

  1# Network-specific config options
  2network:
  3    
  4
  5# Config options that affect the central bridge module.
  6bridge:
  7    # The prefix for commands. Only required in non-management rooms.
  8    command_prefix: '!zulip'
  9    # Should the bridge create a space for each login containing the rooms that account is in?
 10    personal_filtering_spaces: true
 11    # Whether the bridge should set names and avatars explicitly for DM portals.
 12    # This is only necessary when using clients that don't support MSC4171.
 13    private_chat_portal_meta: true
 14    # Should events be handled asynchronously within portal rooms?
 15    # If true, events may end up being out of order, but slow events won't block other ones.
 16    # This is not yet safe to use.
 17    async_events: false
 18    # Should every user have their own portals rather than sharing them?
 19    # By default, users who are in the same group on the remote network will be
 20    # in the same Matrix room bridged to that group. If this is set to true,
 21    # every user will get their own Matrix room instead.
 22    # SETTING THIS IS IRREVERSIBLE AND POTENTIALLY DESTRUCTIVE IF PORTALS ALREADY EXIST.
 23    split_portals: false
 24    # Should the bridge resend `m.bridge` events to all portals on startup?
 25    resend_bridge_info: false
 26    # Should `m.bridge` events be sent without a state key?
 27    # By default, the bridge uses a unique key that won't conflict with other bridges.
 28    no_bridge_info_state_key: false
 29    # Should bridge connection status be sent to the management room as `m.notice` events?
 30    # These contain the same data that can be posted to an external HTTP server using homeserver -> status_endpoint.
 31    # Allowed values: none, errors, all
 32    bridge_status_notices: errors
 33    # How long after an unknown error should the bridge attempt a full reconnect?
 34    # Must be at least 1 minute. The bridge will add an extra ±20% jitter to this value.
 35    unknown_error_auto_reconnect: null
 36    # Maximum number of times to do the auto-reconnect above.
 37    # The counter is per login, but is never reset except on logout and restart.
 38    unknown_error_max_auto_reconnects: 10
 39
 40    # Should leaving Matrix rooms be bridged as leaving groups on the remote network?
 41    bridge_matrix_leave: false
 42    # Should `m.notice` messages be bridged?
 43    bridge_notices: false
 44    # Should room tags only be synced when creating the portal? Tags mean things like favorite/pin and archive/low priority.
 45    # Tags currently can't be synced back to the remote network, so a continuous sync means tagging from Matrix will be undone.
 46    tag_only_on_create: true
 47    # List of tags to allow bridging. If empty, no tags will be bridged.
 48    only_bridge_tags: [m.favourite, m.lowpriority]
 49    # Should room mute status only be synced when creating the portal?
 50    # Like tags, mutes can't currently be synced back to the remote network.
 51    mute_only_on_create: true
 52    # Should the bridge check the db to ensure that incoming events haven't been handled before
 53    deduplicate_matrix_messages: false
 54    # Should cross-room reply metadata be bridged?
 55    # Most Matrix clients don't support this and servers may reject such messages too.
 56    cross_room_replies: false
 57    # If a state event fails to bridge, should the bridge revert any state changes made by that event?
 58    revert_failed_state_changes: false
 59    # In portals with no relay set, should Matrix users be kicked if they're
 60    # not logged into an account that's in the remote chat?
 61    kick_matrix_users: true
 62
 63    # What should be done to portal rooms when a user logs out or is logged out?
 64    # Permitted values:
 65    #   nothing - Do nothing, let the user stay in the portals
 66    #   kick - Remove the user from the portal rooms, but don't delete them
 67    #   unbridge - Remove all ghosts in the room and disassociate it from the remote chat
 68    #   delete - Remove all ghosts and users from the room (i.e. delete it)
 69    cleanup_on_logout:
 70        # Should cleanup on logout be enabled at all?
 71        enabled: false
 72        # Settings for manual logouts (explicitly initiated by the Matrix user)
 73        manual:
 74            # Action for private portals which will never be shared with other Matrix users.
 75            private: nothing
 76            # Action for portals with a relay user configured.
 77            relayed: nothing
 78            # Action for portals which may be shared, but don't currently have any other Matrix users.
 79            shared_no_users: nothing
 80            # Action for portals which have other logged-in Matrix users.
 81            shared_has_users: nothing
 82        # Settings for credentials being invalidated (initiated by the remote network, possibly through user action).
 83        # Keys have the same meanings as in the manual section.
 84        bad_credentials:
 85            private: nothing
 86            relayed: nothing
 87            shared_no_users: nothing
 88            shared_has_users: nothing
 89
 90    # Settings for relay mode
 91    relay:
 92        # Whether relay mode should be allowed. If allowed, the set-relay command can be used to turn any
 93        # authenticated user into a relaybot for that chat.
 94        enabled: false
 95        # Should only admins be allowed to set themselves as relay users?
 96        # If true, non-admins can only set users listed in default_relays as relays in a room.
 97        admin_only: true
 98        # List of user login IDs which anyone can set as a relay, as long as the relay user is in the room.
 99        default_relays: []
100        # The formats to use when sending messages via the relaybot.
101        # Available variables:
102        #   .Sender.UserID - The Matrix user ID of the sender.
103        #   .Sender.Displayname - The display name of the sender (if set).
104        #   .Sender.RequiresDisambiguation - Whether the sender's name may be confused with the name of another user in the room.
105        #   .Sender.DisambiguatedName - The disambiguated name of the sender. This will be the displayname if set,
106        #                               plus the user ID in parentheses if the displayname is not unique.
107        #                               If the displayname is not set, this is just the user ID.
108        #   .Message - The `formatted_body` field of the message.
109        #   .Caption - The `formatted_body` field of the message, if it's a caption. Otherwise an empty string.
110        #   .FileName - The name of the file being sent.
111        message_formats:
112            m.text: "<b>{{ .Sender.DisambiguatedName }}</b>: {{ .Message }}"
113            m.notice: "<b>{{ .Sender.DisambiguatedName }}</b>: {{ .Message }}"
114            m.emote: "* <b>{{ .Sender.DisambiguatedName }}</b> {{ .Message }}"
115            m.file: "<b>{{ .Sender.DisambiguatedName }}</b> sent a file{{ if .Caption }}: {{ .Caption }}{{ end }}"
116            m.image: "<b>{{ .Sender.DisambiguatedName }}</b> sent an image{{ if .Caption }}: {{ .Caption }}{{ end }}"
117            m.audio: "<b>{{ .Sender.DisambiguatedName }}</b> sent an audio file{{ if .Caption }}: {{ .Caption }}{{ end }}"
118            m.video: "<b>{{ .Sender.DisambiguatedName }}</b> sent a video{{ if .Caption }}: {{ .Caption }}{{ end }}"
119            m.location: "<b>{{ .Sender.DisambiguatedName }}</b> sent a location{{ if .Caption }}: {{ .Caption }}{{ end }}"
120        # For networks that support per-message displaynames (i.e. Slack and Discord), the template for those names.
121        # This has all the Sender variables available under message_formats (but without the .Sender prefix).
122        # Note that you need to manually remove the displayname from message_formats above.
123        displayname_format: "{{ .DisambiguatedName }}"
124
125    # Permissions for using the bridge.
126    # Permitted values:
127    #    relay - Talk through the relaybot (if enabled), no access otherwise
128    # commands - Access to use commands in the bridge, but not login.
129    #     user - Access to use the bridge with puppeting.
130    #    admin - Full access, user level with some additional administration tools.
131    # Permitted keys:
132    #        * - All Matrix users
133    #   domain - All users on that homeserver
134    #     mxid - Specific user
135    permissions:
136        "*": relay
137        "example.com": user
138        "@admin:example.com": admin
139
140# Config for the bridge's database.
141database:
142    # The database type. "sqlite3-fk-wal" and "postgres" are supported.
143    type: postgres
144    # The database URI.
145    #   SQLite: A raw file path is supported, but `file:<path>?_txlock=immediate` is recommended.
146    #           https://github.com/mattn/go-sqlite3#connection-string
147    #   Postgres: Connection string. For example, postgres://user:password@host/database?sslmode=disable
148    #             To connect via Unix socket, use something like postgres:///dbname?host=/var/run/postgresql
149    uri: postgres://user:password@host/database?sslmode=disable
150    # Maximum number of connections.
151    max_open_conns: 5
152    max_idle_conns: 1
153    # Maximum connection idle time and lifetime before they're closed. Disabled if null.
154    # Parsed with https://pkg.go.dev/time#ParseDuration
155    max_conn_idle_time: null
156    max_conn_lifetime: null
157
158# Homeserver details.
159homeserver:
160    # The address that this appservice can use to connect to the homeserver.
161    # Local addresses without HTTPS are generally recommended when the bridge is running on the same machine,
162    # but https also works if they run on different machines.
163    address: http://example.localhost:8008
164    # The domain of the homeserver (also known as server_name, used for MXIDs, etc).
165    domain: example.com
166
167    # What software is the homeserver running?
168    # Standard Matrix homeservers like Synapse, Dendrite and Conduit should just use "standard" here.
169    software: standard
170    # The URL to push real-time bridge status to.
171    # If set, the bridge will make POST requests to this URL whenever a user's remote network connection state changes.
172    # The bridge will use the appservice as_token to authorize requests.
173    status_endpoint:
174    # Endpoint for reporting per-message status.
175    # If set, the bridge will make POST requests to this URL when processing a message from Matrix.
176    # It will make one request when receiving the message (step BRIDGE), one after decrypting if applicable
177    # (step DECRYPTED) and one after sending to the remote network (step REMOTE). Errors will also be reported.
178    # The bridge will use the appservice as_token to authorize requests.
179    message_send_checkpoint_endpoint:
180    # Does the homeserver support https://github.com/matrix-org/matrix-spec-proposals/pull/2246?
181    async_media: false
182
183    # Should the bridge use a websocket for connecting to the homeserver?
184    # The server side is currently not documented anywhere and is only implemented by mautrix-wsproxy,
185    # mautrix-asmux (deprecated), and hungryserv (proprietary).
186    websocket: false
187    # How often should the websocket be pinged? Pinging will be disabled if this is zero.
188    ping_interval_seconds: 0
189
190# Application service host/registration related details.
191# Changing these values requires regeneration of the registration (except when noted otherwise)
192appservice:
193    # The address that the homeserver can use to connect to this appservice.
194    # Like the homeserver address, a local non-https address is recommended when the bridge is on the same machine.
195    # If the bridge is elsewhere, you must secure the connection yourself (e.g. with https or wireguard)
196    # If you want to use https, you need to use a reverse proxy. The bridge does not have TLS support built in.
197    address: http://localhost:29342
198    # A public address that external services can use to reach this appservice.
199    # This is only needed for things like public media. A reverse proxy is generally necessary when using this field.
200    # This value doesn't affect the registration file.
201    public_address: https://bridge.example.com
202
203    # The hostname and port where this appservice should listen.
204    # For Docker, you generally have to change the hostname to 0.0.0.0.
205    hostname: 127.0.0.1
206    port: 29342
207
208    # The unique ID of this appservice.
209    id: zulip
210    # Appservice bot details.
211    bot:
212        # Username of the appservice bot.
213        username: zulipbot
214        # Display name and avatar for bot. Set to "remove" to remove display name/avatar, leave empty
215        # to leave display name/avatar as-is.
216        displayname: Zulip bridge bot
217        avatar: mxc://maunium.net/pKfjZaIjOREmSJoyYgnmonJZ
218
219    # Whether to receive ephemeral events via appservice transactions.
220    ephemeral_events: true
221    # Should incoming events be handled asynchronously?
222    # This may be necessary for large public instances with lots of messages going through.
223    # However, messages will not be guaranteed to be bridged in the same order they were sent in.
224    # This value doesn't affect the registration file.
225    async_transactions: false
226
227    # Authentication tokens for AS <-> HS communication. Autogenerated; do not modify.
228    as_token: "This value is generated when generating the registration"
229    hs_token: "This value is generated when generating the registration"
230
231    # Localpart template of MXIDs for remote users.
232    # {{.}} is replaced with the internal ID of the user.
233    username_template: zulip_{{.}}
234
235# Config options that affect the Matrix connector of the bridge.
236matrix:
237    # Whether the bridge should send the message status as a custom com.beeper.message_send_status event.
238    message_status_events: false
239    # Whether the bridge should send a read receipt after successfully bridging a message.
240    delivery_receipts: false
241    # Whether the bridge should send error notices via m.notice events when a message fails to bridge.
242    message_error_notices: true
243    # Whether the bridge should update the m.direct account data event when double puppeting is enabled.
244    sync_direct_chat_list: true
245    # Whether created rooms should have federation enabled. If false, created portal rooms
246    # will never be federated. Changing this option requires recreating rooms.
247    federate_rooms: true
248    # The threshold as bytes after which the bridge should roundtrip uploads via the disk
249    # rather than keeping the whole file in memory.
250    upload_file_threshold: 5242880
251
252# Segment-compatible analytics endpoint for tracking some events, like provisioning API login and encryption errors.
253analytics:
254    # API key to send with tracking requests. Tracking is disabled if this is null.
255    token: null
256    # Address to send tracking requests to.
257    url: https://api.segment.io/v1/track
258    # Optional user ID for tracking events. If null, defaults to using Matrix user ID.
259    user_id: null
260
261# Settings for provisioning API
262provisioning:
263    # Shared secret for authentication. If set to "generate" or null, a random secret will be generated,
264    # or if set to "disable", the provisioning API will be disabled. Must be at least 16 characters.
265    shared_secret: generate
266    # Whether to allow provisioning API requests to be authed using Matrix access tokens.
267    # This follows the same rules as double puppeting to determine which server to contact to check the token,
268    # which means that by default, it only works for users on the same server as the bridge.
269    allow_matrix_auth: true
270    # Enable debug API at /debug with provisioning authentication.
271    debug_endpoints: false
272    # Enable session transfers between bridges. Note that this only validates Matrix or shared secret
273    # auth before passing live network client credentials down in the response.
274    enable_session_transfers: false
275
276# Some networks require publicly accessible media download links (e.g. for user avatars when using Discord webhooks).
277# These settings control whether the bridge will provide such public media access.
278public_media:
279    # Should public media be enabled at all?
280    # The public_address field under the appservice section MUST be set when enabling public media.
281    enabled: false
282    # A key for signing public media URLs.
283    # If set to "generate", a random key will be generated.
284    signing_key: generate
285    # Number of seconds that public media URLs are valid for.
286    # If set to 0, URLs will never expire.
287    expiry: 0
288    # Length of hash to use for public media URLs. Must be between 0 and 32.
289    hash_length: 32
290    # The path prefix for generated URLs. Note that this will NOT change the path where media is actually served.
291    # If you change this, you must configure your reverse proxy to rewrite the path accordingly.
292    path_prefix: /_mautrix/publicmedia
293    # Should the bridge store media metadata in the database in order to support encrypted media and generate shorter URLs?
294    # If false, the generated URLs will just have the MXC URI and a HMAC signature.
295    # The hash_length field will be used to decide the length of the generated URL.
296    # This also allows invalidating URLs by deleting the database entry.
297    use_database: false
298
299# Settings for converting remote media to custom mxc:// URIs instead of reuploading.
300# More details can be found at https://docs.mau.fi/bridges/go/discord/direct-media.html
301direct_media:
302    # Should custom mxc:// URIs be used instead of reuploading media?
303    enabled: false
304    # The server name to use for the custom mxc:// URIs.
305    # This server name will effectively be a real Matrix server, it just won't implement anything other than media.
306    # You must either set up .well-known delegation from this domain to the bridge, or proxy the domain directly to the bridge.
307    server_name: discord-media.example.com
308    # Optionally a custom .well-known response. This defaults to `server_name:443`
309    well_known_response:
310    # Optionally specify a custom prefix for the media ID part of the MXC URI.
311    media_id_prefix:
312    # If the remote network supports media downloads over HTTP, then the bridge will use MSC3860/MSC3916
313    # media download redirects if the requester supports it. Optionally, you can force redirects
314    # and not allow proxying at all by setting this to false.
315    # This option does nothing if the remote network does not support media downloads over HTTP.
316    allow_proxy: true
317    # Matrix server signing key to make the federation tester pass, same format as synapse's .signing.key file.
318    # This key is also used to sign the mxc:// URIs to ensure only the bridge can generate them.
319    server_key: generate
320
321# Settings for backfilling messages.
322# Note that the exact way settings are applied depends on the network connector.
323# See https://docs.mau.fi/bridges/general/backfill.html for more details.
324backfill:
325    # Whether to do backfilling at all.
326    enabled: false
327    # Maximum number of messages to backfill in empty rooms.
328    max_initial_messages: 50
329    # Maximum number of missed messages to backfill after bridge restarts.
330    max_catchup_messages: 500
331    # If a backfilled chat is older than this number of hours,
332    # mark it as read even if it's unread on the remote network.
333    unread_hours_threshold: 720
334    # Settings for backfilling threads within other backfills.
335    threads:
336        # Maximum number of messages to backfill in a new thread.
337        max_initial_messages: 50
338    # Settings for the backwards backfill queue. This only applies when connecting to
339    # Beeper as standard Matrix servers don't support inserting messages into history.
340    queue:
341        # Should the backfill queue be enabled?
342        enabled: false
343        # Number of messages to backfill in one batch.
344        batch_size: 100
345        # Delay between batches in seconds.
346        batch_delay: 20
347        # Maximum number of batches to backfill per portal.
348        # If set to -1, all available messages will be backfilled.
349        max_batches: -1
350        # Optional network-specific overrides for max batches.
351        # Interpretation of this field depends on the network connector.
352        max_batches_override: {}
353
354# Settings for enabling double puppeting
355double_puppet:
356    # Servers to always allow double puppeting from.
357    # This is only for other servers and should NOT contain the server the bridge is on.
358    servers:
359        anotherserver.example.org: https://matrix.anotherserver.example.org
360    # Whether to allow client API URL discovery for other servers. When using this option,
361    # users on other servers can use double puppeting even if their server URLs aren't
362    # explicitly added to the servers map above.
363    allow_discovery: false
364    # Shared secrets for automatic double puppeting.
365    # See https://docs.mau.fi/bridges/general/double-puppeting.html for instructions.
366    secrets:
367        example.com: as_token:foobar
368
369# End-to-bridge encryption support options.
370#
371# See https://docs.mau.fi/bridges/general/end-to-bridge-encryption.html for more info.
372encryption:
373    # Whether to enable encryption at all. If false, the bridge will not function in encrypted rooms.
374    allow: false
375    # Whether to force-enable encryption in all bridged rooms.
376    default: false
377    # Whether to require all messages to be encrypted and drop any unencrypted messages.
378    require: false
379    # Whether to use MSC3202/MSC4203 instead of /sync long polling for receiving encryption-related data.
380    # This option is not yet compatible with standard Matrix servers like Synapse and should not be used.
381    # Changing this option requires updating the appservice registration file.
382    appservice: false
383    # Whether to use MSC4190 instead of appservice login to create the bridge bot device.
384    # Requires the homeserver to support MSC4190 and the device masquerading parts of MSC3202.
385    # Only relevant when using end-to-bridge encryption, required when using encryption with next-gen auth (MSC3861).
386    # Changing this option requires updating the appservice registration file.
387    msc4190: false
388    # Whether to encrypt reactions and reply metadata as per MSC4392.
389    msc4392: false
390    # Should the bridge bot generate a recovery key and cross-signing keys and verify itself?
391    # Note that without the latest version of MSC4190, this will fail if you reset the bridge database.
392    # The generated recovery key will be saved in the kv_store table under `recovery_key`.
393    self_sign: false
394    # Enable key sharing? If enabled, key requests for rooms where users are in will be fulfilled.
395    # You must use a client that supports requesting keys from other users to use this feature.
396    allow_key_sharing: true
397    # Pickle key for encrypting encryption keys in the bridge database.
398    # If set to generate, a random key will be generated.
399    pickle_key: generate
400    # Options for deleting megolm sessions from the bridge.
401    delete_keys:
402        # Beeper-specific: delete outbound sessions when hungryserv confirms
403        # that the user has uploaded the key to key backup.
404        delete_outbound_on_ack: false
405        # Don't store outbound sessions in the inbound table.
406        dont_store_outbound: false
407        # Ratchet megolm sessions forward after decrypting messages.
408        ratchet_on_decrypt: false
409        # Delete fully used keys (index >= max_messages) after decrypting messages.
410        delete_fully_used_on_decrypt: false
411        # Delete previous megolm sessions from same device when receiving a new one.
412        delete_prev_on_new_session: false
413        # Delete megolm sessions received from a device when the device is deleted.
414        delete_on_device_delete: false
415        # Periodically delete megolm sessions when 2x max_age has passed since receiving the session.
416        periodically_delete_expired: false
417        # Delete inbound megolm sessions that don't have the received_at field used for
418        # automatic ratcheting and expired session deletion. This is meant as a migration
419        # to delete old keys prior to the bridge update.
420        delete_outdated_inbound: false
421    # What level of device verification should be required from users?
422    #
423    # Valid levels:
424    #   unverified - Send keys to all device in the room.
425    #   cross-signed-untrusted - Require valid cross-signing, but trust all cross-signing keys.
426    #   cross-signed-tofu - Require valid cross-signing, trust cross-signing keys on first use (and reject changes).
427    #   cross-signed-verified - Require valid cross-signing, plus a valid user signature from the bridge bot.
428    #                           Note that creating user signatures from the bridge bot is not currently possible.
429    #   verified - Require manual per-device verification
430    #              (currently only possible by modifying the `trust` column in the `crypto_device` database table).
431    verification_levels:
432        # Minimum level for which the bridge should send keys to when bridging messages from the remote network to Matrix.
433        receive: unverified
434        # Minimum level that the bridge should accept for incoming Matrix messages.
435        send: unverified
436        # Minimum level that the bridge should require for accepting key requests.
437        share: cross-signed-tofu
438    # Options for Megolm room key rotation. These options allow you to configure the m.room.encryption event content.
439    # See https://spec.matrix.org/v1.10/client-server-api/#mroomencryption for more information about that event.
440    rotation:
441        # Enable custom Megolm room key rotation settings. Note that these
442        # settings will only apply to rooms created after this option is set.
443        enable_custom: false
444        # The maximum number of milliseconds a session should be used
445        # before changing it. The Matrix spec recommends 604800000 (a week)
446        # as the default.
447        milliseconds: 604800000
448        # The maximum number of messages that should be sent with a given a
449        # session before changing it. The Matrix spec recommends 100 as the
450        # default.
451        messages: 100
452        # Disable rotating keys when a user's devices change?
453        # You should not enable this option unless you understand all the implications.
454        disable_device_change_key_rotation: false
455
456# Prefix for environment variables. All variables with this prefix must map to valid config fields.
457# Nesting in variable names is represented with a dot (.).
458# If there are no dots in the name, two underscores (__) are replaced with a dot.
459#
460# e.g. if the prefix is set to `BRIDGE_`, then `BRIDGE_APPSERVICE__AS_TOKEN` will set appservice.as_token.
461# `BRIDGE_appservice.as_token` would work as well, but can't be set in a shell as easily.
462#
463# If this is null, reading config fields from environment will be disabled.
464env_config_prefix: null
465
466# Logging config. See https://github.com/tulir/zeroconfig for details.
467logging:
468    min_level: debug
469    writers:
470        - type: stdout
471          format: pretty-colored
472        - type: file
473          format: json
474          filename: ./logs/bridge.log
475          max_size: 100
476          max_backups: 10
477          compress: false