Red Hat Bugzilla – Bug 114152
rhnreg_ks fails when using proxy
Last modified: 2007-11-30 17:07:00 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4)
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
socket.error: (111, 'Connection refused'
Appears that code is incorrectly using port 80 instead of 8080
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1.run above command
up2date-4.0.1-1 version of rhnreg_ks works fine
is port 80 on the sattelite reachable?
aka, its trying to connect to 80 on whatever serverURL is
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.
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 -----
cfg = config.initUp2dateConfig()
s = socket.socket()
serverUrl = cfg['serverURL']
server = string.split(serverUrl, '/')
server_port = up2dateUtils.getProxySetting()
server = string.split(server_port, ':')
(intf, port) = s.getsockname()
hostname = socket.gethostbyaddr(intf)
# 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.
Created attachment 102276 [details]
Patch to hardware.py to use proxy port other than 80
Scrap that patch, this appears to be fixed by up2date-4.2.16-1.