Enjoy Proxying.

My last post explained proxy usage via GUI, but many times we are comfortable with command line. NetworkManager team provides us both of the ways to control NetworkManager daemon as nm-connection-editor (GUI) and nmcli (CLI) ,there is even a cursor based client : nmtui.  nmcli is usually the primary way to control NM, So providing a feature without nmcli support is an incomplete task. I have modified nmcli to allow users edit proxy setting via command line.

First see the list of connection:

[atulhjp@localhost ~]$ nmcli connection

Then initialize the proxy setting:

[atulhjp@localhost ~]$ nmcli connection modify <con-name> proxy.method none/auto/manual

Then add properties according to method (if ‘auto’) :

[atulhjp@localhost ~]$ nmcli connection modify <con-name> proxy.pac-url http://example.com/wpad.dat

If we try to add properties not valid for that method, nmcli will through a message like this:

[atulhjp@localhost ~]$ nmcli connection modify veth0+ proxy.http-proxy http://myproxy.com
Error: Failed to modify connection ‘veth0+’: proxy.http-proxy: this property is not allowed for method=auto/none

Message clearly says the ‘http-proxy’ is not for method=none or auto. We need to change method to ‘manual’. So, users don’t need to remember the properties for a method as nmcli won’t set it for unrelated properties and method.  🙂

If someone sets this:

[atulhjp@localhost ~]$ nmcli connection modify <con-name> proxy.method none

No Proxy will be used for that connection, WPAD obtained value is lost and if we set ‘auto’ WPAD obtained value is used unless someone overrides it by,

[atulhjp@localhost ~]$ nmcli connection modify <con-name> proxy.method auto

[atulhjp@localhost ~]$ nmcli connection modify <con-name> proxy.pac-url <overriding Url>

Proxy Feature will be available in NM in upcoming major release 1.4 .

sponsored-badge-simple

Advertisements