-
Notifications
You must be signed in to change notification settings - Fork 21
Expose /pub directory #316
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
Conversation
src/roles/httpd/defaults/main.yml
Outdated
| httpd_pulp_api_backend: http://localhost:24817 | ||
| httpd_pulp_content_backend: http://localhost:24816 | ||
| httpd_foreman_backend: http://localhost:3000 | ||
| httpd_rpm_server_dir: /var/www/html/pub |
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.
why "rpm server"? I'd probably just do http_pub_dir or so
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.
To be honest i went with this as it was used previously https://github.com/theforeman/puppet-foreman_proxy_content/blob/master/manifests/bootstrap_rpm.pp#L38, but you are right httpd_pub_dir is more generalized and readble
b1183e9 to
3f165ad
Compare
|
Ansible looks good to me. Can you please add a test to https://github.com/theforeman/foremanctl/blob/master/tests/httpd_test.py? |
| - name: Copy CA certificate to pub directory for client trust | ||
| ansible.builtin.copy: | ||
| src: "{{ httpd_server_ca_certificate }}" | ||
| dest: "{{ httpd_pub_dir }}/katello-server-ca.crt" | ||
| remote_src: true | ||
| mode: "0644" |
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.
technically this is also available under /unattended/public/foreman_raw_ca without /pub, but lots of code relies on the old location and it's a good example of usage for now.
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.
Does it make sense to configure Apache to proxy that specific request?
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.
Proxy wouldn't work, as rails doesn't know what /pub is. We'd either need to teach it that route or translate at Apache level. Or just ignore it for now.
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.
The reason I ask is that we also know we need to support /pub/katello-consumer-ca because Anaconda relies on that. It's in RHEL 9 so we can't easily replace that. So long term I think we need to route specific /pub paths to Foreman to render it dynamically. The public templates mechanism in Foreman could be reused for /pub/katello-consumer-ca.
We also deal with it in a follow up.
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.
My thoughts on this:-
I think in /pub we have quite a few items from multiple plugins, so ideally it does not make sense to put these things, which is not completely related to foreman, in foreman/rails routes.
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 in /pub we have quite a few items from multiple plugins, so ideally it does not make sense to put these things, which is not completely related to foreman, in foreman/rails routes.
I'd like to see a list of those plugins, because no plugin should count on /pub existing. Katello and RH cloud might, but others shouldn't.
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.
In the description of SAT-40189, it is mentioned
- IoP -> For uploading/fetching cvemap.xml
- Discovery -> Uploading FDI image for PXELess Discovery Workflow
- Bootdisk -> Uploading Bootdisk image for Bootdisk Workflow
- katello-ca-consumer -> global registration uses katello-ca-consumer rpm published on /pub
Few other component tests like Repository, ISS, ACS also use /pub during testing.
After looking at these i thought we can keep the pub directory served by apache only.
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.
- IoP is correct
- Discovery and Bootdisk is not using
/pub(but the way tests in robotello are written for it might abuse `/pub) - global registration does not use /pub, it embedds all certs itself.
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 see that the katello-ca-consumer-latest.noarch.rpm still stays in pub, is that not being used now for registration(doc says (Deprecated) Katello CA Consumer method for registeration is deprecated)?
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.
correct. it's still there (for users who have non-default workflows), but unused by the default workflow we offer.
|
This PR currently exposes only |
|
I'd keep the scope as is, we can add more later as we need |
06b0736 to
01a8fb2
Compare
| def test_pub_directory_accessible(server, certificates, server_fqdn): | ||
| cmd = server.run(f"curl --cacert {certificates['ca_certificate']} --silent --output /dev/null --write-out '%{{http_code}}' https://{server_fqdn}/pub/") |
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 if we validating a CA certificate is downloadable which would cover this test already
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.
We deploy the config with Indexes, which produces a nice directory index here and this step validates it. Otherwise you'd get a 403 on the /pub/ itself.
| def test_pub_directory_accessible(server, certificates, server_fqdn): | ||
| cmd = server.run(f"curl --cacert {certificates['ca_certificate']} --silent --output /dev/null --write-out '%{{http_code}}' https://{server_fqdn}/pub/") |
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'd suggest one more test here which checks the pub dir accessibility from http url
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.
It's not until #293 is done.
evgeni
left a comment
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.
tested using foremanctl-1.0.0-0.20251125064410703050.pr316.68.gb6dbef4.el9.noarch.rpm, works as expected.
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.
ACK, tested and it works as expected 🍏
|
Thanks everyone! |
This PR exposes /pub directory. it is a initial work around and currently only exposes
katello-server-ca.crt.