Bug 520648

Summary: Downloads from local RHN Satellite fail if "https_proxy" env. var. is set, even if yum is configured to use no proxy
Product: Red Hat Enterprise Linux 5 Reporter: Frank Danapfel <fdanapfe>
Component: yum-rhn-pluginAssignee: Milan Zázrivec <mzazrivec>
Status: CLOSED CANTFIX QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: medium Docs Contact:
Priority: low    
Version: 5.3CC: cperry, jhutar
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-12-17 16:07:21 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:

Description Frank Danapfel 2009-09-01 15:14:38 UTC
Description of problem:
All yum downloads are failing with an error "400 Bad request" when trying to update or install packages from a RHN Satellite on the same local network, if the environment variable "https_proxy" is set to some URL.

This happens even though "enableProxy=0" is specified in /etc/sysconfig/rhn/up2date, and even if the environment variable "no_proxy" contains the FQDN of the Satellite. yum.conf does not contain any proxy entries as well.


Version-Release number of selected component (if applicable):
yum-3.2.19-18.el5_3.1
yum-rhn-plugin-0.5.3-30.el5


How reproducible:
Always


Steps to Reproduce:
1. set "https_proxy" env.var. to proxy-URL 
2. set "no_proxy" env.var. to include FQDN of Satellite server
3. try to run "yum update" or "yum install <some package>"

  
Actual results:
[root.com ~]# env|grep -i proxy
http_proxy=http://proxy.example.com:8080/     
ftp_proxy=http://proxy.example.com:8080/      
https_proxy=http://proxy.example.com:8080/    
no_proxy=satellite.example.com,localhost,127.0.0.1

[root.com ~]# yum update
Loaded plugins: rhnplugin, security
Skipping security plugin, no data  
Setting up Update Process          
Resolving Dependencies             
Skipping security plugin, no data  
--> Running transaction check      
---> Package kernel-headers.ia64 0:2.6.18-128.7.1.el5 set to be updated
---> Package kernel.ia64 0:2.6.18-128.7.1.el5 set to be installed      
---> Package gnutls.ia64 0:1.4.1-3.el5_3.5 set to be updated
---> Package dnsmasq.ia64 0:2.45-1.1.el5_3 set to be updated
--> Finished Dependency Resolution
--> Running transaction check
---> Package kernel.ia64 0:2.6.18-128.el5 set to be erased
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================
 Package                               Arch                        Version                                   Repository                                 Size
=============================================================================================================================================================
Installing:
 kernel                                ia64                        2.6.18-128.7.1.el5                        rhel-ia64-server-5                         28 M
Updating:
 dnsmasq                               ia64                        2.45-1.1.el5_3                            rhel-ia64-server-5                        211 k
 gnutls                                ia64                        1.4.1-3.el5_3.5                           rhel-ia64-server-5                        498 k
 kernel-headers                        ia64                        2.6.18-128.7.1.el5                        rhel-ia64-server-5                        934 k
Removing:
 kernel                                ia64                        2.6.18-128.el5                            installed                                 211 M

Transaction Summary
=============================================================================================================================================================
Install      1 Package(s)
Update       3 Package(s)
Remove       1 Package(s)

Total download size: 29 M
Is this ok [y/N]: y
Downloading Packages:
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                        901 MB/s |  29 MB     00:00


Error Downloading Packages:
  kernel-headers-2.6.18-128.7.1.el5.ia64: failed to retrieve getPackage/kernel-headers-2.6.18-128.7.1.el5.ia64.rpm from rhel-ia64-server-5
error was [Errno 14] HTTP Error 400: Bad Request
  dnsmasq-2.45-1.1.el5_3.ia64: failed to retrieve getPackage/dnsmasq-2.45-1.1.el5_3.ia64.rpm from rhel-ia64-server-5
error was [Errno 14] HTTP Error 400: Bad Request
  gnutls-1.4.1-3.el5_3.5.ia64: failed to retrieve getPackage/gnutls-1.4.1-3.el5_3.5.ia64.rpm from rhel-ia64-server-5
error was [Errno 14] HTTP Error 400: Bad Request
  kernel-2.6.18-128.7.1.el5.ia64: failed to retrieve getPackage/kernel-2.6.18-128.7.1.el5.ia64.rpm from rhel-ia64-server-5
error was [Errno 14] HTTP Error 400: Bad Request

Expected results:
[root.com ~]# yum update
Loaded plugins: rhnplugin, security
Skipping security plugin, no data
Setting up Update Process
Resolving Dependencies
Skipping security plugin, no data
--> Running transaction check
---> Package kernel-headers.ia64 0:2.6.18-128.7.1.el5 set to be updated
---> Package kernel.ia64 0:2.6.18-128.7.1.el5 set to be installed
---> Package gnutls.ia64 0:1.4.1-3.el5_3.5 set to be updated
---> Package dnsmasq.ia64 0:2.45-1.1.el5_3 set to be updated
--> Finished Dependency Resolution
--> Running transaction check
---> Package kernel.ia64 0:2.6.18-128.el5 set to be erased
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================
 Package                               Arch                        Version                                   Repository                                 Size
=============================================================================================================================================================
Installing:
 kernel                                ia64                        2.6.18-128.7.1.el5                        rhel-ia64-server-5                         28 M
Updating:
 dnsmasq                               ia64                        2.45-1.1.el5_3                            rhel-ia64-server-5                        211 k
 gnutls                                ia64                        1.4.1-3.el5_3.5                           rhel-ia64-server-5                        498 k
 kernel-headers                        ia64                        2.6.18-128.7.1.el5                        rhel-ia64-server-5                        934 k
Removing:
 kernel                                ia64                        2.6.18-128.el5                            installed                                 211 M

Transaction Summary
=============================================================================================================================================================
Install      1 Package(s)
Update       3 Package(s)
Remove       1 Package(s)

Total download size: 29 M
Is this ok [y/N]: y
Downloading Packages:
(1/4): dnsmasq-2.45-1.1.el5_3.ia64.rpm                                                                                                | 211 kB     00:00
(2/4): gnutls-1.4.1-3.el5_3.5.ia64.rpm                                                                                                | 498 kB     00:00
(3/4): kernel-headers-2.6.18-128.7.1.el5.ia64.rpm                                                                                     | 934 kB     00:00
(4/4): kernel-2.6.18-128.7.1.el5.ia64.rpm                                                                                             |  28 MB     00:04
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                        5.5 MB/s |  29 MB     00:05
Running rpm_check_debug
...

Additional info:
Unsetting "https_proxy"right before calling yum ("https_proxy= ;yum update") solves the problem, but is only a workaround.

The Satellite Server is only accessible via HTTPS, normal HTTP access is disabled. 

Registration of clients and listing of available packages on Satellite works.

Comment 2 Milan Zázrivec 2009-12-17 16:07:21 UTC
yum-rhn-plugin is -- well -- a yum plugin that in case your machine is
registered to RHN / RHN Satellite adds few hooks to yum's workflow;
the most important hook will make yum think there are more yum repositories
to look at (channels your machine is subscribed into) when building
& executing a transaction.

Downloading packages from these repos (and doing the rest) is entirely
yum's job.

The proxy settings from /etc/sysconfig/rhn/up2date you're mentioning in the
initial comment won't have any effect on how yum downloads these packages.
These are in fact settings which utilities like rhn_register, rhnreg_ks,
rhn_check, etc. will use when doing network connections: all
the communication between client & RHN / RHN Satellite is XML-RPC and
we want to support environments in which you are required to use
an HTTP / HTTPS proxy of some sort to be able to connect to
RHN / RHN Satellite.

As far as I am concerned, yum uses urlgrabber & urllib2 when accessing
a yum repository. urllib2 does honor "https_proxy" variable, though it does
not honor "no_proxy". From this perspective, the problem you described
is in fact expected behavior of this library.

There is a patch for urllib2 which implements support for "no_proxy" [1],
but this is a new thing and it definitely is not part of RHEL-5.

[1] http://bugs.python.org/issue6894

Comment 3 Frank Danapfel 2009-12-18 13:00:23 UTC
Milan, thanks for the detailed explanation.

If this can't be fixed in RHEL 5 is there a chance that this will be fixed in RHEL 6?

Comment 4 Milan Zázrivec 2009-12-18 13:10:58 UTC
The problem with urllib2 honoring "no_proxy" env. variable could be fixed
(or backported) into some of the upcoming RHEL-5 update releases, as long
as there will be a bug opened against python for it and it will get approved ...

Though I don't maintain python package, so I can't really say for sure :)