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

Update from 1.1 to 2.1 [proposed Label] Help needed #103

Open
nic-Oban opened this issue Mar 31, 2023 · 3 comments
Open

Update from 1.1 to 2.1 [proposed Label] Help needed #103

nic-Oban opened this issue Mar 31, 2023 · 3 comments
Assignees
Labels

Comments

@nic-Oban
Copy link

Good morning,
I use your Mattermost-LDAP plugin (bare-metal) to authenticate our users from our LDAP server into our mattermost server. Everything is working fine with the v1.1 version since years! Thanks a lot!!

As some users want to be able to use the desktop client, I'm trying to update to v2.1 but I'm a bit lost. Is there a migration procedure you can provide to help me?

I set up the /var/www/html/oauth/ part and fill the parameters to config_db.php and LDAP/config_ldap.php.
I edited the config.json of mattermost to modifiy
User API Endpoint : http://HOSTNAME/oauth/resource.php
Auth Endpoint: http://HOSTNAME/oauth/authorize.php
Token Endpoint: http://HOSTNAME/oauth/token.php
And finally added "location /oauth/access_token" and "location /oauth/authorize" parts to nginx conf.

When I click the "GitLab" button on the Mattermost login page, I'm sent to a 500 Internal server Error page... I must miss something!

Thanks a lot if you can help me to upgrade this great Mattermost-LDAP server!
Have a good day
Nicolas

@nic-Oban nic-Oban added the bug label Mar 31, 2023
@nic-Oban nic-Oban changed the title Update from 1.1 to 2.1 Update from 1.1 to 2.1 [proposed Label] Help needed Mar 31, 2023
@Crivaledaz
Copy link
Owner

Hi,

Thank you for using Mattermost-LDAP for years. I'm glad it fulfils your needs.

Mattermost-LDAP V1.1 is a bit old now, and I think updating to V2.1 is a good choice. Unfortunately, there is no dedicated documentation for migration. However, I have added this subject to my ToDo list and will create one in the future. Note that the master branch is stable and contains a few fixes, so I suggest migrating directly to the latest commit.

However, the migration from V1.1 to V2.1 should not be complicated. First, for any new release, you need to checkout the new version, then adapt config_db.php and LDAP/config_ldap.php with your values.

Since Mattermost enforces URL checking, and as it is stated in the "Breaking Changes" of the V2.1, you should adapt you web server configuration (ie NGINX) to add the following URI redirection :

  • /oauth/access_token --> /oauth/index.php
  • /oauth/authorize --> /oauth/authorize.php

You can refer to the NGINX configuration used for the Demo.

After that, you should adapt your GitLab configuration in config.json. You need to check that your Mattermost server reads configuration from that file, not from the database directly (see #83). You should mainly edit the Auth Endpoint which must point to http://HOSTNAME/oauth/authorize (without the .php at the end). Then, restart your Mattermost server to take the change into account.

Following these steps should bring you a working Mattermost-LDAP V2.1.

Finally, I saw from your title you were looking for a Help needed label. Note there is already a label Help wanted, you can use. You can see available labels here. Nevertheless, I should add a template for this kind of issue. Another thing to add to my ToDo List ;)

Regards

@nic-Oban
Copy link
Author

nic-Oban commented Apr 7, 2023

Hi @Crivaledaz
thanks for your answer.
I did most of the suggested configs but without success. I still have to have a look at #83 ;)

About the label, as a simple user, I just have a choice between "Bug Report" and "Feature Request" when creating a new issue. Even if I saw the labels list, I didn't find how to apply them to my message, sorry for that.

Thanks again for your indications and hope I will find my way to use the master branch version!
Have a good day.

@Fidoshnik
Copy link

Fidoshnik commented Apr 11, 2023

Hello! I also met this error when the authorization server was migrated. The solution was very different. I'll try to help.

  1. Can you open a simple authorization page without a forward from the mattermost server?
    http://your ip//oauth/access_token
  2. Check that Selinux is disabled (sestatus. If enabled, try disabling setenforce 0)
  3. After you changed the configuration in the files, you may have changed the owner. Must be apache:apache)
    **chown -R apache:apache /var/www/html/oauth/**
  4. look at the log /var/log/php-fpm what error is there?

5)the following transfers were also added to the httpd.conf file

DocumentRoot "/var/www/html"

Rewrite Engine On
RewriteRule "/oauth/authorize" "/oauth/authorize.php"
RewriteRule "/oauth/token" "/oauth/token.php"
RewriteRule "/api/v4/user" "/oauth/resource.php"
RewriteRule "/oauth/access_token" "/oauth/index.php"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants