Last active
August 29, 2015 14:04
-
-
Save MiqViq/0accbc7a43f8dde267ba to your computer and use it in GitHub Desktop.
For Munki; Enables insecure NTLM v1 authentication protocol in Firefox, applies settings on Firefox.app instances found in /Applications
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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>autoremove</key> | |
<false/> | |
<key>catalogs</key> | |
<array> | |
<string>testing</string> | |
</array> | |
<key>description</key> | |
<string>Enables insecure NTLM v1 authentication protocol in Firefox.</string> | |
<key>display_name</key> | |
<string>Enable NTLMv1 for Firefox</string> | |
<key>installcheck_script</key> | |
<string>#!/bin/bash | |
# This setting applies to all users | |
# Allows user to change the setting, setting is reverted to the value defined in mozilla.config after restarting Firefox | |
### | |
# functions | |
function setAuthPrefs () { | |
FoxPrefsFile="${FFAppPath}/Contents/MacOS/mozilla.cfg" | |
# if setting is already enabled then exit | |
if grep -q 'pref("network.negotiate-auth.allow-insecure-ntlm-v1", true);' "${FoxPrefsFile}" 2>/dev/null; then | |
return | |
fi | |
if [ ! -d "${FFAppPath}" ] || [ "${FFAppPath}" == '/Applications/Firefox*.app' ] ; then | |
echo "Firefox.app not found at '${FFAppPath}'" | |
return | |
fi | |
# if setting is disabled then enable it | |
if grep -q 'pref("network.negotiate-auth.allow-insecure-ntlm-v1", false);' "${FoxPrefsFile}" 2>/dev/null; then | |
# fix the file using perl's in-place edit | |
perl -pi -w -e 's/network.negotiate-auth.allow-insecure-ntlm-v1", false/network.negotiate-auth.allow-insecure-ntlm-v1", true/g' "${FoxPrefsFile}" | |
elif ! grep -q 'pref("network.negotiate-auth.allow-insecure-ntlm-v1",' "${FoxPrefsFile}" 2>/dev/null; then | |
printf "//\npref(\"network.negotiate-auth.allow-insecure-ntlm-v1\", true)\n" >> "${FoxPrefsFile}" | |
fi | |
chmod a+r "${FoxPrefsFile}" 2>/dev/null | |
} | |
function setCustomPrefs () { | |
if [ ! -d "${FFAppPath}" ] || [ "${FFAppPath}" == '/Applications/Firefox*.app' ] ; then | |
return | |
fi | |
FoxEnablePrefsDir="${FFAppPath}/Contents/MacOS/defaults/pref" | |
FoxEnablePrefsFile="${FoxEnablePrefsDir}/local-settings.js" | |
if [ ! -d "${FoxEnablePrefsDir}" ]; then | |
mkdir -p -m 0755 "${FoxEnablePrefsDir}" 2>/dev/null | |
fi | |
# tell Firefox to look for a specific file for custom settings | |
if ! grep -q 'pref("general.config.obscure_value", 0);' "${FoxEnablePrefsFile}" 2>/dev/null || ! grep -q 'pref("general.config.filename", "mozilla.cfg");' "${FoxEnablePrefsFile}" 2>/dev/null; then | |
printf "pref(\"general.config.obscure_value\", 0);\npref(\"general.config.filename\", \"mozilla.cfg\");\n" >> "${FoxEnablePrefsFile}" | |
chmod a+r "${FoxEnablePrefsFile}" 2>/dev/null | |
fi | |
} | |
### | |
# actions | |
for item in /Applications/Firefox*.app ; do | |
FFAppPath="${item}" | |
setAuthPrefs | |
setCustomPrefs | |
done | |
exit 1</string> | |
<key>installer_type</key> | |
<string>nopkg</string> | |
<key>minimum_os_version</key> | |
<string>10.6.8</string> | |
<key>name</key> | |
<string>firefox_enable_ntlm_v1_auth_common</string> | |
<key>unattended_install</key> | |
<true/> | |
<key>unattended_uninstall</key> | |
<true/> | |
<key>uninstall_method</key> | |
<string>uninstall_script</string> | |
<key>uninstall_script</key> | |
<string>#!/bin/bash | |
exit 0</string> | |
<key>uninstallable</key> | |
<true/> | |
<key>version</key> | |
<string>2014.7.30</string> | |
</dict> | |
</plist> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment