From b5af98525a0ecab1b8a74c41f231b6b69aa0621e Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Fri, 19 Jan 2024 16:34:23 +0100 Subject: [PATCH] Implemented top domain as matrix username --- group_vars/all | 3 ++- roles/docker-matrix-compose/tasks/main.yml | 3 +-- .../templates/docker-compose.yml.j2 | 2 +- .../templates/mautrix/signal.config.yml.j2 | 2 +- .../templates/mautrix/slack.config.yml.j2 | 10 +++++----- .../templates/mautrix/telegram.config.yml.j2 | 14 +++++++------- .../templates/mautrix/whatsapp.config.yml.j2 | 10 +++++----- .../templates/synapse/homeserver.yaml.j2 | 4 ++-- 8 files changed, 24 insertions(+), 24 deletions(-) diff --git a/group_vars/all b/group_vars/all index fae2f1b5..5c5cb4ef 100644 --- a/group_vars/all +++ b/group_vars/all @@ -170,9 +170,10 @@ version_mastodon: "latest" mastodon_single_user_mode: false #### Matrix +matrix_admin_name: "admin" # Accountname of the matrix admin matrix_playbook_tags: "setup-all,start" # For the initial update use: install-all,ensure-matrix-users-created,start matrix_role: "compose" # Role to setup Matrix. Valid values: ansible, compose -matrix_admin_name: "admin" +matrix_server_name: "{{top_domain}}" # Adress for the account names etc. #### Mailu version_mailu: "2.0" diff --git a/roles/docker-matrix-compose/tasks/main.yml b/roles/docker-matrix-compose/tasks/main.yml index 38382fca..63786bdb 100644 --- a/roles/docker-matrix-compose/tasks/main.yml +++ b/roles/docker-matrix-compose/tasks/main.yml @@ -50,7 +50,7 @@ - name: "cleanup project folder" file: - path: "{{docker_compose_instance_directory}}" + path: "{{docker_compose_instance_directory}}mautrix/" state: absent - name: "create bridge folders" @@ -64,7 +64,6 @@ template: src: "mautrix/{{item.bridge_name}}.config.yml.j2" dest: "{{docker_compose_instance_directory}}mautrix/{{item.bridge_name}}/config.yaml" - notify: docker compose project setup loop: "{{ bridges }}" notify: docker compose project setup diff --git a/roles/docker-matrix-compose/templates/docker-compose.yml.j2 b/roles/docker-matrix-compose/templates/docker-compose.yml.j2 index 5cc36ed0..2c454373 100644 --- a/roles/docker-matrix-compose/templates/docker-compose.yml.j2 +++ b/roles/docker-matrix-compose/templates/docker-compose.yml.j2 @@ -45,7 +45,7 @@ services: ports: - "127.0.0.1:{{element_http_port}}:80" healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:80/"] + test: ["CMD", "wget", "--spider", "-q", "http://localhost:80/"] interval: 1m timeout: 10s retries: 3 diff --git a/roles/docker-matrix-compose/templates/mautrix/signal.config.yml.j2 b/roles/docker-matrix-compose/templates/mautrix/signal.config.yml.j2 index 293c9caa..a9d5f091 100644 --- a/roles/docker-matrix-compose/templates/mautrix/signal.config.yml.j2 +++ b/roles/docker-matrix-compose/templates/mautrix/signal.config.yml.j2 @@ -3,7 +3,7 @@ homeserver: # The address that this appservice can use to connect to the homeserver. address: http://synapse:8008 # The domain of the homeserver (also known as server_name, used for MXIDs, etc). - domain: {{synapse_domain}} + domain: {{matrix_server_name}} # What software is the homeserver running? # Standard Matrix homeservers like Synapse, Dendrite and Conduit should just use "standard" here. diff --git a/roles/docker-matrix-compose/templates/mautrix/slack.config.yml.j2 b/roles/docker-matrix-compose/templates/mautrix/slack.config.yml.j2 index 9e1a42db..6db1c15b 100644 --- a/roles/docker-matrix-compose/templates/mautrix/slack.config.yml.j2 +++ b/roles/docker-matrix-compose/templates/mautrix/slack.config.yml.j2 @@ -3,7 +3,7 @@ homeserver: # The address that this appservice can use to connect to the homeserver. address: http://synapse:8008 # The domain of the homeserver (also known as server_name, used for MXIDs, etc). - domain: {{synapse_domain}} + domain: {{matrix_server_name}} # What software is the homeserver running? # Standard Matrix homeservers like Synapse, Dendrite and Conduit should just use "standard" here. @@ -118,7 +118,7 @@ bridge: # Servers to always allow double puppeting from double_puppet_server_map: - {{synapse_domain}}: https://{{synapse_domain}} + {{matrix_server_name}}: https://{{matrix_server_name}} # Allow using double puppeting from any server with a valid client .well-known file. double_puppet_allow_discovery: false # Shared secrets for https://github.com/devture/matrix-synapse-shared-secret-auth @@ -127,7 +127,7 @@ bridge: # instead of users having to find an access token and run `login-matrix` # manually. login_shared_secret_map: - {{synapse_domain}}: foobar + {{matrix_server_name}}: foobar message_handling_timeout: # Send an error message after this timeout, but keep waiting for the response until the deadline. @@ -278,8 +278,8 @@ bridge: # mxid - Specific user permissions: "*": relay - "{{synapse_domain}}": user - "@{{matrix_admin_name}}:{{synapse_domain}}": admin + "{{matrix_server_name}}": user + "@{{matrix_admin_name}}:{{matrix_server_name}}": admin # Logging config. See https://github.com/tulir/zeroconfig for details. logging: diff --git a/roles/docker-matrix-compose/templates/mautrix/telegram.config.yml.j2 b/roles/docker-matrix-compose/templates/mautrix/telegram.config.yml.j2 index eb484ab8..e6f34b68 100644 --- a/roles/docker-matrix-compose/templates/mautrix/telegram.config.yml.j2 +++ b/roles/docker-matrix-compose/templates/mautrix/telegram.config.yml.j2 @@ -3,7 +3,7 @@ homeserver: # The address that this appservice can use to connect to the homeserver. address: http://synapse:8008 # The domain of the homeserver (for MXIDs, etc). - domain: {{synapse_domain}} + domain: {{matrix_server_name}} # Whether or not to verify the SSL certificate of the homeserver. # Only applies if address starts with https:// verify_ssl: true @@ -62,7 +62,7 @@ appservice: prefix: /public # The base URL where the public-facing endpoints are available. The prefix is not added # implicitly. - external: https://{{synapse_domain}}/public + external: https://{{matrix_server_name}}/public # Provisioning API part of the web server for automated portal creation and fetching information. # Used by things like mautrix-manager (https://github.com/tulir/mautrix-manager). @@ -198,7 +198,7 @@ bridge: sync_direct_chat_list: false # Servers to always allow double puppeting from double_puppet_server_map: - {{synapse_domain}}: https://{{synapse_domain}} + {{matrix_server_name}}: https://{{matrix_server_name}} # Allow using double puppeting from any server with a valid client .well-known file. double_puppet_allow_discovery: false # Shared secrets for https://github.com/devture/matrix-synapse-shared-secret-auth @@ -209,7 +209,7 @@ bridge: # If using this for other servers than the bridge's server, # you must also set the URL in the double_puppet_server_map. login_shared_secret_map: - {{synapse_domain}}: foobar + {{matrix_server_name}}: foobar # Set to false to disable link previews in messages sent to Telegram. telegram_link_preview: true # Whether or not the !tg join command should do a HTTP request @@ -530,9 +530,9 @@ bridge: # mxid - Specific user permissions: "*": "relaybot" - "public.{{synapse_domain}}": "user" - "{{synapse_domain}}": "full" - "@{{matrix_admin_name}}:{{synapse_domain}}": "admin" + "public.{{matrix_server_name}}": "user" + "{{matrix_server_name}}": "full" + "@{{matrix_admin_name}}:{{matrix_server_name}}": "admin" # Options related to the message relay Telegram bot. relaybot: diff --git a/roles/docker-matrix-compose/templates/mautrix/whatsapp.config.yml.j2 b/roles/docker-matrix-compose/templates/mautrix/whatsapp.config.yml.j2 index 234ffe32..8d2dfba5 100644 --- a/roles/docker-matrix-compose/templates/mautrix/whatsapp.config.yml.j2 +++ b/roles/docker-matrix-compose/templates/mautrix/whatsapp.config.yml.j2 @@ -3,7 +3,7 @@ homeserver: # The address that this appservice can use to connect to the homeserver. address: http://synapse:8008 # The domain of the homeserver (also known as server_name, used for MXIDs, etc). - domain: {{synapse_domain}} + domain: {{matrix_server_name}} # What software is the homeserver running? # Standard Matrix homeservers like Synapse, Dendrite and Conduit should just use "standard" here. @@ -236,7 +236,7 @@ bridge: force_active_delivery_receipts: false # Servers to always allow double puppeting from double_puppet_server_map: - {{synapse_domain}}: https://{{synapse_domain}} + {{matrix_server_name}}: https://{{matrix_server_name}} # Allow using double puppeting from any server with a valid client .well-known file. double_puppet_allow_discovery: false # Shared secrets for https://github.com/devture/matrix-synapse-shared-secret-auth @@ -245,7 +245,7 @@ bridge: # instead of users having to find an access token and run `login-matrix` # manually. login_shared_secret_map: - {{synapse_domain}}: foobar + {{matrix_server_name}}: foobar # Whether to explicitly set the avatar and room name for private chat portal rooms. # If set to `default`, this will be enabled in encrypted rooms and disabled in unencrypted rooms. # If set to `always`, all DM rooms will have explicit names and avatars set. @@ -434,8 +434,8 @@ bridge: # mxid - Specific user permissions: "*": relay - "{{synapse_domain}}": user - "@{{matrix_admin_name}}:{{synapse_domain}}": admin + "{{matrix_server_name}}": user + "@{{matrix_admin_name}}:{{matrix_server_name}}": admin # Settings for relay mode relay: diff --git a/roles/docker-matrix-compose/templates/synapse/homeserver.yaml.j2 b/roles/docker-matrix-compose/templates/synapse/homeserver.yaml.j2 index e923652c..f8573631 100644 --- a/roles/docker-matrix-compose/templates/synapse/homeserver.yaml.j2 +++ b/roles/docker-matrix-compose/templates/synapse/homeserver.yaml.j2 @@ -1,4 +1,4 @@ -server_name: "{{top_domain}}" +server_name: "{{matrix_server_name}}" pid_file: /data/homeserver.pid listeners: - port: 8008 @@ -39,7 +39,7 @@ email: #require_transport_security: true enable_tls: "{{ system_email_tls | upper }}" notif_from: "Your Friendly %(app)s homeserver <{{system_email}}>" - app_name: "Matrix on {{top_domain}}" + app_name: "Matrix on {{synapse_domain}}" enable_notifs: true notif_for_new_users: false client_base_url: "{{domain_matrix_synapse}}"