kamax-matrix / mxisd

Federated Matrix Identity Server
GNU Affero General Public License v3.0
220 stars 112 forks source link

invite #161

Closed Unsourire closed 5 years ago

Unsourire commented 5 years ago

hello, i put the configuraion as described on the directory.md documentation.

i put the proxypass, in insert :

dns:
  overwrite:
    homeserver:
      client:
        - name: 'example.org'
          value: 'http://localhost:8008'

and i put the synapse indenties store.

but i got the error : An internal server error occured. If this error persists, please contact support with reference #1555514297474

Do you have any suggestion

Unsourire commented 5 years ago

I got the rror : No DNS client override for example.org my domain is in https but is trying to request in http, so the problem is may be with the https.

Unsourire commented 5 years ago

erro message

[XNIO-1 task-2] INFO io.kamax.mxisd.directory.DirectoryManager - Performing search for 'fdf'
[XNIO-1 task-2] INFO io.kamax.mxisd.directory.DirectoryManager - Original request URL: http://example.org/_matrix/client/r0/user_directory/search
[XNIO-1 task-2] ERROR io.kamax.mxisd.http.undertow.handler.SaneHandler - Reference #1555516611704 - No DNS client override for example.org
[XNIO-1 task-2] INFO io.kamax.mxisd.http.undertow.handler.BasicHttpHandler - Request POST http://example.org/_matrix/client/r0/user_directory/search - Error M_UNKNOWN: An internal server error occured. If this error persists, please contact support with reference #1555516611704
maxidorius commented 5 years ago

You are most likely missing the directive in your reverse proxy configuration to preserve the Host header. Be sure to read the Directory feature documentation in details, that info is given.

Unsourire commented 5 years ago

I checked and everything is well configured and now i got the following error:

[XNIO-1 task-2] INFO io.kamax.mxisd.directory.DirectoryManager - Performing search for 'jl'
[XNIO-1 task-2] INFO io.kamax.mxisd.directory.DirectoryManager - Original request URL: http://example.org/_matrix/client/r0/user_directory/search
[XNIO-1 task-2] INFO io.kamax.mxisd.directory.DirectoryManager - Querying HS at https://localhost:8049/_matrix/client/r0/user_directory/search
ERROR io.kamax.mxisd.http.undertow.handler.SaneHandler - Transaction #1555522350994 - Unable to query the HS: I/O error: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[XNIO-1 task-2] INFO io.kamax.mxisd.http.undertow.handler.BasicHttpHandler - Request POST http://smsnt.eu/_matrix/client/r0/user_directory/search - Error M_UNKNOWN: An internal server error occured. If this error persists, please contact support with reference #1555522350994
Unsourire commented 5 years ago

I solve the first problem. it was the https protocol , i changed it to http and the good port ansd it's working. but i have a lot of error with The 3pids mapping. because there is no link (on matrix) with the mail adresse and the username even in putting the federation with the dns overwire. for exemple i have the following message

[ForkJoinPool.commonPool-worker-1] INFO io.kamax.mxisd.invitation.InvitationManager - Searching for mapping created after invite @toto:example.org:!rokwOLCdRVMjUdCaYz:smsnt.eu:email:toto123@hotmail.com was created
[ForkJoinPool.commonPool-worker-1] INFO io.kamax.mxisd.lookup.strategy.RecursivePriorityLookupStrategy - Host Internal allowed for recursion: true
[ForkJoinPool.commonPool-worker-1] INFO io.kamax.mxisd.lookup.provider.DnsLookupProvider - Performing DNS lookup for toto123@hotmail.com
[ForkJoinPool.commonPool-worker-1] INFO io.kamax.mxisd.lookup.provider.DnsLookupProvider - Domain name for toto123@hotmail.com: hotmail.com
[ForkJoinPool.commonPool-worker-1] INFO io.kamax.mxisd.matrix.IdentityServerUtils - hotmail.com is not an URL, using as-is
[ForkJoinPool.commonPool-worker-1] INFO io.kamax.mxisd.matrix.IdentityServerUtils - Discovering Identity Server for hotmail.com
[ForkJoinPool.commonPool-worker-1] INFO io.kamax.mxisd.matrix.IdentityServerUtils - Performing SRV lookup
[ForkJoinPool.commonPool-worker-1] INFO io.kamax.mxisd.matrix.IdentityServerUtils - Lookup name: _matrix-identity._tcp.hotmail.com
[ForkJoinPool.commonPool-worker-1] INFO io.kamax.mxisd.matrix.IdentityServerUtils - No SRV record for _matrix-identity._tcp.hotmail.com
[ForkJoinPool.commonPool-worker-1] INFO io.kamax.mxisd.lookup.strategy.RecursivePriorityLookupStrategy - No 3PID mapping found
[ForkJoinPool.commonPool-worker-1] INFO io.kamax.mxisd.invitation.InvitationManager - No mapping for pending invite @toto:smsnt.eu:!rokwOLCdRVMjUdCaYz:smsnt.eu:email:toto123@hotmail.com

Thank you for your help

maxidorius commented 5 years ago

Those are not errors, they are regular and expected attempts to resolve a pending invite over the federation. If you would like to tune those (timing, usage of federation) see the relevant documentation

Unsourire commented 5 years ago

Thank you for the answer. But i have a probleme when i vinvitesomeone to a room. I can send the invitation but even when he creates an account i can't receive the invitation (on riot for example) to join the group. i can only add user by the matrix account name. I have added on the matrix confiugration of the 3PID email and on mxisd :

matrix:
  domain: 'exemple.org'
key:
  path: '/home/clients......9/mxisd/sign.key'
storage:
  provider:
    sqlite:
      database: '/home/.................59/mxisd/mxisd.db'
synapseSql:
  enabled: true
synapseSql:
  type: sqlite
synapseSql:
  connection: /home/clients/...........9/.synapse/homeserver.db
lookup:
  recursive:
    enabled: false
invite:
  resolution:
    recursive: false
invite:
  expiration:
    enabled: true
  session:
  policy:
    validation:
      enabled: true
      forLocal:
        enabled: true
        toLocal: true
        toRemote:
          enabled: false
      forRemote:
        enabled: true
        toLocal: true
        toRemote:
          enabled: false 
notification:
  handler:
    email: 'raw'
threepid:
  medium:
    email:
      identity:
        # The e-mail to send as.
        from: "noreply@chat.eu"
        name: " Chat"

      connectors:
        smtp:
          host: "localhost"
          port: 25
      generators:
        template:
          invite: '/ho..........invite_template.eml'        
dns:
  overwrite:
    homeserver:
      client:
        - name: 'example.org'
          value: 'http://localhost:8009'   

Do i miss to add something? also we got a error withe 3PID when i have the following configuration i can't create account because a error of email 3PID :

session:
  policy:
    validation:
      enabled: true
session:
  policy:
    validation:
      forLocal:
        enabled: true
        toLocal: true
        toRemote:
          enabled: false

session:
  policy:
    validation:
      forRemote:
        enabled: true
        toLocal: true
        toRemote:
          enabled: false 

but with the following is working :

session:
  policy:
    validation:
      enabled: true
      forLocal:
        enabled: true
        toLocal: true
        toRemote:
          enabled: false
      forRemote:
        enabled: true
        toLocal: true
        toRemote:
          enabled: false 
Unsourire commented 5 years ago

hello, we solve the solution by adding the following

dns:
  overwrite:
    homeserver:
      federation:
        - name: 'chat.eu'
          value: 'http://localhost:8009'       
      client:
        - name: 'chat.eu'
          value: 'http://localhost:8009'  

synapseSql:
  enabled: true
  type: sqlite
  connection: /home/clients/......................./.synapse/homeserver.db

but we have the following warning is it important?

[Thread-19] INFO io.kamax.mxisd.invitation.InvitationManager - Posting onBind event to http://localhost:8009/_matrix/federation/v1/3pid/onbind
[Thread-18] INFO io.kamax.mxisd.invitation.InvitationManager - Answer code: 500
[Thread-18] WARN io.kamax.mxisd.invitation.InvitationManager - Answer body: {"errcode":"M_UNKNOWN","error":"Internal server error"}
[Thread-19] INFO io.kamax.mxisd.invitation.InvitationManager - Answer code: 500
[Thread-19] WARN io.kamax.mxisd.invitation.InvitationManager - Answer body: {"errcode":"M_UNKNOWN","error":"Internal server error"}
maxidorius commented 5 years ago

Yes the warning is important: mxisd is trying to contact the homeserver but instead ends up talking to itself.

You have misconfgured your name resolution wrong somewhere. The log is incomplete (there should be more info in the previous lines) so I cannot tell you more at this point.

Unsourire commented 5 years ago

Here is the message.

[Thread-1935] WARN io.kamax.mxisd.invitation.InvitationManager - Unable to tell HS chat.eu about invite being mapped
org.apache.http.NoHttpResponseException: localhost:8009 failed to respond
        at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:141)
        at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56)
        at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259)
        at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163)
        at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:165)
        at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273)
        at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
        at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272)
        at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
        at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
        at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111)
        at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108)
        at io.kamax.mxisd.invitation.InvitationManager.lambda$publishMapping$2(InvitationManager.java:308)
        at java.lang.Thread.run(Thread.java:748)
