Bug 2213899 - [RFE] Set custom User Agent for Pulpcore [NEEDINFO]
Summary: [RFE] Set custom User Agent for Pulpcore
Keywords:
Status: NEW
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Pulp
Version: 6.13.1
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: Satellite QE Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-06-09 19:39 UTC by Sam Lindberg
Modified: 2023-07-21 20:47 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Target Upstream Version:
Embargoed:
dalley: needinfo? (slindber)


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker SAT-18672 0 None None None 2023-06-28 12:53:15 UTC

Description Sam Lindberg 2023-06-09 19:39:25 UTC
Description of problem:
Connections from Pulpcore have a user agent header in their requests created from the Pulp version, the Python version, and aiohttp version. Certain network components have the ability to restrict requests by user agent fields. This request is to allow a user to set a custom user agent header value for Pulpcore to use.

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

python39-pulpcore-3.21.6-1.el8pc.noarch

satellite-6.13.1-1.el8sat.noarch

How reproducible:
N/A

Steps to Reproduce:
N/A

Actual results:
User agent field is defined in this file 
/usr/lib/python3.6/site-packages/pulpcore/download/factory.py, By the following function:

def user_agent():
        """
        Produce a User-Agent string to identify Pulp and relevant system info.
        """
        pulp_version = get_distribution("pulpcore").version
        python = "{} {}.{}.{}-{}{}".format(sys.implementation.name, *sys.version_info)
        uname = platform.uname()
        system = f"{uname.system} {uname.machine}"
        return f"pulpcore/{pulp_version} ({python}, {system}) (aiohttp {aiohttp_version})"

Expected results:
A settings value on Satellite to allow user to input a custom user agent string.

Additional info:
As a workaround to allow this to work replace the following line:
        return f"pulpcore/{pulp_version} ({python}, {system}) (aiohttp {aiohttp_version})"
with:
        return f"curl/7.61.1"

Comment 1 Daniel Alley 2023-07-17 16:59:28 UTC
What about disabling the UserAgent entirely, rather than using a false one?  Do those "network components" permit requests which lack UserAgent?


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