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

Workaround for user_saml-application to return lower-case realm when configured through environment-variable. #273

Merged
merged 6 commits into from
May 30, 2023

Conversation

marioqxx
Copy link
Contributor

No description provided.

…onfigured through environment-variable.

Signed-off-by: marioqxx <marioqxx@users.noreply.github.com>
…onfigured through environment-variable.

Signed-off-by: marioqxx <marioqxx@users.noreply.github.com>
…onfigured through environment-variable.

Signed-off-by: marioqxx <marioqxx@users.noreply.github.com>
@marioqxx
Copy link
Contributor Author

Not sure what happened, but almost all of the errors from "ansible-lint" refer to naming-convention issues, which seem to have its origin in a change of the ansible-lint checks. Almost all errors come from something other than the patch.

@staticdev
Copy link
Collaborator

staticdev commented May 22, 2023

@marioqxx thanks for this contribution. I am a bit curious of which context this SAML app is used, it is new to me.

Regarding ansible-lint it is related to an update. Since there are a lot of errors just created an ignore patch for now #276.

@aalaesar
Copy link
Member

Hello there @marioqxx
Thank you for your enthousiasm for contributing to the collection. I really appreciate that. 👍

However, 🤔 I feels that this part of code is more specific to your deployment than a generic installation process.
Thoses tasks would totally make sense in a larger playbook that is runinng the installation role, then those patch tasks.
Unles a patch has been already submitted to the SAML application repository, I think this part may need to be removed in the near future.

regards.

@staticdev
Copy link
Collaborator

@marioqxx you can now rebase to get rid of annoying errors on ansible-lint.

@marioqxx
Copy link
Contributor Author

@staticdev: Done. Thank you.

@aalaesar: You raise a valid question, I expected this question and appreciate you taking your time on this topic. Moreover, I questioned myself whether or not to add this here. I did conclude that it might be helpful and thus went forward. Certainly, you may come to a different conclusion and I'm OK with that too.

So what is the use-scenario: You want single-sign-on and administer your users centrally via LDAP, such as through OpenLDAP or Active directory. In my use-case I run a samba domain controller and provide single-sign-on for nextcloud as well as central user-administration by the samba domain-controller. Single-sign-on is then accomplished through user_saml-module. I cannot judge how often such a setup exists, because NC has put this behind a paywall. I do respect NC's decision and I do have an interest that NC is a prosperous company as well!

The issue that this patch works around is there since at least 2017 (see the date of the case I refer in the README) and it pops up on several further places in the github.com issue-tracker for the user_saml project. The most recent entry I think is from 2022/2021 and basically it concludes that this won't be changed.

Therefore, the workaround more or less becomes a permanent solution and it cannot be expected that it is not needed anymore in the near future.

In order to make this work-around work properly, I have decided not to use ansible-patch module, but instead have chosen to use blockinfile. The way it is implemented makes it resilient to changes and the script would work for any user_saml-Version back till 2017 (and maybe earlier). I think it is safe to assume that the same holds true for future versions, including changes in user_saml-app that also change SAMLController.php.

The idea then to include it in this script, but not outside in another playbook was also driven by the thought, that it might be helpful for others and furthermore, the patch requires some pre-requisites, which can be easily checked in this ansible-script but would require duplicate but consistent configuration settings when placed outside. E.g. "nextcloud-root-directory", check presence of user_saml application and the like. In summary, from implementation point of view it nicely fits in here.

I also thought, that it is an quite compact and local change to this ansible script and which does not need extra servicing. It then also adds only a single configuration parameter and furthermore, the README adds value in the way that it explains an issue and helps others, avoiding them lengthy trouble-shooting and searching or even giving up at all.

@staticdev
Copy link
Collaborator

@marioqxx I don't know the final decision from @aalaesar about adding, code LGTM. As for docs, this explanation you just did in the last comment about use-scenario would be very good to have in the new session of the install_nextcloud's README you added.

Signed-off-by: marioqxx <marioqxx@users.noreply.github.com>
@marioqxx
Copy link
Contributor Author

marioqxx commented May 27, 2023

@staticdev: I've updated the README according your suggestion. I have added you to my private repository, which is a ansible-role for installing and setting up a samba domain-controller. This isn't yet at a state to become public and I'll do this after the new Debian release is out and tested against it.

@aalaesar
Copy link
Member

aalaesar commented May 27, 2023

Hello there !
All right @marioqxx , you've made your point, that's a pitty that this need this hack to works, and to repeat it for all the application updates. 😞

Thank you for your effort to explain it well in the readme 👍

@staticdev staticdev merged commit de31ba3 into nextcloud:main May 30, 2023
7 checks passed
@wiktor2200 wiktor2200 added the enhancement New feature or request label Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants