Pulp cli is working only with basic authentication and not with Remote User authentication

There seems to be a slight difference between extracting information using Basic authentication and using Remote User authentication. I have attached both examples.

http --auth username:password $BASE_ADDR/pulp/api/v3/repositories/deb/apt/

HTTP/1.1 200 OK
Access-Control-Expose-Headers: Correlation-ID
Allow: GET, POST, HEAD, OPTIONS
Connection: keep-alive
Content-Length: 1814
Content-Type: application/json
Correlation-ID: 736c888b0b0a4b2c984f6f37f2abd704
Date: Tue, 02 May 2023 08:38:07 GMT
Referrer-Policy: same-origin
Strict-Transport-Security: max-age=15724800; includeSubDomains
Vary: Accept, Cookie
X-Content-Type-Options: nosniff
X-Frame-Options: DENY

{
    "count": 4, 
    "next": null, 
    "previous": null, 
    "results": [
    {
    }
    ]
}

http --cert $cert --cert-key $cert_key $BASE_ADDR/pulp/api/v3/repositories/deb/apt/

HTTP/1.1 200 OK
Access-Control-Expose-Headers: Correlation-ID
Allow: GET, POST, HEAD, OPTIONS
Connection: keep-alive
Content-Length: 2207
Content-Type: application/json
Correlation-ID: 77ff67ea59944ae5a5074fffa9d2362f
Date: Tue, 02 May 2023 08:37:16 GMT
Referrer-Policy: same-origin
Strict-Transport-Security: max-age=15724800; includeSubDomains
Vary: Accept, Cookie
X-Content-Type-Options: nosniff
X-Frame-Options: DENY

[
    {
    }
]

Due to this difference, pulp cli deb is throwing error since it tries to access data through “results”

pulp deb repository list

 File "/home/xx/.local/lib/python3.6/site-packages/pulp_glue/common/context.py", line 608, in list
    count = result["count"]
TypeError: list indices must be integers or slices, not str

Pulp Remote User Settings are made like

AUTHENTICATION_BACKENDS = ['pulpcore.app.authentication.PulpNoCreateRemoteUserBackend']
REST_FRAMEWORK = {
    'DEFAULT_AUTHENTICATION_CLASSES': [
        'rest_framework.authentication.SessionAuthentication',
        'pulpcore.app.authentication.PulpRemoteUserAuthentication'
    ]
}
REMOTE_USER_ENVIRON_NAME = "REMOTE_USER"
DB_ENCRYPTION_KEY = "/etc/pulp/keys/database_fields.symmetric.key"
GALAXY_COLLECTION_SIGNING_SERVICE = "ansible-default"
GALAXY_CONTAINER_SIGNING_SERVICE = "container-default"
ANSIBLE_API_HOSTNAME = "$BASE_ADDR"
ANSIBLE_CERTS_DIR = "/etc/pulp/keys/"
CONTENT_ORIGIN = "$BASE_ADDR"
DATABASES = {
        'default': {
                'HOST': 'database-svc',
                'ENGINE': 'django.db.backends.postgresql_psycopg2',
                'NAME': 'pulp',
                'USER': 'pulp',
                'PASSWORD': 'secretPassword',
                'PORT': '5432',
                'CONN_MAX_AGE': 0,
                'OPTIONS': { 'sslmode': 'prefer' },
        }
}
GALAXY_FEATURE_FLAGS = {
        'execution_environments': 'True',
}
PRIVATE_KEY_PATH = "/etc/pulp/keys/container_auth_private_key.pem"
PUBLIC_KEY_PATH = "/etc/pulp/keys/container_auth_public_key.pem"
STATIC_ROOT = "/var/lib/operator/static/"
TOKEN_AUTH_DISABLED = False
TOKEN_SIGNATURE_ALGORITHM = "ES256"
TOKEN_SERVER = "$BASE_ADDR/token/"
TELEMETRY = "false"
ALLOWED_EXPORT_PATHS = ["/tmp"]
ALLOWED_IMPORT_PATHS = ["/tmp"]
API_ROOT = "/pulp/"

Looks like settings file has to be altered a bit, but there is not enough documentation. Any help would be appreciated!

#deb #support #remoteuser

1 Like