Bug 730744

Summary: can not register using serverURL=https://... when on IPv6
Product: Red Hat Enterprise Linux 6 Reporter: Milan Zázrivec <mzazrivec>
Component: rhnlibAssignee: Milan Zázrivec <mzazrivec>
Status: CLOSED ERRATA QA Contact: Martin Minar <mminar>
Severity: medium Docs Contact:
Priority: low    
Version: 6.1CC: cperry, jhutar, jpazdziora, mkoci, mminar, msuchy, msvoboda
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rhnlib-2.5.22-12.el6 Doc Type: Bug Fix
Doc Text:
Prior to this update, programs that used rhnlib were not able to connect to RHN or RHN Satellite using an IPv6 address. The code has been modified to correct this issue, and rhnlib-based applications are now able to connect to RHN or RHN Satellite without any problems with IPv6 address resolution.
Story Points: ---
Clone Of: 665026 Environment:
Last Closed: 2011-12-06 16:50:11 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 665026    
Bug Blocks: 487666    

Description Milan Zázrivec 2011-08-15 15:28:42 UTC
+++ This bug was initially created as a clone of Bug #665026 +++

Description of problem:
My RHEL5 client is connected to Sat540@RHEL5 using IPv6 and when I try to
rhnreg_ks it with serverURL=https://..., I get traceback saying "Name or service not known".


Version-Release number of selected component (if applicable):
RHN Satellite 5.4.0
rhn-client-tools-0.4.20-46.el5
rhnlib-2.5.22-5.el5


How reproducible:
always on my system


Steps to Reproduce:
1. Have RHEL5 client configured to register to Sat540@RHEL5 using IPv6
   # dig -6 +short ibm-hs22-04.rhts.eng.brq.redhat.com AAAA
   feee:1337::e25f
   # ping6 -c 1 ibm-hs22-04.rhts.eng.brq.redhat.com
   PING ibm-hs22-04.rhts.eng.brq.redhat.com(feee:1337::e25f) 56 data bytes
   64 bytes from feee:1337::e25f: icmp_seq=0 ttl=64 time=0.253 ms
   --- ibm-hs22-04.rhts.eng.brq.redhat.com ping statistics ---
   1 packets transmitted, 1 received, 0% packet loss, time 0ms
   rtt min/avg/max/mdev = 0.253/0.253/0.253/0.000 ms, pipe 2
   # grep serverURL= /etc/sysconfig/rhn/up2date 
   serverURL=https://ibm-hs22-04.rhts.eng.brq.redhat.com/XMLRPC
2. # rhnreg_ks --force --username=admin --password=admin -vvv


Actual results:
# rhnreg_ks --force --username=admin --password=admin -vvv
A socket error occurred: (-2, 'Name or service not known'), attempt #1
A socket error occurred: (-2, 'Name or service not known'), attempt #2
A socket error occurred: (-2, 'Name or service not known'), attempt #3
A socket error occurred: (-2, 'Name or service not known'), attempt #4
A socket error occurred: (-2, 'Name or service not known'), attempt #5
An error has occurred:
Name or service not known
Error communicating with server. The message was:
Name or service not known
See /var/log/up2date for more information
# tail -n 26 /var/log/up2date
[Wed Dec 22 08:23:34 2010] up2date A socket error occurred: (-2, 'Name or service not known'), attempt #1
[Wed Dec 22 08:23:39 2010] up2date A socket error occurred: (-2, 'Name or service not known'), attempt #2
[Wed Dec 22 08:23:44 2010] up2date A socket error occurred: (-2, 'Name or service not known'), attempt #3
[Wed Dec 22 08:23:49 2010] up2date A socket error occurred: (-2, 'Name or service not known'), attempt #4
[Wed Dec 22 08:23:54 2010] up2date A socket error occurred: (-2, 'Name or service not known'), attempt #5
[Wed Dec 22 08:23:54 2010] up2date Error communicating with server. The message was:
Name or service not known
[Wed Dec 22 08:23:54 2010] up2date 
Traceback (most recent call last):
  File "/usr/sbin/rhnreg_ks", line 216, in ?
    cli.run()
  File "/usr/share/rhn/up2date_client/rhncli.py", line 65, in run
    sys.exit(self.main() or 0)
  File "/usr/sbin/rhnreg_ks", line 90, in main
    rhnreg.getCaps()
  File "/usr/share/rhn/up2date_client/rhnreg.py", line 281, in getCaps
    s.capabilities.validate()
  File "/usr/share/rhn/up2date_client/rhnserver.py", line 156, in __get_capabilities
    self.registration.welcome_message()
  File "/usr/share/rhn/up2date_client/rhnserver.py", line 50, in __call__
    return rpcServer.doCall(method, *args, **kwargs)
  File "/usr/share/rhn/up2date_client/rpcServer.py", line 214, in doCall
    raise up2dateErrors.CommunicationError(e.args[1])
