1
0
mirror of https://github.com/quay/quay.git synced 2026-01-26 06:21:37 +03:00

39 Commits

Author SHA1 Message Date
Brandon Caton
65e727086a ldap: allow global readonly superuser to be filtered (PROJQUAY-7044) (#2917)
Allow global readonly superuser to be specified via LDAP.
2024-06-04 15:19:37 -04:00
Sunandadadi
6bf6c2b181 teamsync: run team sync worker for teams synced via ldap or keystone (PROJQUAY-6762) (#2788)
* teamsync: run team sync worker for teams synced via ldap or keystone (PROJQUAY-6762)

* fix comment

* adding test

* isort fix
2024-04-29 13:18:04 -04:00
Sunandadadi
81682c96d0 oidc: ask for group object id for azure oauth login (PROJQUAY-6917) (#2805)
* oidc: ask for group object id for azure oauth login (PROJQUAY-6917)

* fixing tests

* adding tests
2024-04-24 10:18:31 -04:00
Sunandadadi
298373a3db oidc: allows users to login via cli (PROJQUAY-6873) (#2748)
* oidc: allows users to login via cli (PROJQUAY-6873)

* fixing tests

* update reading username + adding tests
2024-03-18 14:06:16 -04:00
Sunandadadi
3983b73097 oidc: use federated login service to sync quay teams (PROJQUAY-6741) (#2724)
* oidc: use federated login service to sync quay teams (PROJQUAY-6741)

* adding more logs to oidc team sync

* Adding tests
2024-03-05 16:47:06 -05:00
Sunandadadi
3446d5630b oidc: display error msg when signing in via username password (PROJQUAY-6740) (#2714)
* oidc: display error msg when signing in via username password (PROJQUAY-6740)

* added test + typo fix
2024-03-01 13:14:27 -05:00
Sunandadadi
74fd23d7d3 backend: Syncing teams with OIDC group (PROJQUAY-6290) (#2693) 2024-02-27 16:53:51 -05:00
Sunandadadi
4cb0a57488 ui: ui and initial scaffolding for OIDC auth (PROJQUAY-6298) (#2646)
* added base class for OIDC auth + UI

* adding read-only teams page + display sync config + option to remove team sync

* setting page in read only mode fix

* ui tests

* adding validation for group name input

* fixes based on review + fixing test suite

* add backend tests for externalOIDC

* minor fixes
2024-02-20 11:58:10 -05:00
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
Marcus Kok
dd96025ff5 user: Support custom LDAP memberOf attribute (PROJQUAY-5928) (#2406)
* user: Support custom LDAP memberOf attribute (PROJQUAY-3235)
* rebase of [PR 1120](https://github.com/quay/quay/pull/1120)

---------

Co-authored-by: Marius Bakke <marius.bakke@usit.uio.no>
2023-10-16 09:33:30 -04:00
Kenny Lee Sin Cheong
5f63b3a7bb chore: drop deprecated tables and remove unused code (PROJQUAY-522) (#2089)
* chore: drop deprecated tables and remove unused code

* isort imports

* migration: check for table existence before drop
2023-08-25 12:17:24 -04:00
Michaela Lang
7ecf97b9fc authentication(LDAP): allow LDAP referrals to not be followed (PROJQUAY-5291) (#1905) 2023-06-02 19:32:18 +02:00
Kenny Lee Sin Cheong
16e5321108 permissions: lazy-load superuser permissions (PROJQUAY-5117) (#1761) 2023-03-06 10:29:55 -05:00
Ivan Bazulic
95a5932528 security: Change error messages in UI during LDAP login (PROJQUAY-4845) (#1767)
* Change error messages in UI during LDAP login (PROJQUAY-4845)

Previously, on installations where LDAP is used, we were telling users whether the username or password was failing when login attempts were made. This might pose a security risk, a malicious user could, via the returned message, identify which users have access to Quay and which don't.
With this change, we return a general message saying the user used wrong credentials instead of providing any details.

* Fixed tests.

* Fix some more tests.

* Readd accidental removal of one assertion.
2023-03-02 11:49:11 -05:00
Kenny Lee Sin Cheong
dba302b5f1 users: default to true if LDAP_RESTRICTED_USER_FILTER is not set (PROJQUAY-4776) (#1645)
When LDAP is used and FEATURE_RESTRICTED_USERS is set, if
LDAP_RESTRICTED_USER_FILTER is set, then, by default, all ldap users
are restricted.
2022-11-25 13:39:07 -05:00
Kenny Lee Sin Cheong
b128936b50 users: fix behavior when using ldap and restricted user whitelist is set (PROJQUAY-4767) (#1640) 2022-11-23 15:22:15 -05:00
Kenny Lee Sin Cheong
0caa4203ec users: prevent CREATE_NAMESPACE_ON_PUSH is restricted (PROJQUAY-4702) (#1621)
Prevent creating namespaces/orgs on pushes (CREATE_NAMESPACE_ON_PUSH)
if user is restricted.

Also updates RESTRICTED_USERS_WHITELIST to defaults to all if not set,
given that FEATURE_RESTRICTED_USERS is set.
2022-11-09 18:23:01 -05:00
Kenny Lee Sin Cheong
64ec15605c superusers: grant superusers additinonal org permissions (PROJQUAY-4687) (#1613)
When FEATURE_SUPERUSERS_FULL_ACCESS is set, grant superusers org admin permissions:
- PROJQUAY-4687
- PROJQUAY-4690
- PROJQUAY-4693
- PROJQUAY-4697
- PROJQUAY-4701
2022-11-07 17:41:18 -05:00
Kenny Lee Sin Cheong
c84067a4d6 users: add restricted users' filter (PROJQUAY-1245) (#1551)
- Similar to LDAP_SUPERUSER_FILTER, add a specific filter to define
restricted users, based on the LDAP_USER_FILTER
- restrict writes on restricted users' own namespace. Normal
permissions applies on organization membership
- add global readonly superuser GLOBAL_READONLY_SUPER_USERS (PROJQUAY-2604)
- Removes RESTRICTED_USER_INCLUDE_ROBOTS, FEATURE_RESTRICTED_READ_ONLY_USERS
2022-10-28 13:38:37 -04:00
Kenny Lee Sin Cheong
14e87bd41e users: fix missing references in ldap for superusers (#1542) 2022-09-26 16:15:52 -04:00
Dave O'Connor
d4c0c1e4ed Fix super (#1533) 2022-09-16 15:31:04 -04:00
Dave O'Connor
dfe4d9f98b Fix typo (#1531) 2022-09-15 15:42:12 -04:00
Kenny Lee Sin Cheong
070f464b14 users: superuser group in federated identity provider (PROJQUAY-3924) (#1464) 2022-08-11 15:36:10 -04:00
Oleg Bulatov
5eaf0584db chore: Run mypy as CI job (#1363)
* Run mypy as CI job

* Fix peewee.pyi and configure pyright
2022-06-13 11:01:17 +02:00
Kenny Lee Sin Cheong
4785f2d119 Deprecate use of pycryptodome for AES (#679)
Since we're already using the cryptography package elsewhere, there is
no need to have 2 different crypto packages as dependencies.
2021-03-08 13:33:44 -05:00
Kurtis Mullins
bd7252c536 [PROJQUAY-1021] task: Update "Black" to version 20.8b1 2020-11-30 18:48:19 -05:00
thomasmckay
f9126ea375 PROJQUAY-1258 - correct ldap python3 call (#600) 2020-11-18 15:20:42 -05:00
thomasmckay
bf83ddee4b PROJQUAY-1273 - ldap bytes-like strings (#598) 2020-11-12 14:07:37 -05:00
Kurtis Mullins
52b86ac9fd [PROJQUAY-822] security: Hide sensitive LDAP log data (#562) 2020-10-06 12:44:07 -04:00
Kenny Lee Sin Cheong
71a2ba052c Fix ldap user login (#509)
* Fix typo

* Make sure python-ldap uses str instead of bytes
2020-08-07 16:08:36 -04:00
zhouhaibing089
4c429687fe keystonev2: populate user.name into UserInformation (#440)
The behavior between keystonev2 and keystonev3 is different today.
In keystonev3 implementation, the username comes from [user.name][1],
but keystonev2 just uses the incoming `username_or_email`.

Also, by reading `user.name`, we can use keystone APIKeys to do
authentication which is necessary due to potential 2FA requirements.

[1]: f4179e5e71/data/users/keystone.py (L316)
2020-06-17 14:13:00 -04:00
Kurtis Mullins
38be6d05d0 Python 3 (#153)
* Convert all Python2 to Python3 syntax.

* Removes oauth2lib dependency

* Replace mockredis with fakeredis

* byte/str conversions

* Removes nonexisting __nonzero__ in Python3

* Python3 Dockerfile and related

* [PROJQUAY-98] Replace resumablehashlib with rehash

* PROJQUAY-123 - replace gpgme with python3-gpg

* [PROJQUAY-135] Fix unhashable class error

* Update external dependencies for Python 3

- Move github.com/app-registry/appr to github.com/quay/appr
- github.com/coderanger/supervisor-stdout
- github.com/DevTable/container-cloud-config
- Update to latest mockldap with changes applied from coreos/mockldap
- Update dependencies in requirements.txt and requirements-dev.txt

* Default FLOAT_REPR function to str in json encoder and removes keyword assignment

True, False, and str were not keywords in Python2...

* [PROJQUAY-165] Replace package `bencode` with `bencode.py`

- Bencode is not compatible with Python 3.x and is no longer
  maintained. Bencode.py appears to be a drop-in replacement/fork
  that is compatible with Python 3.

* Make sure monkey.patch is called before anything else (

* Removes anunidecode dependency and replaces it with text_unidecode

* Base64 encode/decode pickle dumps/loads when storing value in DB

Base64 encodes/decodes the serialized values when storing them in the
DB. Also make sure to return a Python3 string instead of a Bytes when
coercing for db, otherwise, Postgres' TEXT field will convert it into
a hex representation when storing the value.

* Implement __hash__ on Digest class

In Python 3, if a class defines __eq__() but not __hash__(), its
instances will not be usable as items in hashable collections (e.g sets).

* Remove basestring check

* Fix expected message in credentials tests

* Fix usage of Cryptography.Fernet for Python3 (#219)

- Specifically, this addresses the issue where Byte<->String
  conversions weren't being applied correctly.

* Fix utils

- tar+stream layer format utils
- filelike util

* Fix storage tests

* Fix endpoint tests

* Fix workers tests

* Fix docker's empty layer bytes

* Fix registry tests

* Appr

* Enable CI for Python 3.6

* Skip buildman tests

Skip buildman tests while it's being rewritten to allow ci to pass.

* Install swig for CI

* Update expected exception type in redis validation test

* Fix gpg signing calls

Fix gpg calls for updated gpg wrapper, and add signing tests.

* Convert / to // for Python3 integer division

* WIP: Update buildman to use asyncio instead of trollius.

This dependency is considered deprecated/abandoned and was only
used as an implementation/backport of asyncio on Python 2.x
This is a work in progress, and is included in the PR just to get the
rest of the tests passing. The builder is actually being rewritten.

* Target Python 3.8

* Removes unused files

- Removes unused files that were added accidentally while rebasing
- Small fixes/cleanup
- TODO tasks comments

* Add TODO to verify rehash backward compat with resumablehashlib

* Revert "[PROJQUAY-135] Fix unhashable class error" and implements __hash__ instead.

This reverts commit 735e38e3c1d072bf50ea864bc7e119a55d3a8976.
Instead, defines __hash__ for encryped fields class, using the parent
field's implementation.

* Remove some unused files ad imports

Co-authored-by: Kenny Lee Sin Cheong <kenny.lee@redhat.com>
Co-authored-by: Tom McKay <thomasmckay@redhat.com>
2020-06-05 16:50:13 -04:00
Benjamin Merot
bab908d8f2 Defined found_results before try block so it's always assigned (#376)
Up until now, the "if not found_results" line could throw an UnboundLocalError because the variable was assigned inside a try block which could fail but the variable was later referenced.
2020-05-12 10:59:41 -04:00
Joseph Schorr
2f171889e4 Fix search filter for LDAP user lookup when no user filter is specified (#346)
The LDAP class defined the filter using a default Python parameter, so
we need to mimic it
2020-04-22 16:44:32 -04:00
Joseph Schorr
3e8ef9574c Ensure that all user-provided filters are wrapped in parens (#322)
Also adds tests and fixes some issues with our existing filter

Fixes https://issues.redhat.com/browse/PROJQUAY-551
2020-04-07 17:30:12 -04:00
Joseph Schorr
5619452776 Add ability to filter user lookups in LDAP user system (#252)
This allows customers to specify additional restrictions on the users
that are allowed to be used

Fixes https://issues.redhat.com/browse/PROJQUAY-226
2020-03-16 11:38:14 -04:00
alecmerdler
3dd5f045ff fix all the docstrings 2020-02-05 19:55:07 -08:00
Tom McKay
e6ae94db8b 'make black' results 2019-12-02 12:23:08 -05:00
Jimmy Zelinskie
9c0dd3b722 initial import for Open Source 🎉 2019-11-12 11:09:47 -05:00