Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 114152 - rhnreg_ks fails when using proxy
rhnreg_ks fails when using proxy
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: up2date (Show other bugs)
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Adrian Likins
Fanny Augustin
Depends On:
  Show dependency treegraph
Reported: 2004-01-23 05:40 EST by Ian Amess
Modified: 2007-11-30 17:07 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-08-24 18:27:33 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Patch to hardware.py to use proxy port other than 80 (577 bytes, patch)
2004-07-29 02:38 EDT, lok
no flags Details | Diff

  None (edit)
Description Ian Amess 2004-01-23 05:40:54 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4)
Gecko/20030624 Netscape/7.1

Description of problem:
The following rhnreg_ks command fails.

rhnreg_ks --force --activationkey="a valid activatin key"
Traceback (most recent call last):
  File "/usr/sbin/rhnreg_ks", line 326, in ?
  File "/usr/sbin/rhnreg_ks", line 281, in main
    hardwareList = hardware.Hardware()
  File "/usr/share/rhn/up2date_client/hardware.py", line 517, in Hardware
    ret = read_network()
  File "/usr/share/rhn/up2date_client/hardware.py", line 345, in
    hostname, ipaddr = findHostByRoute()
  File "/usr/share/rhn/up2date_client/hardware.py", line 320, in
    s.connect((server, 80))
socket.error: (111, 'Connection refused'

Appears that code is incorrectly using port 80 instead of 8080

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

How reproducible:

Steps to Reproduce:
1.run above command

Additional info:

up2date-4.0.1-1 version of rhnreg_ks works fine
Comment 1 Adrian Likins 2004-02-04 12:14:58 EST
is port 80 on the sattelite reachable?
Comment 2 Adrian Likins 2004-02-04 12:18:24 EST
aka, its trying to connect to 80 on whatever serverURL is
pointing at

Comment 3 Ian Amess 2004-02-04 12:28:43 EST
Port 80 is not reachable directly from the registering client that's
why I'm using a proxy. As I mentioned this works fine with rhnreg_ks
from up2date-4.0.1-1 package.
Comment 4 Steve Bonds 2004-04-13 19:32:40 EDT
This problem also exists running the interactive "up2date" or
"rhn_register" commands, not just rhnreg_ks.

Here is the problematic code:

----- /usr/share/rhn/up2date_client/hardware.py -----
def findHostByRoute():
    cfg = config.initUp2dateConfig()
    s = socket.socket()
    serverUrl = cfg['serverURL']
    server = string.split(serverUrl, '/')[2]
    if cfg['enableProxy']:
        server_port = up2dateUtils.getProxySetting()
        server = string.split(server_port, ':')[0]
    s.connect((server, 80))
    (intf, port) = s.getsockname()
        hostname = socket.gethostbyaddr(intf)[0]
    # I dislike generic excepts, but is the above fails
    # for any reason, were not going to be able to
    # find a good hostname....
        hostname = "unknown"
    return hostname, intf

the s.connect() call uses a hardcoded port 80 after explicitly
splitting off a user-supplied port.

I got mine to work through an authenticated proxy by harcoding the
correct port setting in the above s.connect() call.  It doesn't seem
like a patch that would work in all cases would be very difficult.

  -- Steve
Comment 5 lok 2004-07-29 02:38:32 EDT
Created attachment 102276 [details]
Patch to hardware.py to use proxy port other than 80
Comment 6 lok 2004-07-29 02:42:55 EDT
Scrap that patch, this appears to be fixed by up2date-4.2.16-1.

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