Slackware system-wide proxy settings

I like how the Macs can set the proxy in one place and everything uses those proxy settings. I wanted something similar to that for Slackware, working on the command line, not some GUI utility that works for KDE apps and nothing else. Something low level and pervasive. I did some experimentation and came up with a simple solution that works for most things I need proxy for. It’s good enough for me right now.

I added two new files:

  • /etc/profile.d/proxy.sh
  • /etc/profile.d/proxy.csh

just like the other scripts in /etc/profile.d. When you start a shell, the system runs /etc/profile and that runs all the executable scripts in /etc/profile.d. These two proxy files have these settings:

NO_PROXY="localhost,127.0.0.1"
no_proxy="localhost,127.0.0.1"
HTTP_PROXY="allagash.internal:3128"
http_proxy="allagash.internal:3128"
HTTPS_PROXY="allagash.internal:3128"
https_proxy="allagash.internal:3128"
FTP_PROXY="allagash.internal:3128"
ftp_proxy="allagash.internal:3128"
ALL_PROXY="allagash.internal:3128"
all_proxy="allagash.internal:3128"

So now, these environment variables are set in all shells. root has them, my users have them, and cronjobs have them. I can delete the individual proxy settings from my slackpkg scripts, my sbopkg scripts, my individual wgetrc files. One central location for my proxy settings. Not every program uses these environment variables. Only those that have been written to look for them. Most of the command line apps do, and that suits me fine as I work on the command line. I’ve only tested one GUI app, and discovered that Firefox does not use these environment variables (or I have not set it up so it can find them). More research necessary.

Leave a comment

You must be logged in to post a comment.