1
0
mirror of https://github.com/quay/quay.git synced 2026-01-27 18:42:52 +03:00
Files
quay/data/users
Michaela Lang 4719f46c2c federationuser(ldap): adding keepalive settings for LDAP connections (PROJQUAY-5137) (#1975)
* - added env option to select if we want to follow LDAP referrals
- added check on LDAP if the result is a list, it is an LDAP referral

* - change to config.yaml parameter option for enabling/disabling LDAP
  referral lookups
- removed the per/method parameter and moved the referral into the Base
  class

- verified behavior with changing the config.yaml option
  `LDAP_FOLLOW_REFERRALS`

    ```
    $ grep LDAP_FOLLOW_REFERRALS config.yaml
    LDAP_FOLLOW_REFERRALS: 0

    $ ./update_bundle
    secret "quay-config-secret" deleted
    secret/quay-config-secret created
    deployment.apps/quay restarted

    $ oc -n quay logs -f deploy/quay | grep referrals
    gunicorn-web stdout | 2023-05-25 09:41:36,524 [74] [DEBUG] [data.users] LDAPUsers return referrals value 0
    gunicorn-secscan stdout | 2023-05-25 09:41:38,093 [73] [DEBUG] [data.users] LDAPUsers return referrals value 0
    gunicorn-registry stdout | 2023-05-25 09:41:38,410 [72] [DEBUG] [data.users] LDAPUsers return referrals value 0

    $ sed -i -e " s#LDAP_FOLLOW_REFERRALS: 0#LDAP_FOLLOW_REFERRALS: 1#; " config.yaml
    $ grep LDAP_FOLLOW_REFERRALS config.yaml
    LDAP_FOLLOW_REFERRALS: 1

    $ ./update_bundle
    secret "quay-config-secret" deleted
    secret/quay-config-secret created
    deployment.apps/quay restarted

    $ oc -n quay logs -f deploy/quay  | grep referrals
    gunicorn-secscan stdout | 2023-05-25 09:42:22,466 [72] [DEBUG] [data.users] LDAPUsers return referrals value 1
    gunicorn-web stdout | 2023-05-25 09:42:22,496 [73] [DEBUG] [data.users] LDAPUsers return referrals value 1
    gunicorn-registry stdout | 2023-05-25 09:42:23,658 [71] [DEBUG] [data.users] LDAPUsers return referrals value 1
    ```

* reformatted LDAPConnectionBulder call according to PEP

* fixed the formatting change according to pip black

* BREAKING CHANGE: LDAP lookup of robot accounts in the UI for granting
                 permission has been dropped. This impacts Users from LDAP
                 if they have not logged in already (pre provisioning).

the functions:

* _ldap_single_user_search
* _ldap_user_search

have been updated to provide `context` for dropping the LDAP query. As
the functions are used during login as well as during setting
permissions it is mandatory to be able to distinguish the context.

the functions:

* get_nonrobot_user
* find_user_by_email

from the module `data.model.user` have been utilized to identify, if the
user should be looked up in LDAP or not.

* Adding keepalive setting for LDAP connection in complex network
scenarios.

* removed PROJQUAY-5137 (part one) to simplify merging and rollback
-> Revert "BREAKING CHANGE: LDAP lookup of robot accounts in the UI for granting"

This reverts commit 8765093d73.

* fixed black
2023-10-17 17:36:24 +02:00
..