up2date_client.up2dateErrors.CommunicationError: Error communicating with server. The message was:
Name or service not known


Expected results:
Should work

--- Additional comment from jhutar on 2010-12-22 08:39:54 EST ---

I was able to get further (to another error) using this:

# diff -u /usr/lib/python2.4/site-packages/rhn/connections.py{.ORIG,}
--- /usr/lib/python2.4/site-packages/rhn/connections.py.ORIG	2010-12-22 07:42:46.000000000 -0500
+++ /usr/lib/python2.4/site-packages/rhn/connections.py	2010-12-22 08:28:31.000000000 -0500
@@ -188,7 +188,7 @@
     def connect(self):
         "Connect to a host on a given (SSL) port"
         import socket
-        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+        sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
         sock.settimeout(SSL.DEFAULT_TIMEOUT)
         sock.connect((self.host, self.port))
         self.sock = SSL.SSLSocket(sock, self.trusted_certs)

After applying that I see what is already reported as bug 665013.

--- Additional comment from jhutar on 2011-01-21 06:03:07 EST ---

I see same issue on RHEL4 (test05-64.rhndev.redhat.com):

  up2date-4.8.1-33.el4
  rhnlib-2.1.4-7.el4

and on RHEL6 (test02-64.rhndev.redhat.com):

  rhn-client-tools-1.0.0-38.el6.noarch
  rhnlib-2.5.22-9.el6.noarch

Same fix as in comment #1 fixed issue for me and I was able to register (no additional issues popped up on RHEL4, on RHEL6 I had to use --nohardware workaround).

--- Additional comment from jhutar on 2011-01-25 03:46:35 EST ---

Now on RHEL4 I have updated up2date and rhnlib and I see that problem as well:

up2date-4.9.1-29.el4
rhnlib-2.1.4-17.el4_8.1

--- Additional comment from mzazrivec on 2011-06-23 05:44:10 EDT ---

Created attachment 506169 [details]
patch for connections.py

Comment 1 Milan Zázrivec 2011-08-16 13:25:07 UTC
spacewalk.git master: 1f67aa02da52c26d4954df3740227fcfe5d5949c
satellite.git CLIENT-RHEL-6: e52bd4ad6188b6cfc153a7771f383fd72b85c3bf

Comment 2 Milan Zázrivec 2011-08-16 13:35:11 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause: Bug / deficiency in rhnlib code.

Consequence: Programs using rhnlib wouldn't be able to connect to a parent using an IPv6 address.

Fix: Quite easy.

Result: Programs based on rhnlib will be able to connect to a parent using an IPv6 address.

Comment 5 Miroslav Svoboda 2011-08-26 11:51:38 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1,7 +1 @@
-Cause: Bug / deficiency in rhnlib code.
+Prior to this update, programs that used rhnlib were not able to connect to RHN or RHN Satellite using an IPv6 address. The code has been modified to correct this issue, and rhnlib-based applications are now able to connect to RHN or RHN Satellite without any problems with IPv6 address resolution.-
-Consequence: Programs using rhnlib wouldn't be able to connect to a parent using an IPv6 address.
-
-Fix: Quite easy.
-
-Result: Programs based on rhnlib will be able to connect to a parent using an IPv6 address.

Comment 6 errata-xmlrpc 2011-12-06 16:50:11 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2011-1665.html