-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
redhat_subscription: use D-Bus for registration if possible #6122
redhat_subscription: use D-Bus for registration if possible #6122
Conversation
Opened as draft because I need to test it on more versions of RHEL, in few more scenarios. Regardless, having few more eyes on it wouldn't certainly hurt. |
This comment was marked as outdated.
This comment was marked as outdated.
34ee8da
to
15e0ab8
Compare
Docs Build 📝Thank you for contribution!✨ This PR has been merged and your docs changes will be incorporated when they are next published. |
lgtm - have you been able to try this with the rhc system role? If not, I can help with that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution! Could you please add a changelog fragment? Thanks!
66afc53
to
4530095
Compare
OK, after a bit of more in-depth testing, I think it should work fine in (hopefully :) ) all the cases.
Thanks, done; I wasn't sure whether it was needed in this case. If you want to do a more extensive review, please go ahead :)
Not yet, so far I've been testing directly the module itself. I think that, if you have a quick way to spawn all the testing of the rhc system role with this change applied for it, that'd be great! |
Sure. Copy the module .py file to rhc/library Then you can run locally, submit a PR and use CI testing, etc. |
4530095
to
ec7527f
Compare
subscription-manager currently does not have a way to get credentials (username, password, activation keys, organization ID) in a secure way: the existing command line parameters can be easily spotted when running a process listing while 'subscription-manager register' runs. There is a D-Bus service, which is used by e.g. cockpit and Anaconda to interface with RHSM (at least for registration and common queries). Try to perform the registration using D-Bus, in a way very similar to the work done in convert2rhel [1] (with my help): - try to do a simple signal test to check whether the system bus works; inspired by the login in the dconf module - pass most of the options as registration options; for the few that are not part of the registration, execute 'subscription-manager' manually - add quirks for differently working (or not) registration options for the D-Bus Register*() methods depending on the version of RHEL - 'subscription-manager register' is used only in case the signal test is not working; silent fallback in case of D-Bus errors during the registration is not done on purpose to avoid silent fallback to a less secure registration [1] oamg/convert2rhel#540
ec7527f
to
480ede9
Compare
So, I gave it more testing (and fixed small bits):
Hence, at this point I feel more confident that this should work fine. Of course, I can always fix bugs, in case they are noticed/reported. The only thing I'm not totally sure (and I simply followed what other Python modules do) is the logging using |
+1
No, you are correct, this is the way it is done. You use journalctl on the managed node to view the debug log. |
This fix lgtm - is it ready to be merged? If so, when can it be merged? |
It looks OK to me. If you and @ptoscano are happy I can merge this. |
My last changes (4 days ago) solved all the few issues I still saw, so currently I'm aware of none. Of course, I'm willing to fix any issue that show up after these changes. |
Thanks! |
Backport to stable-6: 💚 backport PR created✅ Backport PR branch: Backported as #6188 🤖 @patchback |
subscription-manager currently does not have a way to get credentials (username, password, activation keys, organization ID) in a secure way: the existing command line parameters can be easily spotted when running a process listing while 'subscription-manager register' runs. There is a D-Bus service, which is used by e.g. cockpit and Anaconda to interface with RHSM (at least for registration and common queries). Try to perform the registration using D-Bus, in a way very similar to the work done in convert2rhel [1] (with my help): - try to do a simple signal test to check whether the system bus works; inspired by the login in the dconf module - pass most of the options as registration options; for the few that are not part of the registration, execute 'subscription-manager' manually - add quirks for differently working (or not) registration options for the D-Bus Register*() methods depending on the version of RHEL - 'subscription-manager register' is used only in case the signal test is not working; silent fallback in case of D-Bus errors during the registration is not done on purpose to avoid silent fallback to a less secure registration [1] oamg/convert2rhel#540 (cherry picked from commit e939cd0)
… for registration if possible (#6188) redhat_subscription: use D-Bus for registration if possible (#6122) subscription-manager currently does not have a way to get credentials (username, password, activation keys, organization ID) in a secure way: the existing command line parameters can be easily spotted when running a process listing while 'subscription-manager register' runs. There is a D-Bus service, which is used by e.g. cockpit and Anaconda to interface with RHSM (at least for registration and common queries). Try to perform the registration using D-Bus, in a way very similar to the work done in convert2rhel [1] (with my help): - try to do a simple signal test to check whether the system bus works; inspired by the login in the dconf module - pass most of the options as registration options; for the few that are not part of the registration, execute 'subscription-manager' manually - add quirks for differently working (or not) registration options for the D-Bus Register*() methods depending on the version of RHEL - 'subscription-manager register' is used only in case the signal test is not working; silent fallback in case of D-Bus errors during the registration is not done on purpose to avoid silent fallback to a less secure registration [1] oamg/convert2rhel#540 (cherry picked from commit e939cd0) Co-authored-by: Pino Toscano <[email protected]>
SUMMARY
subscription-manager currently does not have a way to get credentials (username, password, activation keys, organization ID) in a secure way: the existing command line parameters can be easily spotted when running a process listing while 'subscription-manager register' runs. There is a D-Bus service, which is used by e.g. cockpit and Anaconda to interface with RHSM (at least for registration and common queries).
Try to perform the registration using D-Bus, in a way very similar to the work done in convert2rhel [1] (with my help):
Register*()
methods depending on the version of RHELsubscription-manager register
is used only in case the signal test is not working; silent fallback in case of D-Bus errors during the registration is not done on purpose to avoid silent fallback to a less secure registration[1] oamg/convert2rhel#540
ISSUE TYPE
COMPONENT NAME
redhat_subscription
ADDITIONAL INFORMATION
There should be no behaviour change for the module.