Bug 1108740 - Need to set restrict_registered_puppetmasters=false in foreman settings under auth in order for puppet runs to succeed on EL7
Summary: Need to set restrict_registered_puppetmasters=false in foreman settings under...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Foreman Proxy
Version: 6.0.3
Hardware: Unspecified
OS: Linux
unspecified
high
Target Milestone: Unspecified
Assignee: orabin
QA Contact: Corey Welton
URL: http://projects.theforeman.org/issues...
Whiteboard:
: 1131223 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-06-12 13:54 UTC by Jason Montleon
Modified: 2019-09-25 20:48 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-09-11 12:21:04 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 6205 0 Normal Closed Custom SSL client cert for smart proxy based auth doesn't split CN correctly 2020-05-14 02:17:46 UTC

Description Jason Montleon 2014-06-12 13:54:03 UTC
Description of problem:
When testing the RHEL 7 compose of Satellite 6 I need to set restrict_registered_puppetmasters=false in foreman settings under auth in order for puppet runs to succeed. This is not happening on RHEL 6 composes.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. yum -y install katello on a RHEL 7 system
2. katello-installer; export FORWARDERS=$(for i in $(cat /etc/resolv.conf |grep nameserver|awk '{print $2}'); do echo --capsule-dns-forwarders $i;done) && export OAUTH_SECRET=$(grep oauth_consumer_secret /etc/foreman/settings.yaml | cut -d ' ' -f 2) && katello-installer --capsule-parent-fqdn $(hostname) --capsule-dns true $FORWARDERS --capsule-dns-interface eth0 --capsule-dns-zone katellolabs.org --capsule-dhcp true --capsule-dhcp-interface eth0 --capsule-tftp true --capsule-puppet true --capsule-puppetca true --capsule-register-in-foreman true --capsule-foreman-oauth-secret $OAUTH_SECRET

Actual results:
after the install running puppet agent --test fails repeatedly

Expected results:
puppet agent --test runs normally

Additional info:

Comment 1 RHEL Program Management 2014-06-12 14:08:19 UTC
Since this issue was entered in Red Hat Bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

Comment 3 Jason Montleon 2014-06-12 20:15:24 UTC
in app/controllers/concerns/foreman/controller/smart_proxy_auth.rb

dn is evaluating with this format on RHEL 6:
/C=US/ST=North Carolina/O=FOREMAN/OU=PUPPET/CN=satellite1.montleon.intra

but on RHEL 7 it is coming up as:
CN=satellite2.montleon.intra,OU=PUPPET,O=FOREMAN,ST=North Carolina,C=US

so on:
https://github.com/theforeman/foreman/blob/develop/app/controllers/concerns/foreman/controller/smart_proxy_auth.rb#L44

this is causing $1 one from the match above to be:
"satellite2.montleon.intra,OU=PUPPET,O=FOREMAN,ST=North"

by changing request_hosts = [$1] to request_hosts = [$1.gsub(/,(\S+)/i, '')] it seems to work around the issue

Comment 4 Andrew N 2014-07-14 18:55:37 UTC
I'm trying to get Foreman installed at a client site and have been running into the above bug, but for different reasons.  If you generate the PKI certs on windows, it will use "/" as the separation character.

if https://github.com/theforeman/foreman/blob/develop/app/controllers/concerns/foreman/controller/smart_proxy_auth.rb#L41  is changed to the string below, the parse works for SSL certs which use "/" and "," as the separator.

dn =~ /CN=([^\s\/,]+)/i

Comment 5 Andrew N 2014-07-14 19:04:59 UTC
I'm trying to get Foreman installed at a client site and have been running into the above bug, but for different reasons.  If you generate the PKI certs on windows, it will use "/" as the separation character.  In addition the default regex will not pull only the CN entry, but anything after the CN as well.  This was causing strange errors like the following:

/var/log/foreman/production.log:No smart proxy server found on ["foreman.linux.lab.local/emailAddress=user"] and is not in trusted_puppetmaster_hosts

The DN for the cert in question which was signed by a Windows CA is:
"/C=US/ST=NC/L=City/O=Example/OU=IT/CN=foreman.linux.lab.local/emailAddress=user"

if https://github.com/theforeman/foreman/blob/develop/app/controllers/concerns/foreman/controller/smart_proxy_auth.rb#L41  is changed to the string below, the parse works for SSL certs which use "/" and "," as the separator.

dn =~ /CN=([^\s\/,]+)/i

Comment 6 Bryan Kearney 2014-08-12 12:48:25 UTC
Upstream bug assigned to orabin

Comment 7 Bryan Kearney 2014-08-15 16:02:40 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/6205 has been closed
-------------
Andrew N
I'm trying to get Foreman installed at a client site and have been running into the above bug, but for different reasons.  If you generate the PKI certs on windows, it will use "/" as the separation character.  In addition the default regex will not pull only the CN entry, but anything after the CN as well.  This was causing strange errors like the following:

<pre>
/var/log/foreman/production.log:No smart proxy server found on ["foreman.linux.lab.local/emailAddress=user"] and is not in trusted_puppetmaster_hosts
</pre>

The DN for the cert in question which was signed by a Windows CA is:
<pre>
"/C=US/ST=NC/L=City/O=Example/OU=IT/CN=foreman.linux.lab.local/emailAddress=user"

</pre>
if https://github.com/theforeman/foreman/blob/develop/app/controllers/concerns/foreman/controller/smart_proxy_auth.rb#L41  is changed to the string below, the parse works for SSL certs which use "/" and "," as the separator.

<pre><code class="ruby">
dn =~ /CN=([^\s\/,]+)/i
</code></pre>
-------------
Andrew N
Applied in changeset commit:2821b5e250d2f311e2070c41879720f8745507cf.

Comment 8 Og Maciel 2014-08-18 18:03:24 UTC
*** Bug 1131223 has been marked as a duplicate of this bug. ***

Comment 15 Corey Welton 2014-09-02 14:58:39 UTC
Verified in Satellite-6.0.4-RHEL-7-20140829.0

Comment 16 Bryan Kearney 2014-09-11 12:21:04 UTC
This was delivered with Satellite 6.0 which was released on 10 September 2014.


Note You need to log in before you can comment on or make changes to this bug.