Skip to content

Conversation

@arvind4501
Copy link
Contributor

@arvind4501 arvind4501 commented Nov 24, 2025

This PR exposes /pub directory. it is a initial work around and currently only exposes katello-server-ca.crt.

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
Copy link
Member

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

Copy link
Contributor Author

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

@evgeni
Copy link
Member

evgeni commented Nov 24, 2025

Ansible looks good to me. Can you please add a test to https://github.com/theforeman/foremanctl/blob/master/tests/httpd_test.py?

Comment on lines +54 to +59
- 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"
Copy link
Member

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.

Copy link
Member

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?

Copy link
Member

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.

Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

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)?

Copy link
Member

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.

@arvind4501
Copy link
Contributor Author

This PR currently exposes only katello-server-ca.crt. should the scope of PR be extended to katello-consumer-ca and rpm? or that is not required for now?

@evgeni
Copy link
Member

evgeni commented Nov 25, 2025

I'd keep the scope as is, we can add more later as we need

Comment on lines +45 to +46
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/")

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

Copy link
Member

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.

Comment on lines +45 to +46
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/")

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

Copy link
Member

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.

Copy link
Member

@evgeni evgeni left a 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.

Copy link

@Gauravtalreja1 Gauravtalreja1 left a 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 🍏

@evgeni
Copy link
Member

evgeni commented Nov 26, 2025

Thanks everyone!

@evgeni evgeni merged commit b8e6d5d into theforeman:master Nov 26, 2025
8 checks passed
@evgeni evgeni mentioned this pull request Nov 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants