-
Bug
-
Resolution: Done
-
Major
-
6.11.4
Description of problem:
The Global Registration feature works normally fine but after generating the curl command, If we change the URL to the common name of a capsule, The URL no longer works.
It worked fine on 6.9 and 6.10.
Version-Release number of selected component (if applicable):
Satellite 6.11 and 6.12 ( all versions )
How reproducible:
Always 100%
Steps to Reproduce:
1. Install a satellite 6.11 with fqdn sat611.example.com
2. Install a capsule 6.11 with fqdn cap611.example.com and cname capsule.example.com
3. Enable and sync a satellite clients repo for RHEL 7 in Satellite.
4. Sync Library env to the Capsule
5. Create an activation key by the name RHEL7 having Libray and Def Org View selected.
6. Generate the global registration command using hammer_cli or UI --> Hosts --> Register Hosts page while selecting Capsule server as the Capsule.
We will end up in an URL :
curl -sS --insecure 'https://cap611.example.com:9090/register?activation_keys=RHEL7&lifecycle_environment_id=1&location_id=2&organization_id=1&setup_insights=false&setup_remote_execution=false&update_packages=false' -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo0LCJpYXQiOjE2NzMwNjI0NjksImp0aSI6IjkzMGIxODQwMGI2Zjg5MjczNzA0ZTk2YzY3NmRjNmQ0NmI5ZmFmMjQ5ZTNhYTczMjgzYjg4MmMxMGU1ZjcyMWUiLCJleHAiOjE2NzMwOTQ4NjksInNjb3BlIjoicmVnaXN0cmF0aW9uI2dsb2JhbCByZWdpc3RyYXRpb24jaG9zdCJ9.mYXL-lMsVnIJ-nK2f3iFHDmc5frkSY2DE5m9XldT6cE' | bash
7. Replace cap611.example.com with capsule.example.com in the URL i.e.
curl -sS --insecure 'https://capsule.example.com:9090/register?activation_keys=RHEL7&lifecycle_environment_id=1&location_id=2&organization_id=1&setup_insights=false&setup_remote_execution=false&update_packages=false' -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo0LCJpYXQiOjE2NzMwNjI0NjksImp0aSI6IjkzMGIxODQwMGI2Zjg5MjczNzA0ZTk2YzY3NmRjNmQ0NmI5ZmFmMjQ5ZTNhYTczMjgzYjg4MmMxMGU1ZjcyMWUiLCJleHAiOjE2NzMwOTQ4NjksInNjb3BlIjoicmVnaXN0cmF0aW9uI2dsb2JhbCByZWdpc3RyYXRpb24jaG9zdCJ9.mYXL-lMsVnIJ-nK2f3iFHDmc5frkSY2DE5m9XldT6cE' | bash
8. In /etc/hosts of Satellite, Capsule and a RHEL 7 system, ensure to have the following entry:
<IP of capsule> cap611.example.com capsule.example.com
9. Run the modified curl command from Step 7 on the RHEL 7 client system,
Actual results:
On Client system:
~~
echo "ERROR: standard_error";
echo "ERF42-3243 [Foreman::Exception]: Capsule content source not found!";
exit 1
~~
In production.log of satellite:
2023-01-07T11:06:54 [I|app|7f6dbf8b] Started GET "/register?activation_keys=RHEL7&force=true&lifecycle_environment_id=1&location_id=2&organization_id=1&setup_insights=false&setup_remote_execution=false&update_packages=false&url=https%3A%2F%2Fcapsule.example.com%3A9090" for 10.74.195.240 at 2023-01-07 11:06:54 +0530
2023-01-07T11:06:54 [I|app|7f6dbf8b] Processing by Api::V2::RegistrationController#global as HTML
2023-01-07T11:06:54 [I|app|7f6dbf8b] Parameters: {"activation_keys"=>"RHEL7", "lifecycle_environment_id"=>"1", "location_id"=>"2", "organization_id"=>"1", "setup_insights"=>"false", "setup_remote_execution"=>"false", "update_packages"=>"false", "url"=>"https://capsule.example.com:9090", "registration"=>{}}
2023-01-07T11:06:54 [I|app|7f6dbf8b] Authorized user admin(Admin User)
2023-01-07T11:06:54 [W|app|7f6dbf8b] Action failed
2023-01-07T11:06:54 [I|app|7f6dbf8b] Backtrace for 'Action failed' error (Foreman::Exception): ERF42-3243 [Foreman::Exception]: Capsule content source not found!
7f6dbf8b | /usr/share/gems/gems/katello-4.3.0.50/app/controllers/katello/concerns/api/v2/registration_controller_extensions.rb:40:in `smart_proxy'
7f6dbf8b | /usr/share/gems/gems/katello-4.3.0.50/app/controllers/katello/concerns/api/v2/registration_controller_extensions.rb:31:in `context_urls'
7f6dbf8b | /usr/share/foreman/app/controllers/concerns/foreman/controller/registration.rb:41:in `global_registration_vars'
Expected results:
No such errors and We should be able to use the CNAME or SAN of the Capsule server.
Additional info:
- It works fine on 6.9 and 6.10 but fails on 6.11 and 6.12
- Failure happens here: https://github.com/Katello/katello/blob/KATELLO-4.3/app/controllers/katello/concerns/api/v2/registration_controller_extensions.rb#L36-L44
- I understand that It worked before in 6.9 or 6.10 as registration_controller_extensions.rb did not have any checks in place to find or validate the smart-proxy. And Yes, We never really officially said that, CNAME\SAN would work with Gloabal Registration.
- Once the rhsm helper was introduced via https://projects.theforeman.org/issues/32841 and PR https://github.com/Katello/katello/pull/9417 in Satellite 6.11, That caused the issue for both 6.11 and 6.12.
- With the implementation of https://projects.theforeman.org/issues/35627 ( and related fixes ), The Foreman 3.5.1 ( Satellite 6.13 ) works fine.