Automatically set system proxy from network connection
This is a fork of the original proxydriver script currently maintained by Julien Blitte.
Proxydriver is a script which sets Gnome/Kde proxy settings using Network Manager's dispatcher. Each network connection triggers a reconfiguration of the Gnome/Kde proxy, based on the network profile name.
To install this file, place it in directory (with +x mod): /etc/NetworkManager/dispatcher.d
For each new SSID, after a first connection, complete the generated file /etc/proxydriver.d/<ssid_name>.conf and then re-connect to AP, and the proxy should be set.
Original home page: http://marin.jb.free.fr/proxydriver/
Original Sourceforge site: http://sourceforge.net/projects/proxydriver/
from https://github.com/j1ml/proxydriver
-----
What is proxydriver
Proxydriver is little application wich handles Gnome or Kde proxy settings using Network Manager's informations.
Each network connection triggers a reconfiguration of Gnome/Kde proxy, based on network profile name.
Thanks to every contributors for their help.
Current version of application: 1.62
How does it works
One configuration file is used by network name; this configuration file is /etc/proxydriver.d/${network}.conf
A first connection on a new network creates automatically a template of a configuration file with a proxyless configuration.
- NetworkManager connects to network.
- NetworkManager's dispatcher broadcasts new connection information.
- Script gets current network name using nmcli.
- Proxydriver retreives corresponding configuration file and sets proxy for current connected user.
Requirement
This script was tested under Ubuntu and Fedora with GNOME, Network Manager and nmcli. It needs Gnome or Kde, NetworkManager and nmcli.
If nmcli is not found, proxydriver uses iwgetid to identify current network profile; in this case only wifi connections are compliant with proxydriver.
Install proxydriver
Ubuntu / Debian
Download and install .deb package of proxydiver.
Archlinux
Install package proxydiver from Arch User Repository.
Others
If you can't or don't want to install a package, you can also manually install proxydriver by this way:$ wget http://sourceforge.net/p/proxydriver/code/HEAD/tree/src/v1.62/proxydriver.sh?format=raw
$ sudo install -m 755 -o 0 -g 0 proxydriver.sh /etc/NetworkManager/dispatcher.d/99proxydriver.sh
To can check is nmcli is present, use this command line (nothing output = nmcli not installed):$ which nmcli
You should install nmcli if you want to have a complete-working proxydriver.
Install nmcli
Some distro packaged nmcli into Network-Manager's one, that's the case for Fedora 13, but not yet today for Debian or Ubuntu.
To install program manually:
- download last Network-Manager source in which nmcli is included
- extract archive and enter into created directory using a terminal
- type following command lines:
$ ./configure 1
$ make
$ sudo make -C cli/ install
1 You may have some missing dependencies here, if you are running on Ubuntu, this command line could give you some help:$ sudo apt-get install libdbus-1-dev libdbus-glib-1-dev libgcrypt11-dev libglib2.0-dev libgpg-error-dev libgudev-1.0-dev libnl-dev libpolkit-gobject-1-dev libunique-1.0-0 uuid-dev ppp-dev libnss3-dev
Sources
Project is now on sourceforge, sources are available by SVN. You can also browse sources here.
Consult/configure the current proxydriver configuration
To know what is the current network profile:$ grep "proxydriver.*using" /var/log/syslog | tail -n 1
To edit configuration file of current wifi connection:$ nano /etc/proxydriver.d/${network}.conf
FAQ
- Nmcli seems not to be installed, can proxydriver works without it?
- Not completely. Under Ubuntu it works only if connection is a wifi one.
On Fedora, it does not works at all. - What happens if proxydriver is not able to retrieve network profile name or SSID?
- The configuration default.conf is used.
- SSID of my wifi network is not broadcasted, is proxydriver able to detect my network?
- Yes, if nmcli is installed, proxydriver will use network name.
- Can proxydriver detect an ip configuration or ping an other host to get location?
- Natively, proxydriver use only network name to set proxy configuration.
You can try hack/tune the script to make configuration name generated on other parameters: technical details here - Is a graphical interface exist to configure proxydriver of each network?
- No, but you can use a graphical text editor like gedit to edit configuration files.
- Does I need to be root to install/configure proxydriver?
- Yes/No. To install proxydriver, you must be root. To configure a proxy for a network profile, you must be in dip group.
- I tried to change a configuration file but it doesn't work!
- Check the configuration file format. Look in logs what happens:
$ grep proxydriver /var/log/syslog
- I cannot modify the configuration file.
- Be sure you are in the dip group:
$ groups
If it's not the case (dip does not appear in the list), add the user to the group:$ sudo addgroup ${user} dip
Then restart your system. - Can I use proxydriver for several wired network?
- Yes, but you have to create a connection profile into NetworkManager and select the relevant profile manually at each connection.
By default, only one unique profile – Wired network connection 1 – is used for every wired connection; since proxydriver applies proxy settings regarding current profile, it cannot deal with a unique shared profile. - from http://marin.jb.free.fr/proxydriver/
No comments:
Post a Comment