Skip to content

Conversation

@ywangd
Copy link
Member

@ywangd ywangd commented Feb 17, 2021

This PR makes sure that the file and native realms are always added to the realm chain unless explicitly disabled.

Currently, they are only impliciltly added when:

  1. No other realms are configured
  2. No configured realms can be used with current license (so an expired license can fallback to these basic realms)

A side effect (intended?) is that file and native realm cannot be truely disabled at all time because the above two rules always apply regardless whether the realms are disabled or not.

This PR makes the behaviour more explicit. If the file or native realm is explicitly disabled, it will be disabled at all time. If they are not explicitly disabled, they will always be added to the realm chain. Two scenarios are possible:

  1. File or native realm is explicitly configured. In this case, their order value must be provided and honoured
  2. File or native realm is not configured. In this case, they are implicitly added to the beginning of the realm chain (file then native).

PS: I labelled this as v8.0.0 only because it is a breaking change.

TODO:

  • doc update

Resolves: #50892

@ywangd ywangd added >enhancement :Security/Authentication Logging in, Usernames/passwords, Realms (Native/LDAP/AD/SAML/PKI/etc) v8.0.0 labels Feb 17, 2021
@elasticmachine elasticmachine added the Team:Security Meta label for security team label Feb 17, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-security (Team:Security)

Copy link
Contributor

@albertzaharovits albertzaharovits left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly LGTM, but I had 3 nits to help with readability of the existing complicated code.

One suggestion I have is to add the file realm at the beginning, not at the end. This to make the future "rescue tool" more robust and also because I believe the special file realm in cloud is like this.

I wonder if after this change, as a follow-up, we can disable APIs that put and delete users if the native realm is explicitly disabled. I think we should.

@albertzaharovits
Copy link
Contributor

PS I think it should only go in 8, there is some risk that forgotten users pop-up after an upgrade.

@ywangd ywangd requested a review from albertzaharovits March 20, 2021 12:50
@ywangd
Copy link
Member Author

ywangd commented Apr 8, 2021

@tvernum Albert approved the PR. Do you need to take another look?

them explicitly, `file` and `native` realms will be added automatically to the
beginning of the realm chain in that order. To opt-out from the automatic behaviour,
you can explicitly configure the `file` and `native` realms with the `order`
and `enabled` settings.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like us to include an example here (or somewhere else in the docs), like:

This sample enables the file realm and an LDAP realm, but disables the native realm:

xpack.security.authc.realms:
  file.file_realm:
    order: 0

  ldap.corporate_ldap
    order: 1
    url: 'url_to_ldap_directory'
    ...

  native.native_realm:
    enabled: false

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the existing sample to disable the native realm as an example. Thanks!

@ywangd ywangd merged commit 1cb605e into elastic:master Apr 13, 2021
nik9000 added a commit to nik9000/elasticsearch that referenced this pull request Apr 13, 2021
We recently upgrade to gradle 7.0 (elastic#69096) which turned on module
inference by default. I'm sure that's lovely, but its broken eclipse. We
should probably support modules one day, but that day ain't today. This
turns off module inference for eclipse so it can continue compiling
things just like it did yesterday.

Closes elastic#71648
nik9000 added a commit that referenced this pull request Apr 13, 2021
We recently upgrade to gradle 7.0 (#69096) which turned on module
inference by default. I'm sure that's lovely, but its broken eclipse. We
should probably support modules one day, but that day ain't today. This
turns off module inference for eclipse so it can continue compiling
things just like it did yesterday.

Closes #71648
breskeby pushed a commit to breskeby/elasticsearch that referenced this pull request Apr 14, 2021
We recently upgrade to gradle 7.0 (elastic#69096) which turned on module
inference by default. I'm sure that's lovely, but its broken eclipse. We
should probably support modules one day, but that day ain't today. This
turns off module inference for eclipse so it can continue compiling
things just like it did yesterday.

Closes elastic#71648
breskeby added a commit that referenced this pull request Apr 14, 2021
- Update gradle wrapper to gradle 7.0
- Remove deprecated usages to make build 7.0 compatible
- Fix excludes in docs snippet tasks (See gradle/gradle#16160 for details)
- Fix deprecation warnings in 7.0
- Add explicit dependencies that have been missed
- Make extract native licenses tasks output dir more explicit
- Use a snapshot of the ospackage plugin that includes a fix for 7.0 already
- fix test runtime classpath setup in repository-hdfs
- Make task dependency explicit to fix further deprecation warnings
- Remove manual check for http repo usages that has been deprecated in gradle 7.0
- Update spock to latest 2.0 milestone required for groovy 3

- Disable module inference in Eclipse (#71649)

We recently upgrade to gradle 7.0 (#69096) which turned on module
inference by default. I'm sure that's lovely, but its broken eclipse. We
should probably support modules one day, but that day ain't today. This
turns off module inference for eclipse so it can continue compiling
things just like it did yesterday.

Co-authored-by: Nik Everett <[email protected]>
elasticsearchmachine pushed a commit that referenced this pull request Sep 29, 2021
#78405)

* [DOCS] Always enable file and native realms by default

Adds an 8.0 breaking change for PR #69096.

The copy is based on the 7.13 deprecation notice added with PR #69320.

* reword

* Update docs/reference/migration/migrate_8_0/security.asciidoc

Co-authored-by: Yang Wang <[email protected]>

* Update docs/reference/migration/migrate_8_0/security.asciidoc

Co-authored-by: Yang Wang <[email protected]>

Co-authored-by: Yang Wang <[email protected]>
ywangd added a commit to ywangd/elasticsearch that referenced this pull request Jun 24, 2022
All enabled realms must have unique names. This PR tightened the logic
for ensuring realm name uniqueness. Previously the unique name check
does not cover realms that are automatically enabled.

Relates: elastic#69096
elasticsearchmachine pushed a commit that referenced this pull request Jun 24, 2022
All enabled realms must have unique names. This PR tightened the logic
for ensuring realm name uniqueness. Previously the unique name check
does not cover realms that are automatically enabled.

Relates: #69096
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>breaking >enhancement :Security/Authentication Logging in, Usernames/passwords, Realms (Native/LDAP/AD/SAML/PKI/etc) Team:Security Meta label for security team v8.0.0-alpha1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable native & file realms unless explicitly disabled

5 participants