-
Notifications
You must be signed in to change notification settings - Fork 38
Allow for additional reverse proxy vhost options #504
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
base: master
Are you sure you want to change the base?
Conversation
9d3427f to
d92f531
Compare
the class foreman_proxy_content::reverse_proxy already has a parameter vhost_params. However, it is not exposed for usage, so while one can specify additional vhost parameters for HTTP via pulpcore::apache::http_vhost_options, there is no way to do the same for HTTPS. This commit changes that by adding a variable foreman_proxy_content::reverse_proxy_vhost_params that is then passed on to foreman_proxy_content::reverse_proxy such that a user can add additional vhost parameters for HTTP and HTTPS e.g. via custom-hiera.
d92f531 to
c212c4c
Compare
|
What kind of additional configuration are you looking to perform on the vhost? |
|
EDIT: tl;dr: for adding custom httpd rewrite rules The use cases that triggered this is preventing directory traversal to the parent directory from e.g. the content view directories up to the organizations by adding a custom httpd RewriteRule. Some users of foreman might manage different of their customers as different organizations, and ideally the "list of customers" is not leaked by a simple director traversal. Still the full paths to other "customer's" lifecycles, repositories et.c might be determined by guessing, but it is better than nothing. A "proper" solution of this might also be worth investigating as part of a separate issue (if you want I will gladly open one), but the change here allows us to be flexible in addressing such custom requirements without adding a lot of edge cases to the foreman code itself, so I think this is really worth having. Custom vhost parameters also work out of the box for foreman (via custom-hiera.yaml), just not for the foreman proxy. |
|
@ehelms if you have any more questions let me know. Is there anything more I need to do here, e.g. search for a reviewer, or are you reviewing this? |
|
So, you'd want a setting like https://pulpproject.org/pulpcore/docs/admin/reference/settings/#hide_guarded_distributions that applies to everything and not just content guarded repositories? @ekohl what are your thoughts on this open ended parameter? |
|
I did not know about these content guarded distributions, but yes, just guarding the distribution names would not help. Unless distributions are a different concept in pulp, and what I call organization is indeed a "distribution". On foreman, I talk about paths like: the main use case currently for us is to have the listing in Even if these content guarded distributions would work, I am not sure how this can be enabled in foreman, I could not find any documentation on this from the foreman side. This MR addresses an implementation oversight where one parameter is not passed through correctly in one particular case. While I am curious about other solutions and whether this could also be provided via other means, I think this MR has its justification regardless whether there is a different solution. Otherwise, the implication would be that it should also not be possible to add custom vhost options on http, which is currently possible. While searching documentation on the content guarded distributions, I found this: Which sounds like this is yet another way to hide distributions. |
Generally I try to avoid them at the top level because they're really hard to support: you're exposing many internal details. I have no objection to adding them in a way you can only use Hiera because that by definition is a "you're on your own" situation.
There is the We pass that from our other module where it defaults to true:
Then I don't know how from Katello you can enable this.
I think a proper feature in Pulp would be the preferred way. Looking at the code I think https://github.com/pulp/pulpcore/blob/9971e1beafb9e27c26d71568d1b64a7986bc5b33/pulpcore/content/handler.py#L87-L118 is the listing in question. I get the impression that if you hide all your content with guarded distributions then |
There exists a parameter for HTTPs, pulpcore::apache::https_vhost_options that can be set in As @ekohl indicates, our desire on design and support falls into:
|
We also saw this and tried it according to my notes, but unfortunately it did not work for https ( |
|
It kind a sounds like you want to hide all directory listings from the content app, is that right? |
|
@dralley |
The problem is that we define the vhost elsewhere: puppet-foreman_proxy_content/manifests/init.pp Lines 239 to 248 in dd1593c
That is a define, so you can't use Hiera to set Now that we've dropped port 8443 we could turn it into a class which allows you to set it via Hiera. |
|
As long as I can set it via the hiera, I would be happy. Just to be sure I get it correctly, you are saying the own class would be preferred over a solution like I proposed in this MR? |
|
Yes. Mostly because we expose all parameters in |
the class
foreman_proxy_content::reverse_proxyalready has a parameter vhost_params. However, it is not exposed for usage, so while one can specify additional vhost parameters for HTTP viapulpcore::apache::http_vhost_options, there is no way to do the same for HTTPS. This commit changes that by adding a variableforeman_proxy_content::reverse_proxy_vhost_paramsthat is then passed on toforeman_proxy_content::reverse_proxysuch that a user can add additional vhost parameters for HTTP and HTTPS e.g. via custom-hiera.