Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix integration with Synapse #13

Merged
merged 7 commits into from
Sep 29, 2022
Merged

Fix integration with Synapse #13

merged 7 commits into from
Sep 29, 2022

Conversation

tituspijean
Copy link
Member

Closes #9

/_synapse/admin endpoint needs to be added in the NGINX config of Synapse's domain.

PR Status

  • Code finished and ready to be reviewed/tested
  • The fix/enhancement were manually tested (if applicable)

Automatic tests

Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ after creating the PR, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization)

@tituspijean tituspijean changed the base branch from master to testing February 26, 2022 21:48
@nathanael-h
Copy link
Contributor

I tested this branch. If I install on the same domain as synapase, the nginx.conf is overwritten by the synapse.nginx.conf because they both end is the same dir, with the same name.
Full logs : https://paste.yunohost.org/raw/iwovavemux

@tituspijean
Copy link
Member Author

If I install on the same domain as synapase

What. It is supposed to be on its own domain. How could your YunoHost let you do that?!

@nathanael-h
Copy link
Contributor

Mmmh I was surprised too. I tried on the same domain because of CORS issues. Will try on dedicated domain 👍

@tituspijean
Copy link
Member Author

You may try again, with the commit above, but I am still flabbergasted you could install it on the same domain as Synapse.

@tituspijean
Copy link
Member Author

!testme

@yunohost-bot

This comment was marked as outdated.

@nathanael-h
Copy link
Contributor

Cool! I'll test this new commit on same domain.
On a dedicated domain I still have the CORS error.
image

By the way I tested with curl, and I have the SSO. and not the json response.. :

nath@aaaaaaa:~$ curl -I -L --header "Authorization: Bearer syt_xxxxxxxxxxxxxxxxxxxxxxx" https:/matrix.isidorus.fr/_synapse/admin/v1/server_version
HTTP/2 302 
server: nginx
date: Tue, 01 Mar 2022 13:10:36 GMT
content-type: text/html
content-length: 154
location: https://domain.fr/yunohost/sso/?r=aHR0cHM6Ly9tYXRyaxxxxxxxxxxxxYWRtaW4vdjEvc2VydmVyX3ZlcnNpb24=
x-sso-wat: You've just been SSOed
content-security-policy: upgrade-insecure-requests
content-security-policy-report-only: default-src https: data: blob: ; object-src https: data: 'unsafe-inline'; style-src https: data: 'unsafe-inline' ; script-src https: data: 'unsafe-inline' 'unsafe-eval'
x-content-type-options: nosniff
x-xss-protection: 1; mode=block
x-download-options: noopen
x-permitted-cross-domain-policies: none
x-frame-options: SAMEORIGIN
permissions-policy: interest-cohort=()
strict-transport-security: max-age=63072000; includeSubDomains; preload
``

@nathanael-h
Copy link
Contributor

Different tests :

  • on same domain as synapse, immediatly after login I am logged out. In dev tools I see that the request on the api got a 401 unauthorized erro
  • on a different domain, I still issues with the request to the admin API. Same as the previous screenshot. Maybe we should ynh_permission_create on the admin API to make it public (meh, I am not verry keen on having it open though...)

@nathanael-h
Copy link
Contributor

What about something like this in installation...?
ynh_permission_create --permission="permission" --url=${synapse_domain}/_synapse/" --auth_header=false --allowed=vistors --label="Synpase admin API"

@tituspijean
Copy link
Member Author

What about something like this in installation...? ynh_permission_create --permission="permission" --url=${synapse_domain}/_synapse/" --auth_header=false --allowed=vistors --label="Synpase admin API"

That won't work, the permissions are set relatively to the main path of the app. We may run a Python command to set that one for the Synapse app though.

@nathanael-h
Copy link
Contributor

That could be good. I think we need to have the _synapse/ location accessible to synapse admin's frontend (ie when running in our browser) and this without SSO.

@collector-ynh
Copy link

I see exactly the same problem as @nathanael-h , have you found any solutions to solve this problem?

@Nalla22
Copy link

Nalla22 commented Mar 25, 2022

I am also experiencing the same problem, thank you for help me solve it.

@nathanael-h
Copy link
Contributor

As said here, YunoHost-Apps/synapse_ynh#301 (comment) , I upgraded my synapse to the branch that could help to fix our problem. But I still have issues... Facing SSO.

