Bug 1708683 - Client payload upload not working through Sat6
Summary: Client payload upload not working through Sat6
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Hybrid Cloud Console (console.redhat.com)
Classification: Red Hat
Component: Client
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
urgent
Target Milestone: ---
: ---
Assignee: jcrafts
QA Contact: Pavol Kotvan
Kevin Blake
URL:
Whiteboard:
Depends On:
Blocks: 1122832
TreeView+ depends on / blocked
 
Reported: 2019-05-10 14:54 UTC by Peter Vreman
Modified: 2020-04-17 01:05 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-04-17 01:05:47 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Peter Vreman 2019-05-10 14:54:29 UTC
Description of problem:
Upload payload works when i reconfigure it to use direct access in insights-client.conf. But using Sat6 (6.2 and 6.5 tested) as proxy i get 404



Direct:
--------
2019-05-10 14:40:04,124    DEBUG insights.util.subproc Executing: [['timeout', '-s', '9', '30', '/usr/sbin/dmidecode', '-s', 'system-uuid']]
2019-05-10 14:40:04,130    DEBUG insights.util.subproc Executing: [['timeout', '-s', '9', '30', '/usr/bin/hostname', '-f']]
2019-05-10 14:40:04,135    DEBUG insights.client.connection Canonical facts collected:
{"display_name": "[crash/LI/IPS/Test-7.6-ci] li-lc-1441.hag.hilti.com", "bios_uuid": "4217d0d0-d0af-6972-9cb1-6df1053f6e5d", "ip_addresses": ["10.92.14.89", "10.92.65.49"], "fqdn": "li-lc-1441.hag.hilti.com", "mac_addresses": ["00:50:56:97:44:75", "00:50:56:97:00:80", "00:50:56:97:4b:9a", "00:00:00:00:00:00"], "subscription_manager_id": "bec5131d-c95e-4ee5-8eae-fa97340e0f54", "insights_id": "51e24be0-1745-41c0-99d4-9535bcb9a3e7", "machine_id": "2223c457-ccf6-46c0-9cc2-6f5e91415dd4"}
2019-05-10 14:40:04,135    DEBUG insights.client.connection Uploading /var/lib/insights/compliance-report-standard.xml to https://cert-api.access.redhat.com/r/insights/platform/ingress/v1/upload
2019-05-10 14:40:04,135     INFO network POST https://cert-api.access.redhat.com/r/insights/platform/ingress/v1/upload
2019-05-10 14:40:08,196    DEBUG insights.client.connection Upload status: 202 Accepted
2019-05-10 14:40:08,197    DEBUG insights.client.connection Request ID: e98790c7d3c745cc9a4a9426782978ba
2019-05-10 14:40:08,197    DEBUG insights.client.connection
2019-05-10 14:40:08,198    DEBUG insights.client.connection Upload duration: 0:00:04.045691
-------------

Exactly same command and content, but using Sat6 as base_url:
---------------
2019-05-10 14:53:24,731    DEBUG insights.util.subproc Executing: [['timeout', '-s', '9', '30', '/usr/bin/hostname', '-f']]
2019-05-10 14:53:24,735    DEBUG insights.client.connection Canonical facts collected:
{"display_name": "[crash/LI/IPS/Test-7.6-ci] li-lc-1441.hag.hilti.com", "bios_uuid": "4217d0d0-d0af-6972-9cb1-6df1053f6e5d", "ip_addresses": ["10.92.14.89", "10.92.65.49"], "fqdn": "li-lc-1441.hag.hilti.com", "mac_addresses": ["00:50:56:97:44:75", "00:50:56:97:00:80", "00:50:56:97:4b:9a", "00:00:00:00:00:00"], "subscription_manager_id": "bec5131d-c95e-4ee5-8eae-fa97340e0f54", "insights_id": "51e24be0-1745-41c0-99d4-9535bcb9a3e7", "machine_id": "2223c457-ccf6-46c0-9cc2-6f5e91415dd4"}
2019-05-10 14:53:24,735    DEBUG insights.client.connection Uploading /var/lib/insights/compliance-report-standard.xml to https://fibssat6sb.hag.hilti.com:443/redhat_access/r/insights/ingress/v1/upload
2019-05-10 14:53:24,735     INFO network POST https://fibssat6sb.hag.hilti.com:443/redhat_access/r/insights/ingress/v1/upload
2019-05-10 14:53:28,618    DEBUG insights.client.connection Upload status: 404 Not Found <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot POST /r/insights/ingress/v1/upload</pre>
</body>
</html>

