Last active
December 16, 2015 08:28
-
-
Save zoocoup/5405579 to your computer and use it in GitHub Desktop.
Add site to Safari's Java whitelist via script
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
#!/bin/sh | |
# Add a site to the Java whitelist in Safari with Safari 5.1.9+ on 10.6.x and Safari 6.0.4+ on 10.7+ | |
# Safari must be restarted before changes to whitelist load | |
# Get the currently logged in user | |
LIU="`/usr/bin/w | grep console | awk '{ print $1 }'`" | |
DATE="`date '+%FT%TZ'`" | |
# Make a copy of user's existing Safari prefs first before overwriting | |
cp /Users/$LIU/Library/Preferences/com.apple.Safari.plist /Users/$LIU/Library/Preferences/com.apple.Safari.plist_BAK | |
# Add FTL | |
# Edit com.apple.Safari.plist to add new site to whitelist | |
/usr/libexec/PlistBuddy -c "Add :WhitelistedBlockedPlugins array" /Users/$LIU/Library/Preferences/com.apple.Safari.plist | |
/usr/libexec/PlistBuddy -c "Add :WhitelistedBlockedPlugins:0 dict" /Users/$LIU/Library/Preferences/com.apple.Safari.plist | |
/usr/libexec/PlistBuddy -c "Add :WhitelistedBlockedPlugins:0:PluginHostname string 'fermilab.kronoshosting.com'" /Users/$LIU/Library/Preferences/com.apple.Safari.plist | |
# Plistbuddy doesn't seem to like variables here (e.g. $HOSTNAME) so have to hardcode in value. | |
/usr/libexec/PlistBuddy -c "Add :WhitelistedBlockedPlugins:0:PluginIdentifier string 'com.oracle.java.JavaAppletPlugin'" /Users/$LIU/Library/Preferences/com.apple.Safari.plist | |
/usr/libexec/PlistBuddy -c "Add :WhitelistedBlockedPlugins:0:PluginLastVisitedDate string '$DATE'" /Users/$LIU/Library/Preferences/com.apple.Safari.plist | |
/usr/libexec/PlistBuddy -c "Add :WhitelistedBlockedPlugins:0:PluginName string 'Java Applet Plug-in'" /Users/$LIU/Library/Preferences/com.apple.Safari.plist | |
/usr/libexec/PlistBuddy -c "Add :WhitelistedBlockedPlugins:0:PluginPageURL string 'https://fermilab.kronoshosting.com/wfc09/applications/suitenav/navigation.do'" /Users/$LIU/Library/Preferences/com.apple.Safari.plist | |
# Plistbuddy doesn't seem to like variables here (e.g. $URL) so have to hardcode in value. | |
/usr/libexec/PlistBuddy -c "Add :WhitelistedBlockedPlugins:0:PluginPolicy string 'PluginPolicyNeverBlock'" /Users/$LIU/Library/Preferences/com.apple.Safari.plist | |
# Add www-bd for Java apps Kerberos login | |
# Edit com.apple.Safari.plist to add new site to whitelist | |
/usr/libexec/PlistBuddy -c "Add :WhitelistedBlockedPlugins:0 dict" /Users/$LIU/Library/Preferences/com.apple.Safari.plist | |
/usr/libexec/PlistBuddy -c "Add :WhitelistedBlockedPlugins:0:PluginHostname string 'www-bd.fnal.gov'" /Users/$LIU/Library/Preferences/com.apple.Safari.plist | |
# Plistbuddy doesn't seem to like variables here (e.g. $HOSTNAME) so have to hardcode in value. | |
/usr/libexec/PlistBuddy -c "Add :WhitelistedBlockedPlugins:0:PluginIdentifier string 'com.oracle.java.JavaAppletPlugin'" /Users/$LIU/Library/Preferences/com.apple.Safari.plist | |
/usr/libexec/PlistBuddy -c "Add :WhitelistedBlockedPlugins:0:PluginLastVisitedDate string '$DATE'" /Users/$LIU/Library/Preferences/com.apple.Safari.plist | |
/usr/libexec/PlistBuddy -c "Add :WhitelistedBlockedPlugins:0:PluginName string 'Java Applet Plug-in'" /Users/$LIU/Library/Preferences/com.apple.Safari.plist | |
/usr/libexec/PlistBuddy -c "Add :WhitelistedBlockedPlugins:0:PluginPageURL string 'http://www-bd.fnal.gov/appix/login/ok.jsp'" /Users/$LIU/Library/Preferences/com.apple.Safari.plist | |
# Plistbuddy doesn't seem to like variables here (e.g. $URL) so have to hardcode in value. | |
/usr/libexec/PlistBuddy -c "Add :WhitelistedBlockedPlugins:0:PluginPolicy string 'PluginPolicyNeverBlock'" /Users/$LIU/Library/Preferences/com.apple.Safari.plist | |
# Add Controls Java webapps | |
# Edit com.apple.Safari.plist to add new site to whitelist | |
/usr/libexec/PlistBuddy -c "Add :WhitelistedBlockedPlugins:0 dict" /Users/$LIU/Library/Preferences/com.apple.Safari.plist | |
/usr/libexec/PlistBuddy -c "Add :WhitelistedBlockedPlugins:0:PluginHostname string 'www-ad.fnal.gov'" /Users/$LIU/Library/Preferences/com.apple.Safari.plist | |
# Plistbuddy doesn't seem to like variables here (e.g. $HOSTNAME) so have to hardcode in value. | |
/usr/libexec/PlistBuddy -c "Add :WhitelistedBlockedPlugins:0:PluginIdentifier string 'com.oracle.java.JavaAppletPlugin'" /Users/$LIU/Library/Preferences/com.apple.Safari.plist | |
/usr/libexec/PlistBuddy -c "Add :WhitelistedBlockedPlugins:0:PluginLastVisitedDate string '$DATE'" /Users/$LIU/Library/Preferences/com.apple.Safari.plist | |
/usr/libexec/PlistBuddy -c "Add :WhitelistedBlockedPlugins:0:PluginName string 'Java Applet Plug-in'" /Users/$LIU/Library/Preferences/com.apple.Safari.plist | |
/usr/libexec/PlistBuddy -c "Add :WhitelistedBlockedPlugins:0:PluginPageURL string 'http://www-ad.fnal.gov/controls/public/linux-console.html'" /Users/$LIU/Library/Preferences/com.apple.Safari.plist | |
# Plistbuddy doesn't seem to like variables here (e.g. $URL) so have to hardcode in value. | |
/usr/libexec/PlistBuddy -c "Add :WhitelistedBlockedPlugins:0:PluginPolicy string 'PluginPolicyNeverBlock'" /Users/$LIU/Library/Preferences/com.apple.Safari.plist | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment