So our administrator here decided to put authentication (basic authentication, NCSA probably) instead of the previously used IP (subnets) based ACLs. Now one has to enter username & password into pop-ups before an application can access the internet, which is very annoying.
I wanted to automate this authentication process (everything was automated finally except for FF & Chromium) and this is what I did.
Pacman (using wget as downloader):
This was easy as wget honors environment variables of the form http_proxy=”http://uname:passwd@192.168.xxx.yyy:8080/”
and ftp_proxy=”http://uname:passwd@192.168.xxx.yyy:8080/”.
wget also supports proxy-user & proxy-password command-line arguments. Also proxy settings could be specified in /etc/wgetrc, and they will override environment variables.
Powerpill (using aria2 as downloader):
aria2 also supports http_proxy & ftp_proxy environment variables in the same form as wget’s. In addition it supports all_proxy variable that should be enough if protocol specific variables (http_proxy etc.) are not specified.
Command-line arguments such as all-proxy, http-proxy etc. are supported. Additionally these options would work if defined in aria2.conf file. Beware though, as they override each other if defined via different ways, so do check the manual pages for precedence issues.
In Different web-browsers:
Well I expected that FF (3.6 currently) won’t disappoint me here, but I was wrong. I tried different ways, searched it everywhere, but to no gain. It does remember the password but it won’t post/submit it by itself. Even “Use system proxy settings” in the network settings tab wasn’t working, though it’s supposed to load the environment variables this way. It doesn’t ask for password for each URL as long as it isn’t restarted. This is because FF keeps auth-cache for successful logins and clears it upon exit. The user agent (browser) has to submit authorization data for each http request, and FF sends those auth-headers on our behalf with each request to the proxy- server.
Squid keeps an age-limit for a succesful basic authenticaton session, defined by credentialsttl option (1 or 2 hours by default). This however is for squid’s internal use and has nothing to do with the browser’s lackings or behaviour i.e whether it keeps an auth-cache and submits it automatically or not. Also login data is sent in clear-text in all basic authentication methods. This could be easily verified using Wireshark.
I checked it with chromium (build 4.0.249.64), but it behaved just like FF. Konqueror (4.3.4) though was able to automatically submit my login data from kdewallet, thanks to the well-integrated DE.
Also note that proxy authentication is different from http authentication (which is against a web server). This link provides a bit of details about this process.

