Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Description of problem:
Global Registration using an user with "Register Hosts" role ignores all the setup options.
Version-Release number of selected component (if applicable):
- Satellite 6.13.0
How reproducible:
- Everytime
Steps to Reproduce:
1. Create a user on the Satellite with Register Hosts role.
2. Using the new user, generate a global registration command with all the Setup options set to No.
3. Execute the command on the client.
Actual results:
- The parameters in the script.
~~~
# Rendered with following template parameters:
# User: [reg-user]
# Organization: [RedHat]
# Location: [Pune]
# Setup Insights: [false]
# Setup remote execution: [false]
# Setup remote execution pull: [false]
# Update packages: [false]
# Activation keys: [GENERAL]
~~~
- The register command in the script.
~~~
curl --silent --show-error --cacert $KATELLO_SERVER_CA_CERT --request POST "https://satellite.example.com/register" \
--data "uuid=$UUID" \
-H 'Authorization: Bearer XYZ \
--data 'host[organization_id]=1' \
--data 'host[location_id]=2' \
--data 'setup_insights=false' \
--data 'setup_remote_execution=false' \
--data 'setup_remote_execution_pull=false' \
--data 'update_packages=false'
~~~
- The script generated by this command still performs the setups that are set to No.
~~~
#!/bin/bash
set -e
echo "# Running [client-1.example.com] host initial configuration"
foreman_curl() {
curl --silent --show-error -o /dev/null --noproxy \* "$@"
}
exit_and_cancel_build() {
echo 'Host [client-1.example.com] initial configuration failed'
foreman_curl --request POST 'http://satellite.example.com/unattended/failed?token=XYZ' \
--data 'Host initial configuration failed, please see the registration log for more details.'
exit 1
}
set +e
trap 'exit_and_cancel_build' ERR
user_exists=false
getent passwd root >/dev/null 2>&1 && user_exists=true
if $user_exists; then
mkdir -p ~root/.ssh
cat << EOF >> ~root/.ssh/authorized_keys
ssh-rsa XYZ foreman-proxy.com
EOF
chmod 0700 ~root/.ssh
chmod 0600 ~root/.ssh/authorized_keys
chown -R root: ~root/.ssh
# Restore SELinux context with restorecon, if it's available:
command -v restorecon && restorecon -RvF ~root/.ssh || true
else
echo 'The remote_execution_ssh_user does not exist and remote_execution_create_user is not set to true. remote_execution_ssh_keys snippet will not install keys'
fi
echo '#'
echo '# Installing Insights client'
echo '#'
yum install -y insights-client
insights-client --register
if command -v subscription-manager &>/dev/null; then
echo "Refreshing subscription data"
subscription-manager refresh
fi
# Call home to exit build mode
trap - ERR
foreman_curl 'http://satellite.example.com/unattended/built?token=b91a860e-3a68-43f4-b345-95ca7ff41307'
if [[ $? == 0 ]] ; then
echo "Host [client-1.example.com] successfully configured."
else
echo "Host [client-1.example.com] successfully configured, but failed to set built status."
fi
subscription-manager facts --update
exit 0
~~~
- Here is the same script from the admin user.
~~~
# Rendered with following template parameters:
# User: [admin]
# Organization: [RedHat]
# Location: [Pune]
# Setup Insights: [false]
# Setup remote execution: [false]
# Setup remote execution pull: [false]
# Update packages: [false]
# Activation keys: [GENERAL]
~~~
~~~
#!/bin/bash
set -e
echo "# Running [client-2.example.com] host initial configuration"
foreman_curl() {
curl --silent --show-error -o /dev/null --noproxy \* "$@"
}
exit_and_cancel_build() {
echo 'Host [client-2.example.com] initial configuration failed'
foreman_curl --request POST 'http://satellite.example.com/unattended/failed?token=XYZ' \
--data 'Host initial configuration failed, please see the registration log for more details.'
exit 1
}
set +e
trap 'exit_and_cancel_build' ERR
if command -v subscription-manager &>/dev/null; then
echo "Refreshing subscription data"
subscription-manager refresh
fi
# Call home to exit build mode
trap - ERR
foreman_curl 'http://satellite.example.com/unattended/built?token=XYZ'
if [[ $? == 0 ]] ; then
echo "Host [client-2.example.com] successfully configured."
else
echo "Host [client-2.example.com] successfully configured, but failed to set built status."
fi
subscription-manager facts --update
exit 0
~~~
This excludes all the setups that are set to No.
Expected results:
- Script should not perform the setups that are set to No.
Verified.
Version Tested: Satellite 6.14 Snap 7.0
Verification Steps:
1. Enable the required repositories on the satellite and get a host(RHEL7/RHEL8/RHEL9)
2. Create a non-admin user and assign "Register Hosts" role to it.
3. Create an activation key and assign CV and LCE to it.
4. Login Satellite with new user and generate curl command to register host with all setup options set to NO.
5. Run the curl command on the host.
Result:
The script generated by this command skips the setups that are set to No.
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 (Important: Satellite 6.14 security and bug fix update), 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-2023:6818