Freebsd – Default http proxy under FreeBSD

bsdfreebsdPROXYunix

I'd like to set default http proxy for all users under my FreeBSD environment. I modified /etc/login.conf file by adding HTTP_PROXY variable:

default:\
:passwd_format=sha512:\
:copyright=/etc/COPYRIGHT:\
:welcome=/etc/motd:\
:setenv=MAIL=/var/mail/$,BLOCKSIZE=K:\
:path=/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin ~/bin:\
:nologin=/var/run/nologin:\
:cputime=unlimited:\
:datasize=unlimited:\
:stacksize=unlimited:\
:memorylocked=64K:\
:memoryuse=unlimited:\
:filesize=unlimited:\
:coredumpsize=unlimited:\
:openfiles=unlimited:\
:maxproc=unlimited:\
:sbsize=unlimited:\
:vmemoryuse=unlimited:\
:swapuse=unlimited:\
:pseudoterminals=unlimited:\
:priority=0:\
:ignoretime@:\
:HTTP_PROXY=proxy-chain.server.com\c911:\
:umask=022:

and runned

# cap_mkdb /etc/login.conf

but after next login env command doesn't show me the variable. What am I doing wrong?

Best Answer

There's already an example of how to do this properly in the same file:

:setenv=MAIL=/var/mail/$,BLOCKSIZE=K:\

you need to use the setenv setting, which can be a comma-separated list.

:setenv=MAIL=/var/mail/$,BLOCKSIZE=K\
,HTTP_PROXY=http\c//proxy-chain.server.com\c911:\

I've also edited the proxy URL, since AFAIK, it needs to have the protocol defined.

(sources: here and here)