Bug 114152 - rhnreg_ks fails when using proxy
Summary: rhnreg_ks fails when using proxy
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: up2date   
(Show other bugs)
Version: 3.0
Hardware: i686
OS: Linux
Target Milestone: ---
Assignee: Adrian Likins
QA Contact: Fanny Augustin
Depends On:
TreeView+ depends on / blocked
Reported: 2004-01-23 10:40 UTC by Ian Amess
Modified: 2007-11-30 22:07 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-08-24 22:27:33 UTC
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 06:38 UTC, lok
no flags Details | Diff

Description Ian Amess 2004-01-23 10:40:54 UTC
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 17:14:58 UTC
is port 80 on the sattelite reachable?

Comment 2 Adrian Likins 2004-02-04 17:18:24 UTC
aka, its trying to connect to 80 on whatever serverURL is
pointing at

Comment 3 Ian Amess 2004-02-04 17:28:43 UTC
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 23:32:40 UTC
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 06:38:32 UTC
Created attachment 102276 [details]
Patch to hardware.py to use proxy port other than 80

Comment 6 lok 2004-07-29 06:42:55 UTC
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.