glob

windowsupdate_cache

windowsupdate_cache
© 2003-2006 byron jones
freeware
glob.com.au/windowsupdate_cache
windowsupdate @ glob.com.au

about

these scripts are what i use to permanently cache downloads from microsoft (including windows update). note that this does not "clone" windowsupdate, rather it only stops you re-downloading files that have already been fetched (ie. it's a cache not a clone).

i have received reports that windowsupdate_cache has issues with changes introduced by version 5. i no longer run or maintain this script, so i'm not able to diagnose this, sorry. i understand that version 5 ignores proxy settings, so unless you're running a transparent proxy, your squid box isn't involved.

if you're a windows house, you may want to play with sus server instead.

another alternative is to put the following lines in your squid.conf:

refresh_pattern windowsupdate.com/.*\.(cab|exe) 4320 100% 43200 reload-into-ims
refresh_pattern download.microsoft.com/.*\.(cab|exe) 4320 100% 43200 reload-into-ims
refresh_pattern au.download.windowsupdate.com/.*\.(cab|exe) 4320 100% 43200 reload-into-ims

note that i haven't tested this.

download

download windowsupdate_cache.tar.gz

last updated 6 nov 2006

you'll need squid, apache and perl. and you'll need to know how to configure squid and apache.

you'll also need wget and the perl Date::Parse module (part of the TimeDate package). download from http://search.cpan.org/~GBARR/TimeDate, install instructions at http://www.cpan.org/modules/INSTALL.html.

there's three scripts

redir.pl - redirector script for squid
download - called by redir.pl
check_store - nightly cron job to stop stale and duplicate entries

the flow of redir.pl is ..

if the request is for a microsoft cab/exe
    if the file doesn't exist in the store
        spawn the download script to download into the store
    else
        rewrite the url to redirect to the store
    endif
endif

to install

  1. create a directory under your apache's htdocs area, and then a directory called "store" under that. i use:
    /usr/local/apache/htdocs/cache
    /usr/local/apache/htdocs/cache/store
  2. modify paths in redir.pl:
    $cache_path = path to the store
    $cache_url = internal url to the store
    $downloader = full path to the download script
    modify $cache_path in download
    modify $cache_path in check_store
  3. configure squid to use redir.pl (redirect_program option)
  4. set up a cron job to run check_store nightly

the download script will need permissions to create a file called "log" (it will run as the same user that runs squid). it also needs permissions to write to the store directory.

note

there's a bug in the version of autoupdate that ships with a default winxp build -- it will go into a loop fetching the same file over and over. make sure you manually upgrade to at least SP1a before running windowsupdate on xp boxes. (large thanks to chris hoypoy for figuring that one out).