Here’s the action script source that I’ve utilized in the past to pull files from an internal HTTP resource and drop into the BES cache on the root server. This will only work on NIX endpoints with Bash installed.
// Query for action parameters of fixlet
action parameter query "_filename" with description "Please enter the file name."
action parameter query "_sha1" with description "Please enter SHA1 value of the file."
action parameter query "_internal_url" with description "Please enter the internal URL to file location. For example, http://subdomain.domain.suffix/path/to/script/goes/here/ and make sure to include final slash."
// Declare fixlet parameters
parameter "_date_and_time" = "{((year of it as string & month of it as two digits & day_of_month of it as two digits) of date(local time zone) of it & "."& (two digit hour of it as string & two digit minute of it as string & two digit second of it as string) of time (local time zone) of it) of now}"
parameter "_root_bes_path" = "/var/opt/BESServer/wwwrootbes/Uploads/cache"
parameter "_root_sha1_path" = "/var/opt/BESServer/wwwrootbes/bfmirror/downloads/sha1"
// Generate installer script
createfile until __EOF
#!/bin/sh
# *** ***************************************************************** ***
# *** ***
# *** Casey Cannady - CBI ***
# *** bigfix@cbisecure.com ***
# *** www.cbisecure.com ***
# *** ***
# *** ***************************************************************** ***
#
# Change to proper directory on root BES server
#
cd {parameter "_root_bes_path"}
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
#
# Download file from internal HTTP service
#
wget {parameter "_internal_url" & parameter "_filename"}
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
#
# Put the downloaded file in the BES sha1 folder to make available for endpoints
#
mv {parameter "_filename"} {parameter "_root_sha1_path"}/{parameter "_sha1"}
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
__EOF
// Move temporary file download script to tmp filesystem
move __createfile /var/opt/BESServer/tmp/bes_cache_{parameter "_date_and_time"}.sh
// Set temporary download script permissions
wait chmod 755 /var/opt/BESServer/tmp/bes_cache_{parameter "_date_and_time"}.sh
// Execute temporary download script
wait /bin/sh /var/opt/BESServer/tmp/bes_cache_{parameter "_date_and_time"}.sh
parameter "__ExitCode1" = "{if exist exit code of action then exit code of action as string else "999"}"
if {parameter "__ExitCode1" != "0"}
exit {parameter "__ExitCode1"}
endif
// Good house keeping
delete __createfile
delete /var/opt/BESServer/tmp/bes_cache_{parameter "_date_and_time"}.sh
You’ll want to make sure to be sure and specify the custom relevance for the action’s “Success Criteria” as follows:
exit code of action != 0
Hope this helps.
@cmcannady
*** Please note that the above is provided as-is and without warranty.