Register ubuntu host

Hi

I followed the wiki on the link http://apt.atix.de/ to register a ubuntu 20.04 to Foreman / Katello 2.3.3

all worked fine until the last command to register as stating in the wiki

" You can now run subscription-manager register --org="my-organization" --name="my-host.example.com" --activationkey="my-activation-key" to subscribe your host to Foreman."

When trying to register I get the message saying “HTTP error (400 - Bad Request): Organization Default_Organization does not exist”

I know that i have 3 organizations (the default and 2 customs)

When i type on the formenan server command

" hammer organization list" it does not show any existing organization

root@foreman1 ~]# hammer organization list

—|-------|------|-------------|------

ID | TITLE | NAME | DESCRIPTION | LABEL

—|-------|------|-------------|------

[root@foreman1 ~]#

How can make one on my custom organization as default ?

How can i fix this issue to get the host register ?
Thanks,

I am not sure if this is really a subscription manager issue, or if something is odd about the organizations/locations on the Foreman instance.

Do you know if this affects all operating systems, or just Ubuntu and Debian?

I does not affect all operating systems as all work fine with CentOS

The command “hammer defaults list” is showing the following the result down here, but the subscription-manager command with the organization Avancie ends up with the same error “HTTP error (400 - Bad Request): Organization Default_Organization does not exist””
-------------|--------

PARAMETER VALUE
organization Avancie
location Anjou
------------- --------

[root@foreman1 ~]#

Hi,
did you specify an existing organization in the subscription-manager register command? (Probably the same way like for CentOS)

My first guess would be that your subscription-manager config is incorrect. Could you check in /etc/rhsm/rhsm.conf that your foreman/katello is mentioned as server? If not then it tries to connect to redhat where your organization probably does not exist.
If that is the case something went wrong when you configured the subscription-manager with the certificates. This is the step where you install the katello-consumer-package (rpm) for CentOS - for Ubuntu this step is performed with a bashscript (katello-rhsm-consumer).

Hi,

You guessed right, as some information was missing from the file /etc/rhsm/rhsm.conf file

  1. I corrected the server name form the redhat url to the foreman server’s url
  2. I corrected the Content base URL to: as follow
    baseurl = https://foremanserver.example.com/pulp/repos
  3. When I try registering, I get a certificate error message saying "
    Unable to verify server’s identity: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1123)"
    I maybe missing the certificate part, but it is not mentioned in the wiki A followed on from the link http://apt.atix.de/.
    I that case how can fixe the certificate issue ?
    Here is a part of the log /var/log/rhsm/rhsm.log

self.connect()
File “/usr/lib/python3.8/http/client.py”, line 1424, in connect
self.sock = self._context.wrap_socket(self.sock,
File “/usr/lib/python3.8/ssl.py”, line 500, in wrap_socket
return self.sslsocket_class._create(
File “/usr/lib/python3.8/ssl.py”, line 1040, in _create
self.do_handshake()
File “/usr/lib/python3.8/ssl.py”, line 1309, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1123)

1 Like

Hi,
if you look at the pub-folder of your foreman (https:///pub/) you should see several files.
There is katello-ca-consumer-latest.noarch.rpm, which installs the certificates and configures the subscription-manager for rpm-based distros (like CentOS).
But there should also be katello-rhsm-consumer without an ending. If you open this file with an editor, you can see that this is a bashscript - it performs the same steps like the rpm-package but for Debian and Ubuntu. So you need to download this script to your client and run it to install the certificates (and to configure the rhsm.conf).
At http://apt.atix.de this is the corresponding part:

Ensure to add the Katello CA to your managed hosts as follows:

`wget --no-check-certificate -O katello-rhsm-consumer https://foreman.example.com/pub/katello-rhsm-consumer`

`/bin/bash -x katello-rhsm-consumer 2< /root/katello-rhsm-consumer.log

If you did perform this step, check if there was an error somewhere.

1 Like

Hi
Thank you for your help.
In my case the katello-rhsm-consumer is located in the /var/www/html/pub/
Here is the listing of files located in the pub folder

From the Ubuntu 20.4 client if I issue the commands:

  1. wget --no-check-certificate -O katello-rhsm-consumer
    https://foreman.example.com /var/www/html/pub/katello-rhsm-consumer /bin/bash -x katello-rhsm-consumer 2< /root/katello-rhsm-consumer.log
    It downloads the file katello-rhsm-consumer and log files are empty.
  2. I if I do only the part of the command:
  3. “wget --no-check-certificate -O katello-rhsm-consumer https://foreman1.intra.avancie.com/var/www/html/pub/katello-rhsm-consumer”, I got the following: then the katello-rhsm-consumer file is downloaded but empty

“Resolving foreman.example.com (foreman.example.com)… 10.1.42.63
Connecting to foreman.example.com (foreman.example.com)|10.1.42.63|:443… connected.
WARNING: cannot verify foreman.example.com’s certificate, issued by ‘CN=foreman.example.com,OU=SomeOrgUnit,O=Katello,L=Raleigh,ST=North Carolina,C=US’:
Self-signed certificate encountered.
HTTP request sent, awaiting response… 404 Not Found
2021-04-27 15:41:28 ERROR 404: Not Found.”

Hi,
I Tried another way and got it working

I manually downloaded the katello-rhsm-consumer to the ubuntu server and made it executable with the chomod +x command and then runned it with no error message.
The registration worked this time.
Thank you very much; I have two questions.

  1. Form the Foreman web interface if I navigate through Host >> Contents Hosts >> I see a list of all registered hots including the new Ubuntu 20.04 I just added.
    In the 3rd Colum under “Installable Update” I can see 475 available rpm files for CentOS servers but none for the Ubuntu server; however, I have deb package available and If check under “Contents >> Deb Packages I see 1066 Deb files in
    Question: How can I make the deb packages available to the Ubuntu server?
  2. May I use the same process to add Ubuntu 18.04 servers to Foreman?

The process for updating deb packages should be the same as for RPM packages. (i.e. make sure your host has access to the relevant content views etc.) There are several places in the Katello UI were RPM packages are displayed, but Debian packages are not displayed. These are generally just UI/display issues, the Debian packages are nevertheless available. (We hope to make everything equal eventually). I am not 100% sure if what you are tripping over is such a display issue or something more.

The process is the same, but we do not publish a client for Ubuntu 18.04 at apt.atix.de
Generally speaking using the Ubuntu 20.04 client cannot be expected to work for other versions, but I have not tested that.

You mean something like that, I think:

You should have the installed packages under deb-packages → installed.
If the content view you provide has newer packages, you should see these packages under applicable packages as well.
If these are not available the package list is updated if you install, remove or upgrade a package via apt. If you do not want to make changes you also could run /usr/bin/package-profile-upload manually on the ubuntu-host. This corresponds to katello-package-upload on centos.

I guess the errata won’t be available for you, since this is not implemented in upstream katello as far as I know.

I thank you both for the answers, it is very appreciated.
We have a bunch of Ubuntu 18.04 production servers in our infrastructure; I was expecting to apply security updates on them through Katello.
Is there any other way to register Ubuntu 18.04 servers to the Katello server ?

Hey there i am trying to setup an ubuntu client in forman and running into a similar issue, I downloaded the katello-rhsm-consumer script and ran it.

root@ubuntu-client:~# ./katello-rhsm-consumer

  • KATELLO_SERVER=server1.example.com
  • PORT=443
  • KATELLO_SERVER_CA_CERT=katello-server-ca.pem
  • KATELLO_DEFAULT_CA_CERT=katello-default-ca.pem
  • CERT_DIR=/etc/rhsm/ca
  • PREFIX=/rhsm
  • CFG=/etc/rhsm/rhsm.conf
  • CFG_BACKUP=/etc/rhsm/rhsm.conf.kat-backup
  • CA_TRUST_ANCHORS=/etc/pki/ca-trust/source/anchors
  • read -r -d ‘’ KATELLO_DEFAULT_CA_DATA
  • true
  • read -r -d ‘’ KATELLO_SERVER_CA_DATA
  • true
  • test -f /etc/rhsm/rhsm.conf
  • type -P subscription-manager
  • type -P subscription-manager-cli
  • exit

Errata is not supported for Debian like systems . Only semi-proprietary solution from a custom vendor out there.