I do not know if APT is able to use a PAC file directly but you can (with quite a bit of work/understanding) extract the relevant proxy information from the PAC file itself and use this information to configure APT to use a HTTP proxy.
The PAC file essentially consists of a JavaScript function. The return statement (one or more) of the function returns the proxy server address and port, for example:
return "PROXY proxy.some.site:8080; DIRECT";
Just look at your PAC file by entering its address in a browser. With this information you can create an APT configuration file:
sudo gedit /etc/apt/apt.conf.d/proxy
You should modify the file so that it contains the following information:
Acquire::http::Proxy "http://proxy.some.site:8080";
Save the file and the next apt-get run should use the configured proxy setting.
It would be nice if APT could work with PAC files because we also use them in our company. Perhaps somebody else knows if/how it works...
The Ubuntu Wiki Page for AptGet also has some hints how to configure a proxy for APT.
See also https://superuser.com/questions/323488/ubuntu-system-wide-proxy-auto-configuration-pac-script
You can set your proxy via the terminal.
Press Ctrl+Alt+T
You should, for that, edit the following files:
/etc/bash.bashrc
/etc/environment
/etc/apt/apt.conf
/usr/local/etc/freshclam.conf
These files must have the following contents:
sudo nano /etc/bash.bashrc
export http_proxy=http://username:password@proxyserver.net:port/
export https_proxy=http://username:password@proxyserver.net:port/
export ftp_proxy=http://username:password@proxyserver.net:port/
Ctrl + O, save file. Ctrl + X, close nano.
sudo nano /etc/environment
http_proxy=http://username:password@proxyserver.net:port/
https_proxy=http://username:password@proxyserver.net:port/
ftp_proxy=http://username:password@proxyserver.net:port/
Ctrl + O, save file. Ctrl + X, close nano.
sudo nano /etc/apt/apt.conf
Acquire::http::Proxy "http://username:password@proxyserver.net:port";
Acquire::https::Proxy "http://username:password@proxyserver.net:port";
Acquire::ftp::Proxy "http://username:password@proxyserver.net:port";
Ctrl + O, save file. Ctrl + X, close nano.
sudo nano /usr/local/etc/freshclam.conf
HTTPProxyServer proxyserver.net
HTTPProxyPort port
HTTPProxyUsername username
HTTPProxyPassword password
Ctrl + O, save file. Ctrl + X, close nano.
And:
Configuration URL = http://username:password@www.something.com/someting/someting:port
Best Answer
Here a several ways to do this.
Network based configurations
DHCP
If you are using DHCP, you can set here an option configuring your clients. For this specify in your dhcpd configuration:
DNS
An alternate possibility is to use the DNS to specify the pac file.
See e.g. wikipedia
(Note: These are examples and may not be live URLs.)
Notes:
wpad.dat
file may be an symbolic link to the file used in the DHCP configuration.System / user based configurations
system (or user) based configuration via environment variable
To use the pac file for
curl
and other programs you can set the environment variableauto_proxy
. E.g.:user based configuration for applications using gconf
For adding the autoconfig url to your gconf settings you can use the following command:
lxproxy Utility for Lubuntu
Please see the community wiki. Here is the ppa for
lxproxy
referenced. Lxproxy claims to be a smlall gui to set a proxy server.Application specific configuration
chromium
You may enforce that all chromium browser instances on a machine use the autoconfig url. Place a file (e.g. proxyConfig) below
/etc/chromium-browser/policies/managed/
with the following contentNote: Placing this file below
/etc/chromium-browser/policies/recommended
will make this setting a default. The user is able to change this setting afterwards in his own chromium configuration.firefox
Edit the file
/etc/firefox/syspref.js
and add the following linesAlternate way: Set this values as user preferences via about:config.
thunderbird
Edit the file
/etc/thunderbird/syspref.js
and add the following linesNote: Due to bug #1081015 you can't lock down this setting. So it is here only possible to set a default. Ensure that this values are note overwritten by
prefs.js
in your active profile.