2019-05-10 14:53:28,618    DEBUG insights.client.connection Request ID: None
2019-05-10 14:53:28,618    DEBUG insights.client.connection Upload archive failed with status code 404
2019-05-10 14:53:28,619    ERROR insights.client.client Upload attempt 1 of 1 failed! Status code: 404
--------------



Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Lindani Phiri 2019-05-10 14:58:48 UTC
Hello Peter,

What version of the Insights client (insights-client --version) are you running?

Lindani

Comment 2 Peter Vreman 2019-05-10 15:06:29 UTC
Tested both 3.0.97 and 3.0.87.

Only with 3.0.97 the direct to cert-api.access.redhat.com upload was working.

The reason why my standard version is still 3.0.87 is that 3.0.97 is broken for normal insights runs  when Sat6 is a proxy. I have already a case for it that issue no BZ

Comment 3 Djebran Lezzoum 2019-05-10 16:22:04 UTC
Can not reproduce with 
>> insights-client --version
Client: 3.0.3-9
Core: 3.0.97-1


1- installed insights-client 
2- registered host with insights-client >> insights-client --register
You successfully registered 60fe427b-b707-41d7-8e29-98c2569a7a3c to account 477931.
Successfully registered host iqe-satellite-test-dlezz-ottzsqenfp
Automatic scheduling for Insights has been enabled.
Starting to collect Insights data for iqe-satellite-test-dlezz-ottzsqenfp
Uploading Insights data.
Successfully uploaded report from iqe-satellite-test-dlezz-ottzsqenfp to account 477931.

host visible in cloud.redhat.com/insights/inventory

3- subscribe host to satellite and edit insights-client.conf base_url 
   with satellite url eg: base_url=satellite-hostname/redhat_access/r/insights , but not sure if we need to update this line , as it's works even without changes

4- run insights-client 

[root@iqe-satellite-test-dlezz-ottzsqenfp ~]# insights-client
Starting to collect Insights data for iqe-satellite-test-dlezz-ottzsqenfp
Uploading Insights data.
Successfully uploaded report from iqe-satellite-test-dlezz-ottzsqenfp to account 477931.

report successfully uploaded and host visible in satellite insights inventory

Comment 4 Peter Vreman 2019-06-15 10:06:51 UTC
Still an issue with Egg 3.0.12 and Satellite 6.5


To reproduce you to used the payload feature:


Reproducer:
1. sudo touch /var/lib/insights/compliance-report-standard.xml
2. sudo insights-client --payload /var/lib/insights/compliance-report-standard.xml --content-type application/vnd.redhat.compliance.something+tgz --verbose

Actaul Results:
-----
2019-06-15 10:05:04,588    DEBUG insights.client.connection Uploading /var/lib/insights/compliance-report-standard.xml to https://fibssat6sb.hag.hilti.com:443/redhat_access/r/insights/ingress/v1/upload
2019-06-15 10:05:06,243    DEBUG insights.client.connection Upload status: 404 Not Found <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot POST /r/insights/ingress/v1/upload</pre>
</body>
</html>

2019-06-15 10:05:06,245    DEBUG insights.client.connection Request ID: None
2019-06-15 10:05:06,245    DEBUG insights.client.connection Upload archive failed with status code 404
2019-06-15 10:05:06,245    ERROR insights.client.client Upload attempt 1 of 1 failed! Status code: 404
2019-06-15 10:05:06,245    ERROR insights.client.client All attempts to upload have failed!
2019-06-15 10:05:06,245    ERROR insights.client.client Please see /var/log/insights-client/insights-client.log for additional information
-----

Expected Results:
Success

Comment 5 Peter Vreman 2019-06-16 09:00:56 UTC
With auto_config=True it works, because then it appends /platform for non-legacy-upload to the base_url.

But with auto_config=False the /platform is not appended for non-legacy-upload

My Use case is that clients must always proxy through a controlled application (sat6 in the case of insights) and shall never connect to Internet directly for any service


