Bug 1619533 - Upgrade katello-ca-consumer rpm will cause rhsm.conf to point back to customer portal.
Summary: Upgrade katello-ca-consumer rpm will cause rhsm.conf to point back to custome...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Registration
Version: 6.5.0
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: 6.7.0
Assignee: Justin Sherrill
QA Contact: Stephen Wadeley
URL:
Whiteboard:
: 1683835 1704984 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-08-21 06:56 UTC by Hao Chang Yu
Modified: 2023-09-07 19:18 UTC (History)
24 users (show)

Fixed In Version: foreman-installer-1.24.1.3-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1791503 (view as bug list)
Environment:
Last Closed: 2020-04-14 13:23:24 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 25683 0 Normal Closed Upgrade katello-ca-consumer rpm will cause rhsm.conf to point back to customer portal. 2021-02-08 15:24:46 UTC
Github theforeman puppet-certs pull 267 0 None closed Fixes #25683 - Do not run postun script if upgrading 2021-02-08 16:18:06 UTC
Red Hat Knowledge Base (Solution) 4392471 0 None None None 2019-11-07 08:49:51 UTC
Red Hat Product Errata RHSA-2020:1454 0 None None None 2020-04-14 13:23:37 UTC

Description Hao Chang Yu 2018-08-21 06:56:12 UTC
Description of problem:
I think this is the regression of Bug #1371585.

%postun will be triggered on upgrade and cause the rhsm.conf to restore back to default.

...
%postun
test -f /etc/rhsm/rhsm.conf.kat-backup && command cp /etc/rhsm/rhsm.conf.kat-backup /etc/rhsm/rhsm.conf   <========= move the backup rhsm.conf back
...


# rpm -Uvh katello-ca-consumer-lonlx80022.nomura.com-1.0-8.noarch.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:katello-ca-consumer-lonlx80022.no################################# [ 50%]
Cleaning up / removing...
   2:katello-ca-consumer-lonlx80022.no################################# [100%]  <=========== %postun will be triggered here

% egrep -i 'host|server' /etc/rhsm/rhsm.conf | egrep -v '^#'
[server]
hostname = subscription.rhsm.redhat.com

Comment 2 Andrew Kofink 2018-12-13 22:07:14 UTC
Created redmine issue https://projects.theforeman.org/issues/25683 from this bug

Comment 3 Michael Cronenworth 2019-06-04 00:25:27 UTC
Still present in Satellite 6.5. :(

Comment 5 Roman Bobek 2019-11-07 08:49:52 UTC
*** Bug 1704984 has been marked as a duplicate of this bug. ***

Comment 6 Rudnei Bertol Jr. 2019-12-17 13:18:11 UTC
Hey Team,

Any update? 

Is there any patch/hotfix or workaround?

regards
rbertol

Comment 7 Aaron Russo 2019-12-17 17:59:02 UTC
This is the updated postun scriptlet I proposed in my support case w/RH to get this fixed -- essentially it's only reverting if it's an actual removal and not during an upgrade situation:

```
%postun
if [ $1 -eq 0 ]; then
  test -f /etc/rhsm/rhsm.conf.kat-backup && command cp /etc/rhsm/rhsm.conf.kat-backup /etc/rhsm/rhsm.conf
fi
```

I didn't try to rebuild myself so I haven't verified this to work, but it seems like it should.

If you want to avoid re-building the package you could try setting the file immutable or better yet setup a yum post-transaction action to run /usr/bin/katello-rhsm-consumer to reconfigure the file whenever that package is updated.

Comment 8 Bryan Kearney 2020-01-03 17:04:56 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/25683 has been resolved.

Comment 10 Brad Buckingham 2020-01-28 13:35:42 UTC
*** Bug 1683835 has been marked as a duplicate of this bug. ***

Comment 15 errata-xmlrpc 2020-04-14 13:23:24 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2020:1454


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