With the deprecation of /pub/katello-rhsm-consumer
script we need to find new ways to expose the functionality from Foreman server.
What is this script?
This script has two main tasks:
- Install Foreman’s CA certificate on the host
- Configure
subscription-manager
to use Foreman server to fetch content
When it was used?
Since the script was entirely public, we don’t really know where it was used. We identified a couple of use cases where the whole script or part of it was used though:
- While changing Foreman’s CA certificate (we actually need only part 1 of the script)
- While running Anaconda setup, where it needs to access content during the installation process
- After the host is provisioned it needs to access content from Foreman server.
Suggested change
Use case 3 is handled by global registration template for hosts that were not provisioned using Foreman at all.
Anaconda currently has a hard coded endpoint that is set up to query /pub/katello-rhsm-consumer
endpoint on Satellite, download the script and run it once in the installer context (use case 2) and then in the installed OS context (use case 3).
I am proposing a new template that will be accessible through our /unattended/:type/:id
endpoint. This template will be rendered and supply the same services as katello-rhsm-consumer
.
To make the endpoint available without authentication, we will need a new template type (anonymous
) that will remove authentication checks from the regular /unattended
endpoint. This will also make the endpoint available through HTTP access (as opposed to HTTPS), so it will be accessible even if Foreman’s CA cert is not trusted yet.
Additionally we will need to add Remote Execution wrapper that will run the script both by SSH and Ansible playbook.
To make sure we comply with Anaconda, we will need to make sure /pub/katello-rhsm-consumer
will either redirect or rewrite to /unattended/anonymous/register-katello
template.
PRs:
- Main PR that introduces the CA refresh template (and later on the second katello registration template) and the machinery needed to expose the template anonymously: Fixes #37601 - Add Foreman CA refresh template by ShimShtein · Pull Request #10208 · theforeman/foreman · GitHub
- REX SSH wrapper: Add a template that enables download and run of a script by ShimShtein · Pull Request #907 · theforeman/foreman_remote_execution · GitHub
- REX Ansible playbook wrapper: Add a template that enables download and execution of a script by ShimShtein · Pull Request #722 · theforeman/foreman_ansible · GitHub
Open discussions
- Do we need the template to be exposed for everyone, or do we want to restrict the template to hosts that are known to Foreman?
- Is it possible to make
/unattended/anonymous/katello-register
to be available through/pub/katello-rhsm-consumer
endpoint.
Any other thoughts are welcome