Not working with payload, but working for regular upload
----------
[insights-client]
auto_config=False
authmethod=CERT
base_url=fibssat6sb.hag.hilti.com:443/redhat_access/r/insights
cert_verify=/etc/rhsm/ca/katello-server-ca.pem
----------

Working with payload, but not for normal upload
----------
[insights-client]
auto_config=False
authmethod=CERT
base_url=fibssat6sb.hag.hilti.com:443/redhat_access/r/insights/platform
cert_verify=/etc/rhsm/ca/katello-server-ca.pem
----------

Fixes:
- Appending of the /platform shall be moved out of the auth-config=true block to be also applied when auth-config=false
- Improve configuring the satellite host name to require only the satellite server/capsule name instead of custom url

Comment 6 Djebran Lezzoum 2019-06-20 15:11:58 UTC
Hi Peter,

Just tested with latest egg version 3.0.102 and seems the second scenario of your last comments is working.

config 
_______
auto_config=False
authmethod=CERT
base_url=SATELLITE-HOST:443/redhat_access/r/insights/platform
cert_verify=/etc/rhsm/ca/katello-server-ca.pem
_______
[root@iqe-satellite-test-dlezz-ewawoototj insights-client]# insights-client --version
Client: 3.0.3-9
Core: 3.0.102-1
[root@iqe-satellite-test-dlezz-ewawoototj insights-client]# insights-client
Starting to collect Insights data for iqe-satellite-test-dlezz-ewawoototj
Uploading Insights data.
Successfully uploaded report for iqe-satellite-test-dlezz-ewawoototj.
[root@iqe-satellite-test-dlezz-ewawoototj insights-client]# insights-client --payload /var/lib/insights/compliance-report-standard.xml --content-type application/vnd.redhat.compliance.something+tgz
Uploading Insights data.
Successfully uploaded report for iqe-satellite-test-dlezz-ewawoototj.
[root@iqe-satellite-test-dlezz-ewawoototj insights-client]# echo $INSIGHTS_LEGACY_UPLOAD
False
[root@iqe-satellite-test-dlezz-ewawoototj insights-client]# 

Can you confirm that it's working for you too?

Comment 7 Peter Vreman 2019-06-24 10:29:31 UTC
The normal uplaod does not work:


config:
----
[insights-client]
auto_config=False
authmethod=CERT
base_url=fibssat6sb.hag.hilti.com:443/redhat_access/r/insights/platform
cert_verify=/etc/rhsm/ca/katello-server-ca.pem
auto_update=False
display_name=[test/server1] testserver1.hag.hilti.com
----

----
$ sudo insights-client --version
Client: 3.0.3-3.el6
Core: 3.0.102-1
----


Result with display_name set:
----
2019-06-24 10:24:33,701     INFO network GET https://fibssat6sb.hag.hilti.com:443/redhat_access/r/insights/platform/v1/systems/aaaaaaaa-4409-41d4-b672-a100f6f0dff9
2019-06-24 10:24:34,476    ERROR insights.client.connection No JSON object could be decoded
----

Result without display_name set:
----
2019-06-24 10:27:16,864     INFO insights.client.connection === Begin Upload URL Connection Test ===
2019-06-24 10:27:16,864    DEBUG insights.client.connection Testing: https://fibssat6sb.hag.hilti.com:443/redhat_access/r/insights/platform/uploads/
2019-06-24 10:27:17,217     INFO insights.client.connection HTTP Status Code: 404
2019-06-24 10:27:17,217     INFO insights.client.connection HTTP Status Text: Not Found
2019-06-24 10:27:17,217     INFO insights.client.connection HTTP Response Text: <html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>openresty/1.13.6.1</center>
-----

Comment 9 Peter Vreman 2019-07-25 13:36:54 UTC
I have implemented a workaround for the payload upload to create a temp config file that appends the /platform:

-----
tmpconffile=$(mktemp)
sed 's+\(base_url.*insights\)$+\1/platform+' /etc/insights-client/insights-client.conf  > $tmpconffile
insights-client --conf $tmpconffile --payload $reportfile --content-type application/vnd.redhat.compliance.something+tgz"
rm -f $tmpconffile
-----


Note You need to log in before you can comment on or make changes to this bug.