Update through proxy (apt-get)

Questions about Wi-Fi and other network devices, file sharing, firewalls, connection sharing etc
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
BrEin

Update through proxy (apt-get)

Post by BrEin »

Hi guys,

I searched this forum for this topic, but I didn't find an equivalent threat for that. If this exists, a link would be enought.

My probleme is, my computer is placed behind a proxy. I set up already the proxy settings in the network section.
Internet does work generally with firefox. OK, I have to enter name and passwort for each single page and each single embedded element, but it is working.

For updating with apt-get the following command does work:

Code: Select all

sudo apt-get -o Acquire::http::Proxy="http://user:passwort@proxy:port" update
To enter this option in the config file /etc/apt/apt.conf (with finishing semicolon) does not work.
Neither for the commandline call "sudo apt-get update", nor for the gui based update manager.

So, I have a bunch of question and I hope some of them can be answered:
1. How can I solve that update problem?
2. Why is it possible to set up the proxy, but without username and passwort?
3. Why is this setting not system wide (I think, this would be the easiest solution.)?
4. How can I tell firefox that my username and password don't change within 340ms? :D

Thank you very much
Fabian
User avatar
karlchen
Level 23
Level 23
Posts: 18206
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: Update through proxy (apt-get)

Post by karlchen »

Hello, Fabian.
  • Ad Q1
    How can I solve that update problem?
    This /etc/apt/apt.conf file works correctly here:

    Code: Select all

    Acquire::http::proxy "http://myname:mypass@localhost:5865/";
    Acquire::ftp::proxy "ftp://http://myname:mypass@localhost:5865/";
    apt will connect to my local pseudo proxy cntlm which in turn connects to our real proxy and performs the required NTLM connections there correctly. - This is what often prevents commandline programmes from using a proxy successfully: too many Windows proxies using Windows authentication around.
    cntlm can be got from the official repositories.
    This is the config file of cntlm, it must be readable to root only!

    Code: Select all

     sudo grep -v "^#" /etc/cntlm.conf
    Username	myname
    Domain		mydomain
    Password	mypass
    NTLMToBasic	yes
    Workstation	mycomputername
    Proxy		proxyIP1:port
    Proxy		proxyIP2:port
    NoProxy		localhost, 127.0.0.*, 192.168.*
    Listen		5865
    Auth			NTLMv2
    Header		User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT5)
  • Ad Q2
    Why is it possible to set up the proxy, but without username and passwort?
    I have wondered so, too, and found no answer. Although you cannot enter username and password and other configuration details in the network-manager configuration dialogue, you can do so using dconf-editor. Inside dconf-editor go to system => proxy => http. Here your will find authentication-user and authentication password.
  • Ad Q3
    Why is this setting not system wide (I think, this would be the easiest solution.)?
    If you go to network-settings => proxy inside network-manager there is a large button labbeled [Apply systemwide]. Yet, do not expect all programmes to respect and use the system-wide proxy settings. This is handled in a really inconsistent way on Linux systems.
  • Ad Q4
    How can I tell firefox that my username and password don't change within 340ms?
    Sorry, don't understand. My Firefox does not make any such assumptions.
HTH,
Karl
Image
The people of Alderaan have been bravely fighting back the clone warriors sent out by the unscrupulous Sith Lord Palpatine for 771 days now.
Lifeline
BrEin

Re: Update through proxy (apt-get)

Post by BrEin »

Hey Karlchen (Germany?),

thanks to you. Sorry for my late reply, I thougth I get an eMail after an answer. But it isn't.

Q1: Thanks to you. The first part does work perfectly. My fault was I entered an equationsign instead of space.
The second part I did not try.
Q2&Q3: I installed dconf and did what you said. Unfortunatly firefox is still asking for username and password.
My network settings do not offer a button for system wide appliance.
In addition the proxy is deactivated after a reboot. but I think this is just a bug and it is only showen as deactivated, but it is still activated.
Q4: Although I stored the username and password (for proxy) in firefox and firefox uses the system proxy settings and the proxy settings are setup as you said. Firefox pops up the authendication diagloque everytime I request a new webpage. Somtimes more than one for embedded elements. This is kind of anoying.
Why is it not enought to enter it once? At least once per session?

Thanks to you
Fabian
User avatar
karlchen
Level 23
Level 23
Posts: 18206
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: Update through proxy (apt-get)

Post by karlchen »

Hello, Fabian.

About my double proxy configuration:
It is only a workaround for the case that you experience the problem that your Mint system cannot authenticate on your proxy server directly. If you do not experience this problem then there is no point in using cntlm.

About Firefox:
You can configure manual proxy settings in Firefox and tell it to use them. In most cases doing so will mean you perform the same configuration which you have done in network-manager in Firefox, too. (If it makes any sense you could use a different configuration for Firefox.)
If the system wide proxy settings are fine then it will be convenient to configure Firefox to use the system wide proxy configuration instead.

Firefox will ask for username and password for the proxy session at least once after it has been started. Even if you have told Firefox to save the proxy credentials, it will ask you to confirm the saved credentials. I, too, have got used to Firefox repeating this procedure every once in a while. I assume that it happens whenever the proxy has rejected a request which seems to happen quite frequently for me. It is annoying. Yet, I have not found a way of making Firefox authenticate towards the proxy in a silent mode simply using the stored credentials.

About dconf-editor:
When defining a system-wide proxy network-manager only allows you to perform a really extremely basic configuration. (Have a look at the details of the manual Firefox proxy configuration to find out which items are missing.) All the missing settings can be added, modified, deleted with the help of dconf-editor. Do not ask me why the configuration dialogue of network-manager has been crippled as if the developers were keen on rendering it absolutely useless.

About the button [Apply system-wide]:
I cannot imagine why it should be absent on your system. All my Cinnamon systems have got it.

Kind regards,
Karl
Image
The people of Alderaan have been bravely fighting back the clone warriors sent out by the unscrupulous Sith Lord Palpatine for 771 days now.
Lifeline
Matt33

Re: Update through proxy (apt-get)

Post by Matt33 »

Hello,

Q3: Got the same problem on Mint 15 Cinnamon. The Apply system Wide worked perfectly well with Mint 14, including software manager and commande line apt-get. In Mint 15 this button is now an On/Off button set to Off each time I open "settings" :) Despite this bad information "Off" this proxy ( local cntlm ) works well as a system proxy with firefox but not for software manager and apt-get. Too bad what worked well in 14 is now broken :(

Q1: Thank you Karichen, apt settings with my cntlm proxy works perfectly ( constraint http only )

/etc/apt/apt.conf

Code: Select all

Acquire::http::proxy "http://localhost:3128/";
bkvegas

Re: Update through proxy (apt-get)

Post by bkvegas »

Matt33:

Try the solution found on the last post in this thread to deal with your update issue:

http://forums.linuxmint.com/viewtopic.php?f=157&t=115824&p=643198&hilit=proxy+settings+update#p643198
User avatar
karlchen
Level 23
Level 23
Posts: 18206
Joined: Sat Dec 31, 2011 7:21 am
Location: Germany

Re: Update through proxy (apt-get)

Post by karlchen »

Hello, bkvegas.

As the post that you linked to has been written by me, let me clarify 2 details:
  • Matt33 had already confirmed that the steps suggested in this thread here worked for him, but forgotten to mark this thread as [solved].
  • Configuring a proxy including logon credentials inside Synaptic will make Synaptic work correctly. Yet, it will not have any positive effect on the commandline programme apt-get, because apt-get will never read the Synaptic configuration settings.
In order to make apt-get co-operate with a proxy server you will have to follow the steps explained in this thread.

In case you do, it will depend on the kind of proxy that you are behind
  • whether you will be able to configure apt-get directly to use the proxy
    (e.g. squid proxy, proxy not using Windows authentication, proxy not requiring any authentication)
  • or whether you will need an additional local helper like cntlm sitting inbetween apt-get and the proxy.
    (Windows based proxy server using Windows authentication)

Kind regards,
Karl
Image
The people of Alderaan have been bravely fighting back the clone warriors sent out by the unscrupulous Sith Lord Palpatine for 771 days now.
Lifeline
Locked

Return to “Networking”