7

I am behind a corporate firewall in the day, and on an open internet connection at night. I have configured cntlm to forward to my corporate proxy, but when I connect from an open connection, I must re-configure my proxy settings.

Is there a way to make cntlm fallback to using no proxy when there is none available?

# List of parent proxies to use. More proxies can be defined
# one per line in format <proxy_ip>:<proxy_port>
#
Proxy       10.73.55.44:80
# <~~ something here to fallback to a direct connection when no proxy is available
Billy Moon
  • 1,437
  • 3
  • 17
  • 23

2 Answers2

3

cntlm has this on it's roadmap, but I think I solved this problem in a simple way using squid: 1. Install squid on the same machine as cntlm, on port 3129 (just change 3128 to 3129 in squid.conf) 2. Add "Proxy localhost:3129" to the cntlm proxy list

That's it.

Hope this helps.

ferdez
  • 41
  • 4
1

This solution rewrites the relevant part of the cntlm.conf based on your current IP address: http://mirkoweber.blogspot.hu/2011/10/using-cntlm-in-changing-environment.html

#!/bin/sh
case "$2" in
    up|vpn-up)
          IP=`/sbin/ifconfig  | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'`
          case $IP in
             172.*)
                logger "setNoProxy.sh -set NoProxy for enterprise net"
                NoProxy="NoProxy         localhost, 127.0.0.*, 10.*, 192.168.*,enterprise-intranet"
                ;;
               *)
                logger "setNoProxy.sh - set NoProxy for direct net"
                NoProxy="NoProxy *"
                ;;
            esac
         sudo sed "s/^NoProxy.*$/$NoProxy/g" -i /etc/cntlm.conf
         sudo service cntlm restart
         ;;
esac
Billy Moon
  • 1,437
  • 3
  • 17
  • 23
RAlex
  • 11
  • 2
  • 1
    Please edit your answer to describe or at least summarize the solution here. External pages can disappear at any time, and we prefer not to rely on them. – 200_success Oct 01 '13 at 07:50