[SOLVED] http_proxy setting no effect (yum)

Issues related to configuring your network

[SOLVED] http_proxy setting no effect (yum)

Postby jack » 2011/12/14 09:01:55

I am setting correctly for yum's proxy and proxy username and password, but still get HTTP Error 407. If I am right, HTTP Error 407 means need proxy auth.
(1)I have centos6 installed in Oracle virtualbox. the host is windows xp.
(2)I use bridged for centos6.
(3)Both windows xp and centos6 using proxy to connect to internet(our company using proxy
(4)I can open the www.centos.com via Firfox in centos6.

I have problem with the following command:

[root@localhost ~]# yum install telnet-server

the result:

Loaded plugins: fastestmirror, refresh-packagekit
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6 ... 86&repo=os error was
14: HTTP Error 407 : http://mirrorlist.centos.org/?release=6 ... 86&repo=os
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6 ... epo=extras error was
14: HTTP Error 407 : http://mirrorlist.centos.org/?release=6 ... epo=extras
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6 ... po=updates error was
14: HTTP Error 407 : http://mirrorlist.centos.org/?release=6 ... po=updates
http://mirror.ta139.com/centos/6.1/os/i ... repomd.xml: [Errno 14] HTTP Error 407 : http://mirror.ta139.com/centos/6.1/os/i ... repomd.xml
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again

the /root/.bash_profile

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc

# User specific environment and startup programs


export PATH

http_proxy="http://London\Tom Yang:Password1234x@"
export http_proxy

the file /etc/yum.repos.d/CentOS-Base.repo

# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.

name=Cent-OS-$releasever - Base

#released updates
name=CentOS-$releasever - Updates

#additional packages that may be useful
name=CentOS-$releasever - Extras

#additional packages that extend functionality of existing packages
name=CentOS-$releasever - Plus

#contrib - packages by Centos Users
name=CentOS-$releasever - Contrib

the file /etc/yum.conf

#proxy_username=London\Tom Yang

# This is the default, if you make this bigger yum won't see if the metadata
# is newer on the remote and so you'll "gain" the bandwidth of not having to
# download the new metadata and "pay" for it by yum not having correct
# information.
# It is esp. important, to have correct metadata, for distributions like
# Fedora which don't keep old packages around. If you don't like this checking

the file /etc/resolv.conf

# Generated by NetworkManager
domain shanghai.lom.com
search shanghai.lom.com
nameserver #this line is added by me

I search the internet, HTTP Error 407 means need proxy auth, but I have offered correct name and password.
The name is: London\Tom Yang, there is a space between Tom and Yang, and also there is London\ prefix, is this cause the auth failed?
but when I open page in the Firefox, I put the same username and password, it auth is ok and the request page opened.

Anyone can help me?

Thanks a lot.
Posts: 3
Joined: 2011/12/14 08:10:16
Location: Shanghai

Re: http_proxy setting no effect (yum)

Postby r_hartman » 2011/12/14 09:42:08

Welcome to the CentOS fora.

I found that in CentOS6 yum will not use the global proxy settings, so I had to specify the proxy explicitly in /etc/yum.conf. So you'll need to remove the '#'.
You can tell firefox to Use system proxy settings, if you set those (System --> Preferences --> Network Proxy), or specify your proxy separately.

However, as your company network appears to be using a Redmond-based proxy, authentication might require NTLMv2, and I found that incorporating your domain name into your credentials, like you have done, does not work.

The solution I use is cntlm, which is in epel.

You can install it on your VM, configure it to use your company proxy and then tell your VM to use localhost.
That way, CentOS will address the cntlm proxy, which in turn addresses your company proxy, providing the desired credentials. No need for credentials in /etc/yum.conf or system/firefox proxy settings anymore.

Only drawback is that, when you need to change your Windows password, you need to remember to change your /etc/cntlm.conf to reflect the new password. That would be no different from having a password in /etc/yum.conf. On the plus side, cntlm allows you to specify the NTLMv2 password hash, avoiding clear-text passwords in the config file.
Posts: 701
Joined: 2009/03/23 15:08:11
Location: Netherlands

Re: http_proxy setting no effect (yum)

Postby TrevorH » 2011/12/14 09:51:51

The correct place to specify proxy details for yum is in /etc/yum.conf and yours are there but commented out. I suspect that you may need to escape the problematic fields in your username using one of the following

Code: Select all
proxy_username=London\\Tom\ Yang
proxy_username="London\Tom Yang"
User avatar
Forum Moderator
Posts: 13714
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: http_proxy setting no effect (yum)

Postby jack » 2011/12/19 10:38:36

I installed epel "su -c 'rpm -Uvh http://download.fedora.redhat.com/pub/e ... oarch.rpm'"
but still cannot connect to the internet, so I download the cntlm manually via firefox.
http://mirror.neu.edu.cn/fedora/epel/5/ ... l5.src.rpm

but failed to install cntlm because seems lack of dependence.

and Seting 4 kinds of proxy_username still failed to connect.
Posts: 3
Joined: 2011/12/14 08:10:16
Location: Shanghai

[SOLVED] http_proxy setting no effect (yum)

Postby pschaff » 2011/12/19 14:55:33

You need to fix your connectivity issues before you can hope to do anything with repositories. Have you corrected the proxy settings?

When you do get there, do not try to install source RPMS unless you intend to rebuild the binaries yourself. Install from the repos and you will get the proper binaries for your architecture.
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America

Re: http_proxy setting no effect (yum)

Postby jack » 2011/12/22 08:28:31

Hi, I have solved this problem. Using cntlm is a way.

(1)I download the cntlm form http://cntlm.sourceforge.net/
(2)install cntlm in centos6
(3)edit /etc/cntlm.conf
Code: Select all
Username        tom yang
Domain           london
#Password       password
Auth                 NTLMv2
PassNTLMv2      9FAEDDE053118078D3B57D109A5FC236

#please note, do not prefix uesrname with domain, like londo\tom yang.

(4)edit /etc/yum.conf
Code: Select all
    # comment  username and password

(5)start cntlm

now it ok for yum.

Thanks for you help!
[Moderator edit: Added code tags to preserve formatting.]
Posts: 3
Joined: 2011/12/14 08:10:16
Location: Shanghai

Re: [SOLVED] http_proxy setting no effect (yum)

Postby pschaff » 2011/12/22 11:28:30

Interesting - did not know about that one, and missed your point earlier, but I see there is an EPEL package that would probably be preferable to a Source Install.

Code: Select all
# yum --enablerepo epel info Cntlm
Available Packages
Name        : cntlm
Arch        : x86_64
Version     : 0.35.1
Release     : 4.el6
Size        : 65 k
Repo        : epel
Summary     : Fast NTLM authentication proxy with tunneling
URL         : http://cntlm.sourceforge.net/
License     : GPLv2+
Description : Cntlm is a fast and efficient NTLM proxy, with support for TCP/IP
            : tunneling, authenticated connection caching, ACLs, proper daemon
            : logging and behavior and much more. It has up to ten times faster
            : responses than similar NTLM proxies, while using by orders or
            : magnitude less RAM and CPU. Manual page contains detailed
            : information.

The procedure would be to download and install the binary package and any EPEL dependencies, not the source as you tried, from an EPEL mirror and install locally with rpm or yum, using the [c6-media] repo if necessary for dependencies from the OS repos.

Thanks for reporting back. Marking this thread [SOLVED] for posterity.
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America

Re: http_proxy setting no effect (yum)

Postby r_hartman » 2011/12/23 16:06:42

jack wrote:

It would appear you downloaded the CentOS5 SRPM; you'd need the CentOS6 one. Hence the dependency issues.

Going with the (proper) repo is much, much preferred over compiling from source, for a ton of reasons.
Posts: 701
Joined: 2009/03/23 15:08:11
Location: Netherlands

Return to CentOS 6 - Networking Support

Who is online

Users browsing this forum: No registered users and 1 guest