@nathanael-h
Copy link
Contributor

I was not using a valid endpoint for my tests. The app now works using this branch https://github.com/YunoHost-Apps/synapse_ynh/tree/add-_synapse-perm.

If someone wants to test it:
sudo yunohost app upgrade synapse -u https://github.com/YunoHost-Apps/synapse_ynh/tree/add-_synapse-perm --debug

@ericgaspar ericgaspar marked this pull request as ready for review April 23, 2022 10:08
@tituspijean tituspijean mentioned this pull request Apr 29, 2022
2 tasks
@tituspijean
Copy link
Member Author

!testme

@yunohost-bot
Copy link
Contributor

Meow 🐈
Test Badge

@tituspijean
Copy link
Member Author

@ericgaspar you asked about the state of this PR in #17. I think it's ready to go, though I have a doubt about the relevance of endpoint.nginx.conf if the synapse.admin permission is included in Synapse.

@collector-ynh
Copy link

I have installed the synapse server from the following repository: https://github.com/YunoHost-Apps/synapse_ynh/tree/add-_synapse-perm , while attributing the necessary permissions for the "visitors" group.

ksnip_20220427-200141

The purpose of this is to make the /_synapse extension accessible for the Synapse-Admin application that I have installed from the following repository : https://github.com/YunoHost-Apps/synapse-admin_ynh/tree/fix But I am facing a new problem that is preventing me from accessing my session Synapse-Admin, because at the time of authentication with the user "test" (which has all the permissions, see image above), synapse-admin opens and closes immediately, while returning the following error message :

ksnip_20220427-193622

This is what the following command returns to me : curl https://matrix.server.fr/_synapse/admin/v1/server_version

ksnip_20220427-223344

I do not know how to solve this problem, because I have tested several browsers and several different networks, so the problem does not originate neither the browser nor the network. If you have a solution to solve this problem, please feel free to let me know.

@collector-ynh
Copy link

I found other people who have the same problem, with the same erroneous error message :
Awesome-Technologies/synapse-admin#63
Awesome-Technologies/synapse-admin#135

They were able to identify the problem, and apparently this is because of the fact that the user does not have admin rights on the synapse server, except that I have given all possible rights and imaginable to my user on YunoHost as you can see in picture.

What kind of privilleges do I still have to give him?

@collector-ynh
Copy link

collector-ynh commented May 1, 2022

I managed to solve the problem, by manually adding admin rights to the test user on the matrix_synapse database with the next request :

UPDATE users SET admin = 1 WHERE name = '@test:synapse.domain.tld';

It's still strange to have to grant the permission in the BDD while yunohost is supposed to provide all admin rights as seen in the image above. The question is: Do these YunoHost permissions really serve a purpose?

Anyway, it's a real miracle that synapse-admin finally works, because I've been struggling to get it to work for almost four months.

@tituspijean

This comment was marked as off-topic.

@collector-ynh

This comment was marked as off-topic.

@ericgaspar
Copy link
Member

what do we do? Do we merge?

@lapineige
Copy link
Member

If I install on the same domain as synapase

What. It is supposed to be on its own domain. How could your YunoHost let you do that?!

I can confirm it does…

@ericgaspar
Copy link
Member

!testme

@yunohost-bot
Copy link
Contributor

🌻
Test Badge

@lapineige
Copy link
Member

This should fix #15 too.

@lapineige
Copy link
Member

In CI:

touch: cannot touch '/etc/nginx/conf.d/.d/synapse-admin.endpoint.conf': No such file or directory

Domain name issue ?

@ericgaspar
Copy link
Member

!testme

@yunohost-bot
Copy link
Contributor

🚀
Test Badge

@lapineige
Copy link
Member

Is that a CI bug ?

@BobWs
Copy link

BobWs commented Jul 28, 2022

UPDATE users SET admin = 1 WHERE name = '@test:synapse.domain.tld';

Where can I find the synapse database?
Sorry for the noob question, but I'm new to Yunohost....

@oceanlover-yuno
Copy link

If I install on the same domain as synapase

What. It is supposed to be on its own domain. How could your YunoHost let you do that?!

It is still allowing this to happen!!!

@tituspijean
Copy link
Member Author

!testme

@yunohost-bot
Copy link
Contributor

🚀
Test Badge

@tituspijean tituspijean merged commit 602215d into testing Sep 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prompt for matrix homeserver URL
9 participants