Skip to content

Instantly share code, notes, and snippets.

@rtrouton
Created February 25, 2015 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rtrouton/ac00982e06440407e558 to your computer and use it in GitHub Desktop.
Save rtrouton/ac00982e06440407e558 to your computer and use it in GitHub Desktop.
Postinstall script for Sophos Enterprise Anti-Virus for Mac OS X 9.2.x installer
#!/bin/bash
LOGGER="/usr/bin/logger"
FILE_DATE=`date +%Y%m%d%H%M%S`
# Determine working directory
install_dir=`dirname $0`
# Location of Sophos keychain file
sophos_keychain="$3/Library/Sophos Anti-Virus/Sophos.keychain"
# Install Sophos Anti-Virus
$install_dir/"Sophos Installer.app/Contents/MacOS/tools/InstallationDeployer" --install
# Remove existing Sophos autoupdate configuration file
/bin/mv "/Library/Preferences/com.sophos.sau.plist" /tmp/com.sophos.sau."$FILE_DATE".plist
# Remove and replace existing Sophos keychain file
if [[ -f "$sophos_keychain" ]]; then
mv "$sophos_keychain" /tmp/Sophos-"$FILE_DATE".keychain
cp "$install_dir/Sophos.keychain" "$sophos_keychain"
fi
# Write Sophos autoupdate configuration file
#
# Note: Plist file here is only an example. You will
# need to provide your own plist settings between the
# following lines:
#
# /bin/cat > "/Library/Sophos Anti-Virus/com.sophos.sau.plist" << 'SOPHOS_CONFIG'
#
# ....plist data goes here....
#
# SOPHOS_CONFIG
#
/bin/cat > "/Library/Preferences/com.sophos.sau.plist" << 'SOPHOS_CONFIG'
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>LastUpdated</key>
<string>February 25, 2015 at 9:17:42 AM EST</string>
<key>OverrideCredentialsForSaas</key>
<integer>0</integer>
<key>PrimaryServerProxy</key>
<integer>0</integer>
<key>PrimaryServerProxyPort</key>
<integer>0</integer>
<key>PrimaryServerProxyURL</key>
<string></string>
<key>PrimaryServerType</key>
<integer>2</integer>
<key>PrimaryServerURL</key>
<string>smb://sophos_enterprise_server_name_goes_here/SophosUpdate/CIDs/S000/ESCOSX</string>
<key>SecondaryServer</key>
<true/>
<key>SecondaryServerProxy</key>
<integer>0</integer>
<key>SecondaryServerProxyPort</key>
<integer>0</integer>
<key>SecondaryServerProxyURL</key>
<string></string>
<key>SecondaryServerType</key>
<integer>0</integer>
<key>SecondaryServerURL</key>
<string></string>
<key>UpdateFrequency</key>
<integer>1</integer>
<key>UpdateInterval</key>
<integer>10</integer>
<key>UpdateLogIntoFile</key>
<true/>
<key>UpdateLogIntoSyslog</key>
<false/>
<key>UpdateOnConnection</key>
<false/>
<key>UpdateUnits</key>
<integer>1</integer>
</dict>
</plist>
SOPHOS_CONFIG
# Force Sophos to reload its configuration
/usr/bin/killall -HUP SophosConfigD
exit 0
@sgroening
Copy link

Hi Rich,

Have you had issues with this method of configuring Sophos Anti-Virus 9.5.x? -I simply cannot get the provided server credentials to work, hence the preferences setup is incomplete as there's no username and password entries . . .

It works flawlessly for older versions (e.g. 9.2.10) and these versions upgrade correctly through the server, but creating a new installer from the 9.5.x installers results in the above mentioned issues.

Best regards,

Søren Grønning

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment