Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RHEL-21049: [1.28] Fix issue with registration using gsd-subman #3367

Merged
merged 2 commits into from
Jan 16, 2024

Conversation

jirihnidek
Copy link
Contributor

  • Backport to 1.28 branch. Original PR: RHEL-15110: Fix issue with registration using gsd-subman #3350
  • Original commits:
  • We were too agresive, when we fixed CVE in this PR:
    2225443: [1.28] Hotfix of D-Bus policy #3318
  • It is still safe to allow non-root user to create abstract
    socket using Start() on interface com.redhat.RHSM1.RegisterServer
    and destroy it later using Stop(). This abstract socket
    could be later used by root user for calling e.g. Register()
    on interface com.redhat.RHSM1.Register. This is way how
    it works for gsd-subman (run by non-root user) and
    gsd-subman-helper (run by root user).
  • When some application starts RegisterServer using Start(),
    then it returns address. When this method is called multiple
    times and RegisterServer is still running, then the same
    address is returned. It means, when user starts multiple
    applications, then all of these applications should be able
    to use the same address to keep backward compatibility.
    The RegisterServer should be terminated only in the case,
    when the last application call Stop() and there is no running
    process using this RegisterServer.
  • This change does not allow to stop RegisterServer by some other
    user or application using Stop() method, when RegisterServer
    is still needed.
  • Non-root user can stop the RegisterServer only in the situation,
    when it is not needed by any application.
  • Implementation of Stop() method did not return anything explicitly,
    but the D-Bus method was designed to return boolean value. Thus,
    None object was interpreted as "False" value. It was fixed and it
    returns "True", when it was really stopped and it return "False",
    when it was not possible to stop it, because some application
    still uses RegisterServer.
  • It looks like that there was probably intention to use similar
    approach, but it has never been finished.
  • Modified some unit tests

* Backport to 1.28 branch. Original PR: #3350
  * Original commit: ba1e0e4
* We were too agresive, when we fixed CVE in this PR:
  #3318
* It is still safe to allow non-root user to create abstract
  socket using Start() on interface com.redhat.RHSM1.RegisterServer
  and destroy it later using Stop(). This abstract socket
  could be later used by root user for calling e.g. Register()
  on interface com.redhat.RHSM1.Register. This is way how
  it works for gsd-subman (run by non-root user) and
  gsd-subman-helper (run by root user).
* Backport to 1.28 branch. Original PR: 3350
  * Original commit: bc33776
* When some application starts RegisterServer using Start(),
  then it returns address. When this method is called multiple
  times and RegisterServer is still running, then the same
  address is returned. It means, when user starts multiple
  applications, then all of these applications should be able
  to use the same address to keep backward compatibility.
  The RegisterServer should be terminated only in the case,
  when the last application call Stop() and there is no running
  proccess using this RegisterServer.
* This change does not allow to stop RegisterServer by some other
  user or application using Stop() method, when RegisterServer
  is still needed.
* Non-root user can stop the RegisterServer only in the situation,
  when it is not needed by any application.
* Implementation of Stop() method did not return anything explicitly,
  but the D-Bus method was designed to return boolean value. Thus,
  None object was interpreted as "False" value. It was fixed and it
  returns "True", when it was really stoped and it return "False",
  when it was not possible to stop it, because some application
  still uses RegisterServer.
* It looks like that there was probably intention to use similar
  approach, but it has never been finished.
* Modified some unit tests
Copy link

Coverage

Coverage (computed on CentOS Stream 9) •
FileStmtsMissCoverMissing
rhsmlib/dbus
   dbus_utils.py1026635%38–44, 51–52, 54–57, 61–63, 65, 72–73, 75–79, 85–89, 96–97, 99–102, 104, 110, 114, 119, 121, 123, 125, 127, 135, 137, 139, 141, 144, 152, 162, 189, 193, 205, 207, 209, 211–213, 215–216, 218–219, 224–227
   server.py20912241%55–56, 68, 71–72, 74–79, 81–90, 92–93, 95–100, 102–104, 106–125, 127, 131, 135, 139, 143, 148, 155, 159, 166–174, 177–179, 186–188, 190, 198, 201, 203, 210–211, 213, 227, 230–233, 245–249, 272, 277–281, 285–289, 291–292, 294, 301, 340–341, 349–355, 357–359, 363, 386–387
rhsmlib/dbus/objects
   register.py1971592%97–98, 116, 119, 131, 134, 196, 198, 206, 216, 220, 223, 253, 344, 353
TOTAL22293926058% 

Tests Skipped Failures Errors Time
2368 11 💤 0 ❌ 0 🔥 42.196s ⏱️

@jirihnidek
Copy link
Contributor Author

Tested on RHEL8 workstation. Registration/Unregistration works with gsd-subman as expected.

@m-horky
Copy link
Contributor

m-horky commented Jan 16, 2024

LGTM. The patch matches the original one and I've verified the (un)registration GUI behaves as expected.

@m-horky m-horky merged commit c6a6cc1 into subscription-manager-1.28 Jan 16, 2024
11 checks passed
@m-horky m-horky deleted the jhnidek/1.28_rhel-21049 branch January 16, 2024 10:11
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.

2 participants