-
Notifications
You must be signed in to change notification settings - Fork 29
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
Refs #32383: Configurable client certificate authentication to Pulp #186
Conversation
Yes please. I would love to get rid of those special purpose certificates.
Some other pattern that I saw while reading some docs was this: https://httpd.apache.org/docs/trunk/expr.html#examples. While I haven't tried, it makes me think something like this may work.
|
Solid find, that did handle both situations. |
f04c112
to
ecda8cd
Compare
manifests/init.pp
Outdated
@@ -200,6 +203,7 @@ | |||
Integer[0] $api_service_worker_count = 1, | |||
Integer[0] $content_service_worker_timeout = 90, | |||
Integer[0] $api_service_worker_timeout = 90, | |||
String $api_client_auth_cn = 'admin', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By setting this default to admin
means that this change can be released without breaking consumers of this, primarily Katello which uses client certificates with the CN set to admin
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use a stricter data type?
String $api_client_auth_cn = 'admin', | |
Stdlib::Fqdn $api_client_auth_cn = 'admin', |
AFAIK, a CN field in a cert should always be a hostname. The FQDN type also allows unqualified names (such as admin
).
I like that it's now shaping up as an enhancement. The commit message should reflect that. |
How would you like me to reflect that wording wise? |
I'm thinking about:
Reading what I just wrote, it's not really backwards compatible for some use cases. Perhaps if the "destination" was also a parameter then it would really be a mapping. You can also think about |
I am confused as to how the current test failure works:
When I look in a Pulp 3 install on a Katello nightly:
I don't see |
puppet-pulpcore/spec/acceptance/basic_spec.rb Lines 83 to 94 in 5462f34
Note how first it's unauthenticated and expects it not to be there. Then it is authenticated and it's expected to be there. The status endpoint is very different for anonymous and (admin) users. The client cert is generated here:
|
Ahh, I see now. It is not the status API but the root API which returns the OpenAPI spec that differs based on authenticated vs. unauthenticated. That feels a bit odd to get back different API specs based on who you are but that's not what this PR is about -- thanks. |
It makes sense that the OpenAPI spec describes what you can actually do vs what you could do if you had permissions. It's also what I used to determine if authentication actually works. |
On a Katello nightly this comes out as:
On a proxy:
|
12a4a0b
to
e9be59e
Compare
Another thought I had (sorry to keep directing you all over the place) is using the conditional part of mod_headers:
It keeps the option open to use other identities but allows us to remap some. What do you think about this? |
I went looking for something like this, glad you found it as that makes the code much simpler. Now I find myself asking:
|
I was thinking about a simple hash where the key is the source (it matches
I think it would make sense. It keeps it backwards compatible and allows using multiple users in the future. |
The last thought I had with this was if we wanted, going forward, to support passing any CN presented to Pulp and letting Pulp handle things. In the pure mapping case we are providing a layer in Apache that both restricts the set of possible users and enforces an explicit declaration of who can get to that endpoint. But perhaps that is over reaching and we should just trust Pulp to handle whatever user is thrown at it. |
I'm leaning to this, but I had the same considerations. |
The code is much simpler now which I like. This keeps the previous default and adds any specified mappings iteratively. |
Allows a user supplied mapping of certificate CN to Pulp user name. If this is present, set the REMOTE_USER to a Pulp user defined in the parameter to pass along to Pulp. This changes from having to generate a client certificate with a valid user (e.g. admin) as the CN to allowing to use a client certificate generated with a more standard CN (e.g. FQDN) and act as a user in Pulp suppplied to the parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is now a pure enhancement rather than an actual change. Thanks!
…o Pulp as admin
Require a client certificate to be presented with a CN that matches
the supplied auth CN. If this is present, set the REMOTE_USER to
admin to pass along to Pulp. This changes from having to generate
aclient certificate with a valid user (e.g. admin) as the CN
to allowing to use a client certificate generated with a more standard
CN (e.g. FQDN) and act as the admin user.
Example usage:
Questions:
/pulp/api/v3/status/
does not require authentication by Pulp. Do we want an exception for that route? If so, how do we idenitfy that path in the Apache config to skip the require?