Matrix Docker Ansible eploy
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 

485 líneas
24 KiB

  1. # mautrix-telegram is a Matrix <-> Telegram bridge
  2. # See: https://github.com/tulir/mautrix-telegram
  3. matrix_mautrix_telegram_enabled: true
  4. # See: https://mau.dev/tulir/mautrix-telegram/container_registry
  5. matrix_mautrix_telegram_docker_image: "dock.mau.dev/tulir/mautrix-telegram:v0.7.0"
  6. matrix_mautrix_telegram_docker_image_force_pull: "{{ matrix_mautrix_telegram_docker_image.endswith(':latest') }}"
  7. matrix_mautrix_telegram_base_path: "{{ matrix_base_data_path }}/mautrix-telegram"
  8. matrix_mautrix_telegram_config_path: "{{ matrix_mautrix_telegram_base_path }}/config"
  9. matrix_mautrix_telegram_data_path: "{{ matrix_mautrix_telegram_base_path }}/data"
  10. # Get your own API keys at https://my.telegram.org/apps
  11. matrix_mautrix_telegram_api_id: ''
  12. matrix_mautrix_telegram_api_hash: ''
  13. matrix_mautrix_telegram_bot_token: disabled
  14. # Mautrix telegram public endpoint to log in to telegram
  15. # Use an uuid so it's not easily discoverable.
  16. # Example: /741a0483-ba17-4682-9900-30bd7269f1cc
  17. matrix_mautrix_telegram_public_endpoint: ''
  18. matrix_mautrix_telegram_homeserver_address: 'http://matrix-synapse:8008'
  19. matrix_mautrix_telegram_homeserver_domain: '{{ matrix_domain }}'
  20. matrix_mautrix_telegram_appservice_address: 'http://matrix-mautrix-telegram:8080'
  21. matrix_mautrix_telegram_appservice_public_external: 'https://{{ matrix_server_fqn_matrix }}{{ matrix_mautrix_telegram_public_endpoint }}'
  22. # Controls whether the matrix-telegram container exposes its HTTP port (tcp/8080 in the container).
  23. #
  24. # Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:9006"), or empty string to not expose.
  25. matrix_mautrix_telegram_container_http_host_bind_port: ''
  26. # A list of extra arguments to pass to the container
  27. matrix_mautrix_telegram_container_extra_arguments: []
  28. # List of systemd services that matrix-mautrix-telegram.service depends on.
  29. matrix_mautrix_telegram_systemd_required_services_list: ['docker.service']
  30. # List of systemd services that matrix-mautrix-telegram.service wants
  31. matrix_mautrix_telegram_systemd_wanted_services_list: []
  32. matrix_mautrix_telegram_appservice_token: ''
  33. matrix_mautrix_telegram_homeserver_token: ''
  34. # Can be set to enable automatic double-puppeting via Shared Secret Auth (https://github.com/devture/matrix-synapse-shared-secret-auth).
  35. matrix_mautrix_telegram_login_shared_secret: ''
  36. # Default configuration template which covers the generic use case.
  37. # You can customize it by controlling the various variables inside it.
  38. #
  39. # For a more advanced customization, you can extend the default (see `matrix_mautrix_telegram_configuration_extension_yaml`)
  40. # or completely replace this variable with your own template.
  41. matrix_mautrix_telegram_configuration_yaml: |
  42. #jinja2: lstrip_blocks: "True"
  43. # Homeserver details
  44. homeserver:
  45. # The address that this appservice can use to connect to the homeserver.
  46. address: {{ matrix_mautrix_telegram_homeserver_address }}
  47. # The domain of the homeserver (for MXIDs, etc).
  48. domain: {{ matrix_mautrix_telegram_homeserver_domain }}
  49. # Whether or not to verify the SSL certificate of the homeserver.
  50. # Only applies if address starts with https://
  51. verify_ssl: true
  52. # Application service host/registration related details
  53. # Changing these values requires regeneration of the registration.
  54. appservice:
  55. # The address that the homeserver can use to connect to this appservice.
  56. address: {{ matrix_mautrix_telegram_appservice_address }}
  57. # The hostname and port where this appservice should listen.
  58. hostname: 0.0.0.0
  59. port: 8080
  60. # The maximum body size of appservice API requests (from the homeserver) in mebibytes
  61. # Usually 1 is enough, but on high-traffic bridges you might need to increase this to avoid 413s
  62. max_body_size: 1
  63. # The full URI to the database. SQLite and Postgres are fully supported.
  64. # Other DBMSes supported by SQLAlchemy may or may not work.
  65. # Format examples:
  66. # SQLite: sqlite:///filename.db
  67. # Postgres: postgres://username:password@hostname/dbname
  68. database: sqlite:////data/mautrix-telegram.db
  69. # Public part of web server for out-of-Matrix interaction with the bridge.
  70. # Used for things like login if the user wants to make sure the 2FA password isn't stored in
  71. # the HS database.
  72. public:
  73. # Whether or not the public-facing endpoints should be enabled.
  74. enabled: true
  75. # The prefix to use in the public-facing endpoints.
  76. prefix: {{ matrix_mautrix_telegram_public_endpoint }}
  77. # The base URL where the public-facing endpoints are available. The prefix is not added
  78. # implicitly.
  79. external: {{ matrix_mautrix_telegram_appservice_public_external }}
  80. # Provisioning API part of the web server for automated portal creation and fetching information.
  81. # Used by things like Dimension (https://dimension.t2bot.io/).
  82. provisioning:
  83. # Whether or not the provisioning API should be enabled.
  84. enabled: false
  85. # The prefix to use in the provisioning API endpoints.
  86. prefix: /_matrix/provision/v1
  87. # The shared secret to authorize users of the API.
  88. # Set to "generate" to generate and save a new token.
  89. shared_secret: generate
  90. # The unique ID of this appservice.
  91. id: telegram
  92. # Username of the appservice bot.
  93. bot_username: telegrambot
  94. # Display name and avatar for bot. Set to "remove" to remove display name/avatar, leave empty
  95. # to leave display name/avatar as-is.
  96. bot_displayname: Telegram bridge bot
  97. bot_avatar: mxc://maunium.net/tJCRmUyJDsgRNgqhOgoiHWbX
  98. # Authentication tokens for AS <-> HS communication.
  99. as_token: "{{ matrix_mautrix_telegram_appservice_token }}"
  100. hs_token: "{{ matrix_mautrix_telegram_homeserver_token }}"
  101. # Bridge config
  102. bridge:
  103. # Localpart template of MXIDs for Telegram users.
  104. # {userid} is replaced with the user ID of the Telegram user.
  105. username_template: "telegram_{userid}"
  106. # Localpart template of room aliases for Telegram portal rooms.
  107. # {groupname} is replaced with the name part of the public channel/group invite link ( https://t.me/{} )
  108. alias_template: "telegram_{groupname}"
  109. # Displayname template for Telegram users.
  110. # {displayname} is replaced with the display name of the Telegram user.
  111. displayname_template: "{displayname} (Telegram)"
  112. # Set the preferred order of user identifiers which to use in the Matrix puppet display name.
  113. # In the (hopefully unlikely) scenario that none of the given keys are found, the numeric user
  114. # ID is used.
  115. #
  116. # If the bridge is working properly, a phone number or an username should always be known, but
  117. # the other one can very well be empty.
  118. #
  119. # Valid keys:
  120. # "full name" (First and/or last name)
  121. # "full name reversed" (Last and/or first name)
  122. # "first name"
  123. # "last name"
  124. # "username"
  125. # "phone number"
  126. displayname_preference:
  127. - full name
  128. - username
  129. - phone number
  130. # Maximum length of displayname
  131. displayname_max_length: 100
  132. # Maximum number of members to sync per portal when starting up. Other members will be
  133. # synced when they send messages. The maximum is 10000, after which the Telegram server
  134. # will not send any more members.
  135. # Defaults to no local limit (-> limited to 10000 by server)
  136. max_initial_member_sync: -1
  137. # Whether or not to sync the member list in channels.
  138. # If no channel admins have logged into the bridge, the bridge won't be able to sync the member
  139. # list regardless of this setting.
  140. sync_channel_members: true
  141. # Whether or not to skip deleted members when syncing members.
  142. skip_deleted_members: true
  143. # Whether or not to automatically synchronize contacts and chats of Matrix users logged into
  144. # their Telegram account at startup.
  145. startup_sync: true
  146. # Number of most recently active dialogs to check when syncing chats.
  147. # Dialogs include groups and private chats, but only groups are synced.
  148. # Set to 0 to remove limit.
  149. sync_dialog_limit: 30
  150. # Whether or not to sync and create portals for direct chats at startup.
  151. sync_direct_chats: false
  152. # The maximum number of simultaneous Telegram deletions to handle.
  153. # A large number of simultaneous redactions could put strain on your homeserver.
  154. max_telegram_delete: 10
  155. # Whether or not to automatically sync the Matrix room state (mostly unpuppeted displaynames)
  156. # at startup and when creating a bridge.
  157. sync_matrix_state: true
  158. # Allow logging in within Matrix. If false, the only way to log in is using the out-of-Matrix
  159. # login website (see appservice.public config section)
  160. allow_matrix_login: true
  161. # Whether or not to bridge plaintext highlights.
  162. # Only enable this if your displayname_template has some static part that the bridge can use to
  163. # reliably identify what is a plaintext highlight.
  164. plaintext_highlights: false
  165. # Whether or not to make portals of publicly joinable channels/supergroups publicly joinable on Matrix.
  166. public_portals: true
  167. # Whether or not to use /sync to get presence, read receipts and typing notifications when using
  168. # your own Matrix account as the Matrix puppet for your Telegram account.
  169. sync_with_custom_puppets: true
  170. # Shared secret for https://github.com/devture/matrix-synapse-shared-secret-auth
  171. #
  172. # If set, custom puppets will be enabled automatically for local users
  173. # instead of users having to find an access token and run `login-matrix`
  174. # manually.
  175. login_shared_secret: {{ matrix_mautrix_telegram_login_shared_secret|to_json }}
  176. # Set to false to disable link previews in messages sent to Telegram.
  177. telegram_link_preview: true
  178. # Use inline images instead of a separate message for the caption.
  179. # N.B. Inline images are not supported on all clients (e.g. Riot iOS).
  180. inline_images: false
  181. # Maximum size of image in megabytes before sending to Telegram as a document.
  182. image_as_file_size: 10
  183. # Maximum size of Telegram documents in megabytes to bridge.
  184. max_document_size: 100
  185. # Enable experimental parallel file transfer, which makes uploads/downloads much faster by
  186. # streaming from/to Matrix and using many connections for Telegram.
  187. # Note that generating HQ thumbnails for videos is not possible with streamed transfers.
  188. parallel_file_transfer: false
  189. # Whether or not created rooms should have federation enabled.
  190. # If false, created portal rooms will never be federated.
  191. federate_rooms: true
  192. # Settings for converting animated stickers.
  193. animated_sticker:
  194. # Format to which animated stickers should be converted.
  195. # disable - No conversion, send as-is (gzipped lottie)
  196. # png - converts to non-animated png (fastest),
  197. # gif - converts to animated gif, but loses transparency
  198. # webm - converts to webm video, requires ffmpeg executable with vp9 codec and webm container support
  199. target: gif
  200. # Arguments for converter. All converters take width and height.
  201. # GIF converter takes background as a hex color.
  202. args:
  203. width: 256
  204. height: 256
  205. background: "020202" # only for gif
  206. fps: 30 # only for webm
  207. # End-to-bridge encryption support options. These require matrix-nio to be installed with pip
  208. # and login_shared_secret to be configured in order to get a device for the bridge bot.
  209. #
  210. # Additionally, https://github.com/matrix-org/synapse/pull/5758 is required if using a normal
  211. # application service.
  212. encryption:
  213. # Allow encryption, work in group chat rooms with e2ee enabled
  214. allow: false
  215. # Default to encryption, force-enable encryption in all portals the bridge creates
  216. # This will cause the bridge bot to be in private chats for the encryption to work properly.
  217. default: false
  218. # Overrides for base power levels.
  219. initial_power_level_overrides:
  220. user: {}
  221. group: {}
  222. # Whether to bridge Telegram bot messages as m.notices or m.texts.
  223. bot_messages_as_notices: true
  224. bridge_notices:
  225. # Whether or not Matrix bot messages (type m.notice) should be bridged.
  226. default: false
  227. # List of user IDs for whom the previous flag is flipped.
  228. # e.g. if bridge_notices.default is false, notices from other users will not be bridged, but
  229. # notices from users listed here will be bridged.
  230. exceptions: []
  231. # Some config options related to Telegram message deduplication.
  232. # The default values are usually fine, but some debug messages/warnings might recommend you
  233. # change these.
  234. deduplication:
  235. # Whether or not to check the database if the message about to be sent is a duplicate.
  236. pre_db_check: false
  237. # The number of latest events to keep when checking for duplicates.
  238. # You might need to increase this on high-traffic bridge instances.
  239. cache_queue_length: 20
  240. # The formats to use when sending messages to Telegram via the relay bot.
  241. #
  242. # Telegram doesn't have built-in emotes, so the m.emote format is also used for non-relaybot users.
  243. #
  244. # Available variables:
  245. # $sender_displayname - The display name of the sender (e.g. Example User)
  246. # $sender_username - The username (Matrix ID localpart) of the sender (e.g. exampleuser)
  247. # $sender_mxid - The Matrix ID of the sender (e.g. @exampleuser:example.com)
  248. # $message - The message content as HTML
  249. message_formats:
  250. m.text: "<b>$sender_displayname</b>: $message"
  251. m.notice: "<b>$sender_displayname</b>: $message"
  252. m.emote: "* <b>$sender_displayname</b> $message"
  253. m.file: "<b>$sender_displayname</b> sent a file: $message"
  254. m.image: "<b>$sender_displayname</b> sent an image: $message"
  255. m.audio: "<b>$sender_displayname</b> sent an audio file: $message"
  256. m.video: "<b>$sender_displayname</b> sent a video: $message"
  257. m.location: "<b>$sender_displayname</b> sent a location: $message"
  258. # Telegram doesn't have built-in emotes, this field specifies how m.emote's from authenticated
  259. # users are sent to telegram. All fields in message_formats are supported. Additionally, the
  260. # Telegram user info is available in the following variables:
  261. # $displayname - Telegram displayname
  262. # $username - Telegram username (may not exist)
  263. # $mention - Telegram @username or displayname mention (depending on which exists)
  264. emote_format: "* $mention $formatted_body"
  265. # The formats to use when sending state events to Telegram via the relay bot.
  266. #
  267. # Variables from `message_formats` that have the `sender_` prefix are available without the prefix.
  268. # In name_change events, `$prev_displayname` is the previous displayname.
  269. #
  270. # Set format to an empty string to disable the messages for that event.
  271. state_event_formats:
  272. join: "<b>$displayname</b> joined the room."
  273. leave: "<b>$displayname</b> left the room."
  274. name_change: "<b>$prev_displayname</b> changed their name to <b>$displayname</b>"
  275. # Filter rooms that can/can't be bridged. Can also be managed using the `filter` and
  276. # `filter-mode` management commands.
  277. #
  278. # Filters do not affect direct chats.
  279. # An empty blacklist will essentially disable the filter.
  280. filter:
  281. # Filter mode to use. Either "blacklist" or "whitelist".
  282. # If the mode is "blacklist", the listed chats will never be bridged.
  283. # If the mode is "whitelist", only the listed chats can be bridged.
  284. mode: blacklist
  285. # The list of group/channel IDs to filter.
  286. list: []
  287. # The prefix for commands. Only required in non-management rooms.
  288. command_prefix: "!tg"
  289. # Permissions for using the bridge.
  290. # Permitted values:
  291. # relaybot - Only use the bridge via the relaybot, no access to commands.
  292. # user - Relaybot level + access to commands to create bridges.
  293. # puppeting - User level + logging in with a Telegram account.
  294. # full - Full access to use the bridge, i.e. previous levels + Matrix login.
  295. # admin - Full access to use the bridge and some extra administration commands.
  296. # Permitted keys:
  297. # * - All Matrix users
  298. # domain - All users on that homeserver
  299. # mxid - Specific user
  300. permissions:
  301. '{{ matrix_mautrix_telegram_homeserver_domain }}': full
  302. # Options related to the message relay Telegram bot.
  303. relaybot:
  304. private_chat:
  305. # List of users to invite to the portal when someone starts a private chat with the bot.
  306. # If empty, private chats with the bot won't create a portal.
  307. invite: []
  308. # Whether or not to bridge state change messages in relaybot private chats.
  309. state_changes: true
  310. # When private_chat_invite is empty, this message is sent to users /starting the
  311. # relaybot. Telegram's "markdown" is supported.
  312. message: This is a Matrix bridge relaybot and does not support direct chats
  313. # List of users to invite to all group chat portals created by the bridge.
  314. group_chat_invite: []
  315. # Whether or not the relaybot should not bridge events in unbridged group chats.
  316. # If false, portals will be created when the relaybot receives messages, just like normal
  317. # users. This behavior is usually not desirable, as it interferes with manually bridging
  318. # the chat to another room.
  319. ignore_unbridged_group_chat: true
  320. # Whether or not to allow creating portals from Telegram.
  321. authless_portals: true
  322. # Whether or not to allow Telegram group admins to use the bot commands.
  323. whitelist_group_admins: true
  324. # Whether or not to ignore incoming events sent by the relay bot.
  325. ignore_own_incoming_events: true
  326. # List of usernames/user IDs who are also allowed to use the bot commands.
  327. whitelist: []
  328. # Telegram config
  329. telegram:
  330. # Get your own API keys at https://my.telegram.org/apps
  331. api_id: {{ matrix_mautrix_telegram_api_id }}
  332. api_hash: {{ matrix_mautrix_telegram_api_hash }}
  333. # (Optional) Create your own bot at https://t.me/BotFather
  334. bot_token: {{ matrix_mautrix_telegram_bot_token }}
  335. # Telethon connection options.
  336. connection:
  337. # The timeout in seconds to be used when connecting.
  338. timeout: 120
  339. # How many times the reconnection should retry, either on the initial connection or when
  340. # Telegram disconnects us. May be set to a negative or null value for infinite retries, but
  341. # this is not recommended, since the program can get stuck in an infinite loop.
  342. retries: 5
  343. # The delay in seconds to sleep between automatic reconnections.
  344. retry_delay: 1
  345. # The threshold below which the library should automatically sleep on flood wait errors
  346. # (inclusive). For instance, if a FloodWaitError for 17s occurs and flood_sleep_threshold
  347. # is 20s, the library will sleep automatically. If the error was for 21s, it would raise
  348. # the error instead. Values larger than a day (86400) will be changed to a day.
  349. flood_sleep_threshold: 60
  350. # How many times a request should be retried. Request are retried when Telegram is having
  351. # internal issues, when there is a FloodWaitError less than flood_sleep_threshold, or when
  352. # there's a migrate error. May take a negative or null value for infinite retries, but this
  353. # is not recommended, since some requests can always trigger a call fail (such as searching
  354. # for messages).
  355. request_retries: 5
  356. # Device info sent to Telegram.
  357. device_info:
  358. # "auto" = OS name+version.
  359. device_model: auto
  360. # "auto" = Telethon version.
  361. system_version: auto
  362. # "auto" = mautrix-telegram version.
  363. app_version: auto
  364. lang_code: en
  365. system_lang_code: en
  366. # Custom server to connect to.
  367. server:
  368. # Set to true to use these server settings. If false, will automatically
  369. # use production server assigned by Telegram. Set to false in production.
  370. enabled: false
  371. # The DC ID to connect to.
  372. dc: 2
  373. # The IP to connect to.
  374. ip: 149.154.167.40
  375. # The port to connect to. 443 may not work, 80 is better and both are equally secure.
  376. port: 80
  377. # Telethon proxy configuration.
  378. # You must install PySocks from pip for proxies to work.
  379. proxy:
  380. # Allowed types: disabled, socks4, socks5, http
  381. type: disabled
  382. # Proxy IP address and port.
  383. address: 127.0.0.1
  384. port: 1080
  385. # Whether or not to perform DNS resolving remotely.
  386. rdns: true
  387. # Proxy authentication (optional).
  388. username: ""
  389. password: ""
  390. # Python logging configuration.
  391. #
  392. # See section 16.7.2 of the Python documentation for more info:
  393. # https://docs.python.org/3.6/library/logging.config.html#configuration-dictionary-schema
  394. logging:
  395. version: 1
  396. formatters:
  397. precise:
  398. format: "[%(asctime)s] [%(levelname)s@%(name)s] %(message)s"
  399. handlers:
  400. console:
  401. class: logging.StreamHandler
  402. formatter: precise
  403. loggers:
  404. mau:
  405. level: DEBUG
  406. telethon:
  407. level: DEBUG
  408. aiohttp:
  409. level: INFO
  410. root:
  411. level: DEBUG
  412. handlers: [console]
  413. matrix_mautrix_telegram_configuration_extension_yaml: |
  414. # Your custom YAML configuration goes here.
  415. # This configuration extends the default starting configuration (`matrix_mautrix_telegram_configuration_yaml`).
  416. #
  417. # You can override individual variables from the default configuration, or introduce new ones.
  418. #
  419. # If you need something more special, you can take full control by
  420. # completely redefining `matrix_mautrix_telegram_configuration_yaml`.
  421. matrix_mautrix_telegram_configuration_extension: "{{ matrix_mautrix_telegram_configuration_extension_yaml|from_yaml if matrix_mautrix_telegram_configuration_extension_yaml|from_yaml is mapping else {} }}"
  422. # Holds the final configuration (a combination of the default and its extension).
  423. # You most likely don't need to touch this variable. Instead, see `matrix_mautrix_telegram_configuration_yaml`.
  424. matrix_mautrix_telegram_configuration: "{{ matrix_mautrix_telegram_configuration_yaml|from_yaml|combine(matrix_mautrix_telegram_configuration_extension, recursive=True) }}"
  425. matrix_mautrix_telegram_registration_yaml: |
  426. id: telegram
  427. as_token: "{{ matrix_mautrix_telegram_appservice_token }}"
  428. hs_token: "{{ matrix_mautrix_telegram_homeserver_token }}"
  429. namespaces:
  430. users:
  431. - exclusive: true
  432. regex: '^@telegram_.+:{{ matrix_mautrix_telegram_homeserver_domain|regex_escape }}$'
  433. aliases:
  434. - exclusive: true
  435. regex: '^#telegram_.+:{{ matrix_mautrix_telegram_homeserver_domain|regex_escape }}$'
  436. url: {{ matrix_mautrix_telegram_appservice_address }}
  437. sender_localpart: telegrambot
  438. rate_limited: false
  439. matrix_mautrix_telegram_registration: "{{ matrix_mautrix_telegram_registration_yaml|from_yaml }}"