[Thread-1934] INFO io.kamax.mxisd.invitation.InvitationManager - Answer code: 500
[Thread-1934] WARN io.kamax.mxisd.invitation.InvitationManager - Answer body: {"errcode":"M_UNKNOWN","error":"Internal server error"}
Unsourire commented 5 years ago

But my HS is located on local at the 8009 port.

maxidorius commented 5 years ago

Oh sorry, I misread the log, I thought it was port 8090. You'll need the synapse logs, which is where the error is happening. Most likely synapse cannot reach mxisd with the configured hostname (either matrix.domain, or server.name or server.publicUrl)

Unsourire commented 5 years ago
[ForkJoinPool.commonPool-worker-0] WARN io.kamax.mxisd.invitation.InvitationManager - /!\ /!\ --- RECURSIVE INVITE RESOLUTION HAS BEEN DISABLED --- /!\ /!\
[ForkJoinPool.commonPool-worker-0] INFO io.kamax.mxisd.lookup.strategy.RecursivePriorityLookupStrategy - Host Internal allowed for recursion: false
[ForkJoinPool.commonPool-worker-0] INFO io.kamax.mxisd.backend.sql.SqlThreePidProvider - SQL lookup
[ForkJoinPool.commonPool-worker-0] INFO io.kamax.mxisd.backend.sql.SqlThreePidProvider - SQL query: SELECT user_id AS uid FROM user_threepids WHERE medium = ? AND address = ?
[ForkJoinPool.commonPool-worker-0] INFO io.kamax.mxisd.backend.sql.SqlThreePidProvider - No match found in SQL
[ForkJoinPool.commonPool-worker-0] INFO io.kamax.mxisd.lookup.strategy.RecursivePriorityLookupStrategy - No 3PID mapping found
[ForkJoinPool.commonPool-worker-0] INFO io.kamax.mxisd.invitation.InvitationManager - No mapping for pending invite @llllll:chat.eu:!YosGEZxyyDfhKgdwVw:chat.eu:email:xxxxxx@gmail.com
[Thread-1947] INFO io.kamax.mxisd.invitation.InvitationManager - Posting onBind event to http://localhost:8009/_matrix/federation/v1/3pid/onbind
[Thread-1946] INFO io.kamax.mxisd.invitation.InvitationManager - Answer code: 500
[Thread-1946] WARN io.kamax.mxisd.invitation.InvitationManager - Answer body: {"errcode":"M_UNKNOWN","error":"Internal server error"}
[Thread-1947] INFO io.kamax.mxisd.invitation.InvitationManager - Answer code: 500
[Thread-1947] WARN io.kamax.mxisd.invitation.InvitationManager - Answer body: {"errcode":"M_UNKNOWN","error":"Internal server error"}
maxidorius commented 5 years ago

That's mxisd's log, not synapse.

maxidorius commented 5 years ago

@Unsourire Can you provide the synapse log lines relevant for this issue? If not, I'll close this issue for now.

Unsourire commented 5 years ago

Sorry, here is the Synapse log :

