| @@ -8,23 +8,15 @@ Use the following playbook configuration: | |||||
| ```yaml | ```yaml | ||||
| matrix_mautrix_wsproxy_enabled: true | matrix_mautrix_wsproxy_enabled: true | ||||
| matrix_mautrix_wsproxy_appservice_token: 'random string' | |||||
| matrix_mautrix_wsproxy_homeserver_token: 'random string' | |||||
| matrix_mautrix_androidsms_appservice_token: 'random string' | |||||
| matrix_mautrix_androidsms_homeserver_token: 'random string' | |||||
| matrix_mautrix_imessage_appservice_token: 'random string' | |||||
| matrix_mautrix_imessage_homeserver_token: 'random string' | |||||
| matrix_mautrix_wsproxy_syncproxy_shared_secret: 'random string' | matrix_mautrix_wsproxy_syncproxy_shared_secret: 'random string' | ||||
| ``` | ``` | ||||
| ## Set up Double Puppeting | |||||
| If you'd like to use [Double Puppeting](https://github.com/tulir/mautrix-hangouts/wiki/Authentication#double-puppeting) (hint: you most likely do), you have 1 way of going about it. | |||||
| ### Method 1: automatically, by enabling Shared Secret Auth | |||||
| The bridge will automatically perform Double Puppeting if you enable [Shared Secret Auth](configuring-playbook-shared-secret-auth.md) for this playbook. | |||||
| This is the recommended way of setting up Double Puppeting, as it's easier to accomplish, works for all your users automatically, and has less of a chance of breaking in the future. | |||||
| Note that the tokens must match what is compiled into the `mautrix-imessage` bridge running on Mac and Android. | |||||
| ## Usage | ## Usage | ||||
| Follow the [matrix-imessage documenation](https://docs.mau.fi/bridges/go/imessage/index.html) for running `android-sms` or `matrix-imessage` on your device. | |||||
| The name of the bridge bot is androidsms, but the bridge works for either iMessage or Android SMS, though not both at the same time. | |||||
| Follow the [matrix-imessage documenation](https://docs.mau.fi/bridges/go/imessage/index.html) for running `android-sms` and/or `matrix-imessage` on your device(s). | |||||
| @@ -725,14 +725,6 @@ matrix_mautrix_wsproxy_homeserver_domain: '{{ matrix_domain }}' | |||||
| matrix_mautrix_wsproxy_homeserver_address: "{{ 'http://matrix-synapse:8008' if matrix_synapse_enabled else '' }}" | matrix_mautrix_wsproxy_homeserver_address: "{{ 'http://matrix-synapse:8008' if matrix_synapse_enabled else '' }}" | ||||
| matrix_mautrix_wsproxy_homeserver_token: "{{ matrix_homeserver_generic_secret_key | password_hash('sha512', 'wsproxy.hs.token') | to_uuid }}" | |||||
| matrix_mautrix_wsproxy_appservice_token: "{{ matrix_homeserver_generic_secret_key | password_hash('sha512', 'wsproxy.as.token') | to_uuid }}" | |||||
| matrix_mautrix_wsproxy_login_shared_secret: "{{ matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret if matrix_synapse_ext_password_provider_shared_secret_auth_enabled else '' }}" | |||||
| # Postgres is the default, except if not using `matrix_postgres` (internal postgres) | |||||
| ###################################################################### | ###################################################################### | ||||
| # | # | ||||
| # /matrix-bridge-mautrix-wsproxy | # /matrix-bridge-mautrix-wsproxy | ||||
| @@ -30,10 +30,14 @@ matrix_mautrix_wsproxy_systemd_required_services_list: ['docker.service'] | |||||
| # List of systemd services that matrix-mautrix-wsproxy.service wants | # List of systemd services that matrix-mautrix-wsproxy.service wants | ||||
| matrix_mautrix_wsproxy_systemd_wanted_services_list: [] | matrix_mautrix_wsproxy_systemd_wanted_services_list: [] | ||||
| matrix_mautrix_wsproxy_appservice_token: '' | |||||
| matrix_mautrix_wsproxy_homeserver_token: '' | |||||
| matrix_mautrix_androidsms_appservice_token: '' | |||||
| matrix_mautrix_androidsms_homeserver_token: '' | |||||
| matrix_mautrix_wsproxy_appservice_bot_username: androidsmsbot | |||||
| matrix_mautrix_imessage_appservice_token: '' | |||||
| matrix_mautrix_imessage_homeserver_token: '' | |||||
| matrix_mautrix_androidsms_appservice_bot_username: androidsmsbot | |||||
| matrix_mautrix_imessage_appservice_bot_username: imessagebot | |||||
| # Default mautrix-wsproxy configuration template which covers the generic use case. | # Default mautrix-wsproxy configuration template which covers the generic use case. | ||||
| # You can customize it by controlling the various variables inside it. | # You can customize it by controlling the various variables inside it. | ||||
| @@ -57,21 +61,37 @@ matrix_mautrix_wsproxy_configuration_extension: "{{ matrix_mautrix_wsproxy_confi | |||||
| # You most likely don't need to touch this variable. Instead, see `matrix_mautrix_wsproxy_configuration_yaml`. | # You most likely don't need to touch this variable. Instead, see `matrix_mautrix_wsproxy_configuration_yaml`. | ||||
| matrix_mautrix_wsproxy_configuration: "{{ matrix_mautrix_wsproxy_configuration_yaml|from_yaml|combine(matrix_mautrix_wsproxy_configuration_extension, recursive=True) }}" | matrix_mautrix_wsproxy_configuration: "{{ matrix_mautrix_wsproxy_configuration_yaml|from_yaml|combine(matrix_mautrix_wsproxy_configuration_extension, recursive=True) }}" | ||||
| matrix_mautrix_wsproxy_registration_yaml: | | |||||
| matrix_mautrix_androidsms_registration_yaml: | | |||||
| id: androidsms | id: androidsms | ||||
| url: {{ matrix_mautrix_wsproxy_appservice_address }} | url: {{ matrix_mautrix_wsproxy_appservice_address }} | ||||
| as_token: "{{ matrix_mautrix_wsproxy_appservice_token }}" | |||||
| hs_token: "{{ matrix_mautrix_wsproxy_homeserver_token }}" | |||||
| sender_localpart: _bot_{{ matrix_mautrix_wsproxy_appservice_bot_username }} | |||||
| as_token: "{{ matrix_mautrix_androidsms_appservice_token }}" | |||||
| hs_token: "{{ matrix_mautrix_androidsms_homeserver_token }}" | |||||
| sender_localpart: _bot_{{ matrix_mautrix_androidsms_appservice_bot_username }} | |||||
| rate_limited: false | rate_limited: false | ||||
| namespaces: | namespaces: | ||||
| users: | users: | ||||
| - regex: '@androidsms_.+:{{ matrix_mautrix_wsproxy_homeserver_domain|regex_escape }}$' | - regex: '@androidsms_.+:{{ matrix_mautrix_wsproxy_homeserver_domain|regex_escape }}$' | ||||
| exclusive: true | exclusive: true | ||||
| - exclusive: true | - exclusive: true | ||||
| regex: '^@{{ matrix_mautrix_wsproxy_appservice_bot_username|regex_escape }}:{{ matrix_mautrix_wsproxy_homeserver_domain|regex_escape }}$' | |||||
| regex: '^@{{ matrix_mautrix_androidsms_appservice_bot_username|regex_escape }}:{{ matrix_mautrix_wsproxy_homeserver_domain|regex_escape }}$' | |||||
| matrix_mautrix_androidsms_registration: "{{ matrix_mautrix_androidsms_registration_yaml|from_yaml }}" | |||||
| matrix_mautrix_imessage_registration_yaml: | | |||||
| id: imessage | |||||
| url: {{ matrix_mautrix_wsproxy_appservice_address }} | |||||
| as_token: "{{ matrix_mautrix_imessage_appservice_token }}" | |||||
| hs_token: "{{ matrix_mautrix_imessage_homeserver_token }}" | |||||
| sender_localpart: _bot_{{ matrix_mautrix_imessage_appservice_bot_username }} | |||||
| rate_limited: false | |||||
| namespaces: | |||||
| users: | |||||
| - regex: '@imessage_.+:{{ matrix_mautrix_wsproxy_homeserver_domain|regex_escape }}$' | |||||
| exclusive: true | |||||
| - exclusive: true | |||||
| regex: '^@{{ matrix_mautrix_imessage_appservice_bot_username|regex_escape }}:{{ matrix_mautrix_wsproxy_homeserver_domain|regex_escape }}$' | |||||
| matrix_mautrix_wsproxy_registration: "{{ matrix_mautrix_wsproxy_registration_yaml|from_yaml }}" | |||||
| matrix_mautrix_imessage_registration: "{{ matrix_mautrix_imessage_registration_yaml|from_yaml }}" | |||||
| # Syncproxy-related configuration fields | # Syncproxy-related configuration fields | ||||
| matrix_mautrix_wsproxy_syncproxy_version: latest | matrix_mautrix_wsproxy_syncproxy_version: latest | ||||
| @@ -9,14 +9,18 @@ | |||||
| {{ | {{ | ||||
| matrix_synapse_container_extra_arguments | default([]) | matrix_synapse_container_extra_arguments | default([]) | ||||
| + | + | ||||
| ["--mount type=bind,src={{ matrix_mautrix_wsproxy_config_path }}/registration.yaml,dst=/matrix-mautrix-wsproxy-registration.yaml,ro"] | |||||
| ["--mount type=bind,src={{ matrix_mautrix_wsproxy_config_path }}/androidsms-registration.yaml,dst=/matrix-mautrix-androidsms-registration.yaml,ro"] | |||||
| + | |||||
| ["--mount type=bind,src={{ matrix_mautrix_wsproxy_config_path }}/imessage-registration.yaml,dst=/matrix-mautrix-imessage-registration.yaml,ro"] | |||||
| }} | }} | ||||
| matrix_synapse_app_service_config_files: > | matrix_synapse_app_service_config_files: > | ||||
| {{ | {{ | ||||
| matrix_synapse_app_service_config_files | default([]) | matrix_synapse_app_service_config_files | default([]) | ||||
| + | + | ||||
| ["/matrix-mautrix-wsproxy-registration.yaml"] | |||||
| ["/matrix-mautrix-androidsms-registration.yaml"] | |||||
| + | |||||
| ["/matrix-mautrix-imessage-registration.yaml"] | |||||
| }} | }} | ||||
| when: matrix_mautrix_wsproxy_enabled|bool | when: matrix_mautrix_wsproxy_enabled|bool | ||||
| @@ -53,10 +53,18 @@ | |||||
| owner: "{{ matrix_user_username }}" | owner: "{{ matrix_user_username }}" | ||||
| group: "{{ matrix_user_groupname }}" | group: "{{ matrix_user_groupname }}" | ||||
| - name: Ensure mautrix-wsproxy registration.yaml installed | |||||
| - name: Ensure mautrix-androidsms registration.yaml installed | |||||
| ansible.builtin.copy: | ansible.builtin.copy: | ||||
| content: "{{ matrix_mautrix_wsproxy_registration|to_nice_yaml }}" | |||||
| dest: "{{ matrix_mautrix_wsproxy_config_path }}/registration.yaml" | |||||
| content: "{{ matrix_mautrix_androidsms_registration|to_nice_yaml }}" | |||||
| dest: "{{ matrix_mautrix_wsproxy_config_path }}/androidsms-registration.yaml" | |||||
| mode: 0644 | |||||
| owner: "{{ matrix_user_username }}" | |||||
| group: "{{ matrix_user_groupname }}" | |||||
| - name: Ensure mautrix-imessage registration.yaml installed | |||||
| ansible.builtin.copy: | |||||
| content: "{{ matrix_mautrix_imessage_registration|to_nice_yaml }}" | |||||
| dest: "{{ matrix_mautrix_wsproxy_config_path }}/imessage-registration.yaml" | |||||
| mode: 0644 | mode: 0644 | ||||
| owner: "{{ matrix_user_username }}" | owner: "{{ matrix_user_username }}" | ||||
| group: "{{ matrix_user_groupname }}" | group: "{{ matrix_user_groupname }}" | ||||
| @@ -6,6 +6,8 @@ | |||||
| You need to define a required configuration setting (`{{ item }}`). | You need to define a required configuration setting (`{{ item }}`). | ||||
| when: "vars[item] == ''" | when: "vars[item] == ''" | ||||
| with_items: | with_items: | ||||
| - "matrix_mautrix_wsproxy_appservice_token" | |||||
| - "matrix_mautrix_wsproxy_homeserver_token" | |||||
| - "matrix_mautrix_androidsms_appservice_token" | |||||
| - "matrix_mautrix_androidsms_homeserver_token" | |||||
| - "matrix_mautrix_imessage_appservice_token" | |||||
| - "matrix_mautrix_imessage_homeserver_token" | |||||
| - "matrix_mautrix_wsproxy_syncproxy_shared_secret" | - "matrix_mautrix_wsproxy_syncproxy_shared_secret" | ||||
| @@ -1,11 +1,14 @@ | |||||
| listen_address: 0.0.0.0:29331 | listen_address: 0.0.0.0:29331 | ||||
| appservices: | appservices: | ||||
| - id: androidsms | - id: androidsms | ||||
| as: "{{ matrix_mautrix_wsproxy_appservice_token }}" | |||||
| hs: "{{ matrix_mautrix_wsproxy_homeserver_token }}" | |||||
| as: {{ matrix_mautrix_androidsms_appservice_token | to_json }} | |||||
| hs: {{ matrix_mautrix_androidsms_homeserver_token | to_json }} | |||||
| - id: imessage | |||||
| as: {{ matrix_mautrix_imessage_appservice_token | to_json }} | |||||
| hs: {{ matrix_mautrix_imessage_homeserver_token | to_json }} | |||||
| sync_proxy: | sync_proxy: | ||||
| # The URL that mautrix-wsproxy can use to reach mautrix-syncproxy | # The URL that mautrix-wsproxy can use to reach mautrix-syncproxy | ||||
| url: "{{ matrix_mautrix_wsproxy_syncproxy_appservice_address }}" | |||||
| url: {{ matrix_mautrix_wsproxy_syncproxy_appservice_address | to_json }} | |||||
| # The URL that mautrix-syncproxy can use to reach mautrix-wsproxy | # The URL that mautrix-syncproxy can use to reach mautrix-wsproxy | ||||
| wsproxy_url: "{{ matrix_mautrix_wsproxy_appservice_address }}" | |||||
| shared_secret: "{{ matrix_mautrix_wsproxy_syncproxy_shared_secret }}" | |||||
| wsproxy_url: {{ matrix_mautrix_wsproxy_appservice_address | to_json }} | |||||
| shared_secret: {{ matrix_mautrix_wsproxy_syncproxy_shared_secret | to_json }} | |||||