mym Posted June 28, 2006 Posted June 28, 2006 (edited) This script configures a local Squid proxy server (running as a service on Windows XP/2000) depending on the DHCP domain you are in. It then reconfigures Squid to use domain specific parents, siblings and DNS servers. It performs a fallback procedure when a parent dies. You can also instruct it not to use Squid at all in a specific domain. This works great in conjunction with a proxy.pac file to determine in which domain you are. It writes to its own logfile, monitors Squid's logfiles and its own logfile and rotates them if they become too big. It configures Squid so that the local machine is the only one permitted to use it. Perfect for laptop users. Well, here it is. I think it's finally finished and ready to face the world. I'm very curious about what you think. Please give me your feedback. watchdnsserver.au3 It uses its own ini file (you should name this file watchdnssserver.ini or tweak the script), which can be used to override all settings. This is a skeleton file: [Variables] # The following variables can be altered to finetune the script. Their usage # is explained below. # Possible time units: s, m, h, d. # Possible size units: b, k, m, g. # PollTimer: the interval at which the script will check if it is # connected to the network or if it should rotate its logfiles. # Every other counter is derived from this counter. # PollTimer=5s # MaxRotateTimer: the interval at which the script will check logfile sizes. # MaxRotateTimer=4h # MaxSquidShutdownTimer: after this time Squid is ordered to shut down # if there is no active network connection. # MaxSquidShutdownTimer=5m # MaxParentAliveTimer: the interval at which the script will check # if Squid's parents are still alive. # MaxParentAliveTimer=5m # MaxSquidProcessTimer: the interval at which the script will check # if Squid is still running. # MaxSquidProcessTimer=1m # ScriptLogFile: the location of the script's log file. # Note: if it doesn't exist when the script starts, it is created. # ScriptLogFile=c:\squid\var\logs\script.log # SquidConfFile: the location of Squid's configuration file. # SquidConfFile=c:\squid\etc\squid.confg # MaxScriptLogFileSize: the maximum script log file size before rotating. # MaxScriptLogFileSize=1m # MaxAccessLogFileSize: the maximum Squid access log file size before rotating. # MaxAccessLogFileSize=4m # MaxCacheLogFileSize: the maximum Squid cache log file size before rotating. # MaxCacheLogFileSize=1m # MaxStoreLogFileSize: the maximum Squid store log file size before rotating. # MaxStoreLogFileSize=4m # MaxNumberOfScriptLogFiles: the maximum number of script log files to retain. # Note: the maximum number of Squid logs files is defined in the logfile_rotate # option in squid.conf. # MaxNumberOfScriptLogFiles=5 # NTServiceName: the name of the Squid service. # NTServiceName=squidnt # Below are the domains and their individual configurations. The domain names # should be put between brackets. # Possible configurations: # Parent: a normal cache_peer line as it is found in Squid's configuration file. # This server will be used as Squid's parent server, one per line. If a parent dies, # the siblings from the Fallback lines take over. # Parent=cache_peer 192.168.1.199 parent 3128 3130 no-digest # Sibling: a normal cache_peer line as it is found in Squid's configuration file. # This server will be used as Squid's sibling server, one per line. # Sibling=cache_peer 192.168.1.199 sibling 3128 3130 no-digest # Fallback: a normal cache_peer line as it is found in Squid's configuration file. # If Squid's parent server dies, these siblings take over. One per line. # Fallback=cache_peer 192.168.1.199 sibling 3128 3130 no-digest # NameServers: Comma or space separated line of nameserver IP addresses Squid should use. # If not specified, Squid uses the name servers provided by the network. # Multiple possible per line. # Nameservers=192.168.1.199, 192.168.1.254 # UseSquid: If UseSquid=no, Squid will not be used in the specified domain. # Can be used with a proxy.pac autoconfig file. # UseSquid=no # Literal: Any lines which should be copied into Squid's configuration file # unchanged, without any further checks. For example parents which cannot be port scanned, # such as servers forwarded through SSH. # Literal=cache_peer 127.0.0.1 parent 4128 4130 no-digest # If the computer is connected to an unknown domain, the settings from the "default" # section are used. Example: # [Default] # Sibling=cache_peer <server> sibling 3128 3130 # Sibling=cache_peer <server> sibling 3129 3130 # Sibling=cache_peer <server> sibling 3128 3130 Edited June 29, 2006 by mym
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now