2019-04-25 18:09:09,635 - synapse.handlers.sync - 909 - INFO - GET-117765 - Calculating sync response for @r.duele:smsnt.eu between Token(room_key=u's14086', presence_key=u'272632', typing_key=u'1806', receipt_key=u'22438', account_data_key=u'23184', push_rules_key=u'19', to_device_key=u'97', device_list_key=u'908', groups_key=u'165') and Token(room_key='s14086', presence_key=272632, typing_key=1806, receipt_key=22438, account_data_key=23184, push_rules_key=19, to_device_key=97, device_list_key=908, groups_key=165)
2019-04-25 18:09:09,640 - synapse.access.http.8009 - 302 - INFO - GET-117765 - ::ffff:127.0.0.1 - 8009 - {@r.duele:smsnt.eu} Processed request: 30.008sec/0.001sec (0.004sec, 0.000sec) (0.000sec/0.000sec/0) 210B 200 "GET /_matrix/client/r0/sync?filter=4&timeout=30000&since=s14086_272632_1806_22438_23184_19_97_908_165 HTTP/1.1" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.128 Safari/537.36" [0 dbevts]
2019-04-25 18:09:09,721 - synapse.access.http.8009 - 233 - INFO - OPTIONS-117772 - ::ffff:127.0.0.1 - 8009 - Received request: OPTIONS /_matrix/client/r0/sync?filter=4&timeout=30000&since=s14086_272632_1806_22438_23184_19_97_908_165
2019-04-25 18:09:09,723 - synapse.access.http.8009 - 302 - INFO - OPTIONS-117772 - ::ffff:127.0.0.1 - 8009 - {None} Processed request: 0.001sec/0.000sec (0.000sec, 0.000sec) (0.000sec/0.000sec/0) 22B 200 "OPTIONS /_matrix/client/r0/sync?filter=4&timeout=30000&since=s14086_272632_1806_22438_23184_19_97_908_165 HTTP/1.1" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.128 Safari/537.36" [0 dbevts]
2019-04-25 18:09:09,798 - synapse.access.http.8009 - 233 - INFO - GET-117773 - ::ffff:127.0.0.1 - 8009 - Received request: GET /_matrix/client/r0/sync?filter=4&timeout=30000&since=s14086_272632_1806_22438_23184_19_97_908_165
2019-04-25 18:09:09,800 - synapse.util.caches.response_cache - 151 - INFO - GET-117773 - [sync]: no cached result for [(@r.duele:smsnt.eu, 30000, u's14086_272632_1806_22438_23184_19_97_908_165', u'4', False, u'WBLGAXRIWY')], calculating new one
2019-04-25 18:09:13,171 - synapse.metrics - 372 - INFO -  - Collecting gc 0
2019-04-25 18:09:13,205 - synapse.handlers.presence - 257 - INFO -  - Performing _persist_unpersisted_changes. Persisting 3 unpersisted changes
2019-04-25 18:09:13,206 - synapse.storage._base - 401 - WARNING -  - Starting db txn 'update_presence' from sentinel context
2019-04-25 18:09:13,206 - synapse.storage._base - 437 - WARNING -  - Starting db connection from sentinel context: metrics will be lost
2019-04-25 18:09:13,206 - synapse.handlers.presence - 350 - INFO -  - Handling presence timeouts
2019-04-25 18:09:13,207 - synapse.handlers.typing - 89 - INFO -  - Checking for typing timeouts
2019-04-25 18:09:13,220 - synapse.handlers.presence - 269 - INFO -  - Finished _persist_unpersisted_changes
2019-04-25 18:09:13,245 - synapse.storage.TIME - 301 - INFO -  - Total database time: 0.000% {update_presence(1): 0.000%, get_remote_profile_cache_entries_that_expire(1): 0.000%, update_cached_last_access_time(1): 0.000%} {}
2019-04-25 18:09:18,205 - synapse.handlers.presence - 350 - INFO -  - Handling presence timeouts
2019-04-25 18:09:18,206 - synapse.handlers.typing - 89 - INFO -  - Checking for typing timeouts
2019-04-25 18:09:21,808 - synapse.access.http.8009 - 233 - INFO - POST-117774 - ::ffff:127.0.0.1 - 8009 - Received request: POST /_matrix/federation/v1/3pid/onbind
2019-04-25 18:09:21,819 - synapse.metrics - 372 - INFO -  - Collecting gc 0
2019-04-25 18:09:21,833 - synapse.http.server - 112 - ERROR - POST-117774 - Failed handle request via 'On3pidBindServlet': <SynapseRequest at 0x7ff882db00e0 method=u'POST' uri=u'/_matrix/federation/v1/3pid/onbind' clientproto=u'HTTP/1.1' site=8009>
Traceback (most recent call last):
  File "/........................../.synapse/local/lib/python2.7/site-packages/synapse/http/server.py", line 81, in wrapped_request_handler
    yield h(self, request)
  File "/........................../.synapse/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/........................../.synapse/local/lib/python2.7/site-packages/twisted/python/failure.py", line 491, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/........................../.synapse/local/lib/python2.7/site-packages/synapse/http/server.py", line 316, in _async_render
    callback_return = yield callback(request, **kwargs)
  File "........................../.synapse/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/........................../.synapse/local/lib/python2.7/site-packages/twisted/python/failure.py", line 491, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/........................../.synapse/local/lib/python2.7/site-packages/synapse/federation/transport/server.py", line 293, in new_func
    origin, content, request.args, *args, **kwargs
  File "/........................../.synapse/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/........................../.synapse/local/lib/python2.7/site-packages/twisted/python/failure.py", line 491, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/........................../.synapse/local/lib/python2.7/site-packages/synapse/federation/transport/server.py", line 641, in on_POST
    raise last_exception
KeyError: 'display_name'

Thank you

maxidorius commented 5 years ago

Synapse on python2 is an old version. Be sure you are using the latest version which is only compatible with python3. Also, mxisd only supports tagged release versions of synapse, latest being 0.99.3