Bug 2128595

Summary: puppet_server_certname not used for defaults of foreman-proxy-puppet-ssl-key and foreman-proxy-puppet-ssl-cert
Product: Red Hat Satellite Reporter: Anand Kulkarni <ankulkar>
Component: PuppetAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED MIGRATED QA Contact: Satellite QE Team <sat-qe-bz-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.11.0CC: peter.vreman, rlavi
Target Milestone: UnspecifiedKeywords: MigratedToJIRA, Triaged, WorkAround
Target Release: Unused   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-06-06 12:34:44 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Anand Kulkarni 2022-09-21 08:28:09 UTC
Description of problem: puppet_server_certname not used for defaults of foreman-proxy-puppet-ssl-key and foreman-proxy-puppet-ssl-cert.

- Configure the Red Hat Satellite 6.11 to use a friendly CNAME for all URLs.

- On place where we see that the defaults are not inheriting the Certificate Name server is the Foreman-Proxy-Puppet part that is not inheriting the Puppet-Server-Certname value for the keys.

After setting puppet_server_certname to sat6.example.com the installer nicely generates the certificate files under that name:

~~~
# ls -l /etc/puppetlabs/puppet/ssl/certs/
total 8
-rw-r--r--. 1 puppet puppet 3866 Sep 15 07:37 ca.pem
-rw-r--r--. 1 puppet puppet 2061 Sep 15 07:37 sat6.example.com
~~~

- But later in the foreman-proxy it fails to load the files because it is still using the original FQDN based file:

~~~
2022-09-15T07:38:33  [W] Error details for Disabling all modules in the group ['puppet_proxy_puppet_api', 'puppet'] due to a failure in one of them: File at '/etc/puppetlabs/puppet/ssl/certs/satellite.example.com.pem' defined in 'puppet_ssl_cert' parameter doesn't exist or is unreadable: <Proxy::Error::ConfigurationError>: File at '/etc/puppetlabs/puppet/ssl/certs/satellite.example.com.pem' defined in 'puppet_ssl_cert' parameter doesn't exist or is unreadable
~~~

Version-Release number of selected component (if applicable): Red Hat Satellite 6.11


How reproducible: Yes.

Steps to Reproduce:

-Run satellite-installer --puppet_server_certname=sat6.example.com --reset-foreman-proxy-puppet-ssl-cert --reset-foreman-proxy-puppet-ssl-key

Actual results:
- The file '/etc/puppetlabs/puppet/ssl/certs/mysat6server.example.com.pem' is correctly created
- The proxy fails (can be seen in /var/log/foreman-proxy/proxy.log)  because it still tries to read /etc/puppetlabs/puppet/ssl/private_keys/<fqdn>.com.pem"
- 'satellite-installer --full-help | grep proxy-puppet-ssl'  still shows defaults with FQDN instead of the certname.


Expected results:

- The defaults for certificate file names use the configured 'certname'  value for which the installer is also generating the files.


Additional info:

The reason is that the installer has for the puppet ssl certificates 'hardcoded' the FQDN in the name, also for the default value to reset it:

~~~~
# satellite-installer --full-help | grep proxy-puppet-ssl
    --foreman-proxy-puppet-ssl-ca  SSL CA used to verify connections when accessing the Puppet master API (current: "/etc/puppetlabs/puppet/ssl/certs/ca.pem")
    --reset-foreman-proxy-puppet-ssl-ca Reset puppet_ssl_ca to the default value ("/etc/puppetlabs/puppet/ssl/certs/ca.pem")
    --foreman-proxy-puppet-ssl-cert  SSL certificate used when accessing the Puppet master API (current: "/etc/puppetlabs/puppet/ssl/certs/satellite.example.com.pem")
    --reset-foreman-proxy-puppet-ssl-cert Reset puppet_ssl_cert to the default value ("/etc/puppetlabs/puppet/ssl/certs/satellite.example.com.pem")
    --foreman-proxy-puppet-ssl-key  SSL private key used when accessing the Puppet master API (current: "/etc/puppetlabs/puppet/ssl/private_keys/satellite.example.com.pem")
    --reset-foreman-proxy-puppet-ssl-key Reset puppet_ssl_key to the default value ("/etc/puppetlabs/puppet/ssl/private_keys/satellite.example.com.pem")
~~~~

Workaround:
- Add manually the 'foreman-proxy-puppet-ssl-key' and 'foreman-proxy-puppet-ssl-cert' to the satellite-installer to configure the correct SSL files for foreman-proxy-puppet part

Comment 1 Eric Helms 2024-06-06 12:34:44 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "SAT-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.