Safari 6.1, Java, and Juniper Network Connect

JPDyson
Valued Contributor

If you're still beating your head against a wall as to how to configure this, this is what I've done and it works so far.

Create a Managed Preference
Display Name (in my case): Safari 6.1 Managed Plugins
Description: VOODOO
Apply Setting To: System Level Enforced
-pop over to the Definition tab-
Domain: com.apple.Safari
Key Name: ManagedPluginPolicies
Key Type: Enter Manually
What the happy horse crap is a union policy?! Don't check that. -pop back to the General tab-
-Note that Key says what we entered above-
Paste in the XML JUST from the ManagedPluginPolicies key (below is mine, scrubbed)
TAKE CARE to keep the xml style and indentation proper!

<dict>
    <key>com.oracle.java.JavaAppletPlugin</key>
    <dict>
        <key>PlugInFirstVisitPolicy</key>
        <string>PlugInPolicyAsk</string>
        <key>PlugInHostnamePolicies</key>
        <array>
            <dict>
                <key>PlugInHostname</key>
                <string>vpnng.company.com</string>
                <key>PlugInLastVisitedDate</key>
                <date>2013-10-24T15:15:42Z</date>
                <key>PlugInPageURL</key>
                <string>https://vpnng.company.com/</string>
                <key>PlugInPolicy</key>
                <string>PlugInPolicyAllowNoSecurityRestrictions</string>
                <key>PlugInRunUnsandboxed</key>
                <true/>
            </dict>
            <dict>
                <key>PlugInHostname</key>
                <string>vpn0.company.com</string>
                <key>PlugInLastVisitedDate</key>
                <date>2013-04-22T13:39:46Z</date>
                <key>PlugInPageURL</key>
                <string>https://vpn0.company.com</string>
                <key>PlugInPolicy</key>
                <string>PlugInPolicyAllowNoSecurityRestrictions</string>
                <key>PlugInRunUnsandboxed</key>
                <true/>
            </dict>
        </array>
    </dict>
    <key>net.juniper.DSSafariExtensions.plugin</key>
    <dict>
        <key>PlugInDisallowPromptBeforeUseDialog</key>
        <true/>
        <key>PlugInFirstVisitPolicy</key>
        <string>PlugInPolicyAsk</string>
        <key>PlugInHostnamePolicies</key>
        <array>
            <dict>
                <key>PlugInHostname</key>
                <string>file:///</string>
                <key>PlugInLastVisitedDate</key>
                <date>2013-10-24T15:15:57Z</date>
                <key>PlugInPageURL</key>
                <string>file:///var/folders/</string>
                <key>PlugInPolicy</key>
                <string>PlugInPolicyAllowWithSecurityRestrictions</string>
                <key>PlugInRunUnsandboxed</key>
                <false/>
            </dict>
        </array>
    </dict>
</dict>
25 REPLIES 25

JPDyson
Valued Contributor

Note also that within the ManagedPluginPolicies dictionary there are many other dictionaries for other plugins; I just didn't attempt to manage those in this particular iteration. You can keep the dicts for Flash, for example, if you want to protect access to some of those.

antoinekinch
New Contributor III

Thanks Josh!! I was able to index the Safari 6.1 installer and uninstall it from a machine and then reinstall Safari 6.0.5! Here is the 6.1 installer: http://swcdn.apple.com/content/downloads/18/32/041-6651/147ugedbeiqpz43czixlgawayfoa7tjyjv/Safari6.1MountainLion.pkg

mvanvliet
New Contributor

Anyone happen to have Safari 6.0.5 for 10.7.x? I had my SUS set to delete old versions and its gone, 6.1 isnt cutting the mustard for us.

Thanks

jconte
Contributor II

Along the same lines as JPDyson mentions, you can try scripting the following if you don't want to use MCX:

It's not the simplest of solutions, but I believe I've hit upon a method that may work for you to change the sandboxing behavior en masse for your Mavericks clients.

You can edit "com.apple.Safari.plist". You will want to edit this file and replace "VPN_HOSTNAME" with the appropriate DNS hostname for your SA/VPN frontend. You'll also need to edit the "VPN_URL" key to include the full URL (including https) for that hostname. If you have multiple URLs/hostnames, you'll need to duplicate this entire block and for each one:

<dict>

<key>PlugInHostname</key>

<string>VPN_HOSTNAME</string>

<key>PlugInLastVisitedDate</key>

<date>2013-10-24T17:29:56Z</date>

<key>PlugInPageURL</key>

<string>VPN_URL</string>

<key>PlugInPolicy</key>

<string>PlugInPolicyAllowWithSecurityRestrictions</string>

<key>PlugInRunUnsandboxed</key>

<true/>

</dict>

Once edited to your satisfaction, push out this file to the /Library/Preferences directory on a test client and convert it to a binary via the following command:

sudo plutil -convert binary1 /Library/Preferences/com.apple.Safari.plist

and fix ownership and permissions:

sudo chown root:wheel /Library/Preferences/com.apple.Safari.plist

sudo chmod 644 /Library/Preferences/com.apple.Safari.plist

JPDyson
Valued Contributor

@jconte, that's fairly analogous to manual MCX - why the aversion to using the built-in mechanism?

Bartoo
New Contributor III

ooops

Bartoo
New Contributor III

oops again

Bartoo
New Contributor III

I really wish there was a delete post..

Bartoo
New Contributor III

@ JPDyson: I assume you're doing this on JSS 8.x - I am having a %@%!$! time trying to do this in 9-
So you create a custom Managed Pref -

Apply Setting To: System Level Enforced
Domain: com.apple.Safari
Key Name: ManagedPluginPolicies
Key Type:
- no more Manual in 9 - you have String
Integer
Boolean
Date
Data
Real

and a single line value field- which I don't believe is going to handle that ManagedPluginPolicies hunk of XML.

Anyhow, you hit save, and it does add it to the Safari manifest under ManagedPluginPolicies - but again, the value entry field is a one line affair regardless of what Value Type is chosen.

any ideas?

antoinekinch
New Contributor III

https://www.macupdate.com/app/iphone/15675/apple-safari

@mvanvliet

kstrick
Contributor III

Second Bartoo's post, not able to replicate this with JSS 9.x....

jconte
Contributor II

@JPDyson. We have devices not JAMF managed that are used to connect through our portal for Remote Access.

jconte
Contributor II

@JPDyson. We have devices not JAMF managed that are used to connect through our portal for Remote Access.

Bartoo
New Contributor III

The other option is to put it in a Configuration Profile - configure a system with the correct settings for Java & Juniper, then upload the .plist into a custom Config Profile, deploy to a system w/out these settings and yes, it works.

HOWEVER
You are replacing & locking down ALL settings held in com.apple.Safari.plist, which is maybe not what we'd like, just the two important ones under <string>ManagedPlugInPolicies</string> so far I'm not getting this to work.

In the domain com.apple.Safari I'm extracting and uploading:

<key>ManagedPlugInPolicies</key>
    <dict>
        <key>com.oracle.java.JavaAppletPlugin</key>
        <dict>
            <key>PlugInDisallowPromptBeforeUseDialog</key>
            <true/>
            <key>PlugInFirstVisitPolicy</key>
            <string>PlugInPolicyAsk</string>
            <key>PlugInHostnamePolicies</key>
            <array>
                <dict>
                    <key>PlugInHostname</key>
                    <string>ourvpn.net</string>
                    <key>PlugInLastVisitedDate</key>
                    <date>2013-10-25T17:05:47Z</date>
                    <key>PlugInPageURL</key>
                    <string>https://ourvpn.net/</string>
                    <key>PlugInPolicy</key>
                    <string>PlugInPolicyAllowNoSecurityRestrictions</string>
                    <key>PlugInRunUnsandboxed</key>
                    <true/>
                </dict>
            </array>
        </dict>
        <key>net.juniper.DSSafariExtensions.plugin</key>
        <dict>
            <key>PlugInDisallowPromptBeforeUseDialog</key>
            <true/>
            <key>PlugInFirstVisitPolicy</key>
            <string>PlugInPolicyAsk</string>
            <key>PlugInHostnamePolicies</key>
            <array>
                <dict>
                    <key>PlugInHostname</key>
                    <string>file:///</string>
                    <key>PlugInLastVisitedDate</key>
                    <date>2013-10-24T17:13:42Z</date>
                    <key>PlugInPageURL</key>
                    <string>file:///var/folders/mk/l5whxxd966sccrkb5m08m_xh0000gn/T/11D503DE-D272-487D-A49D-470A82485D67-3166-000005134B67EC2F.html</string>
                    <key>PlugInPolicy</key>
                    <string>PlugInPolicyAllowWithSecurityRestrictions</string>
                    <key>PlugInRunUnsandboxed</key>
                    <false/>
                </dict>
            </array>
        </dict>
    </dict>

And yes, this is what comes down to the test machine but it changes NADA.

Also - Juniper- you *probably* knew these changes were coming months ago and didn't have an updated client for launch date? Thanks Juniper!

maxbehr
Contributor II

As many have lamented, the MCX fix will only work with Casper 8.x. I've written a login script that changes the settings in Safari that makes the appropriate settings. Substitute your organizational info where appropriate.
Updated to modify first if statement as there is no need to specify field type when setting via plistbuddy

#!/bin/bash



#Casper User variable
USER=$3
#path to user's Safari plist
theFile=/Users/$USER/Library/Preferences/com.apple.Safari.plist

#################
#Juniper Plug-In#
#################
 sudo -u $USER /usr/libexec/plistbuddy -c "delete ManagedPlugInPolicies:net.juniper.DSSafariExtensions.plugin:PlugInHostnamePolicies" $theFile
 sudo -u $USER /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:net.juniper.DSSafariExtensions.plugin:PlugInHostnamePolicies array" $theFile
 sudo -u $USER /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:net.juniper.DSSafariExtensions.plugin:PlugInHostnamePolicies:0:PlugInPageURL string file://var/folders/" $theFile
 sudo -u $USER /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:net.juniper.DSSafariExtensions.plugin:PlugInHostnamePolicies:0:PlugInHostName string file:///" $theFile
 sudo -u $USER /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:net.juniper.DSSafariExtensions.plugin:PlugInHostnamePolicies:0:PlugInRunUnsandboxed bool False" $theFile
 sudo -u $USER /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:net.juniper.DSSafariExtensions.plugin:PlugInHostnamePolicies:0:PlugInPolicy string PlugInPolicyAllowNoSecurityRestrictions" $theFile
 sudo -u $USER /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:net.juniper.DSSafariExtensions.plugin:PlugInHostnamePolicies:0:PlugInLastVisitedDate date $(date)" $theFile


##############
#JAVA Plug-In#
##############

#Determine how many DICT items exist in plist
DICT_COUNT=`sudo -u $USER /usr/libexec/plistbuddy -c "print ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies" $theFile | grep "Dict" | wc -l | tr -d " "`
#Determine if a entry already exists for your server
**VPN_PRESENT**=`sudo -u $USER /usr/libexec/plistbuddy -c "print ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies" $theFile | grep "**YOUR_JUNIPER_SERVER**" | wc -l | tr -d " "`


if [ $DICT_COUNT -gt 0 ] && [ $VPN_PRESENT -gt 0 ]; then
#Both DICT exists and a vnet entry exists. Set the preferences
for idx in `seq 0 $((DICT_COUNT - 1))`
do

     val=`sudo -u $USER /usr/libexec/PlistBuddy -c "Print ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${idx}:PlugInHostname" $theFile`

 if [ $val = "**VPNSERVER**" ]; then
      sudo -u $USER /usr/libexec/plistbuddy -c "set ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${idx}:PlugInHostname **VPNSERVER**" $theFile
      sudo -u $USER /usr/libexec/plistbuddy -c "set ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${idx}:PlugInLastVisitedDate $(date)" $theFile
      sudo -u $USER /usr/libexec/plistbuddy -c "set ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${idx}:PlugInPageURL  **VPN_SERVER_ADDRESS**" $theFile
      sudo -u $USER /usr/libexec/plistbuddy -c "set ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${idx}:PlugInPolicy PlugInPolicyAllowNoSecurityRestrictions" $theFile
      sudo -u $USER /usr/libexec/plistbuddy -c "set ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${idx}:PlugInRunUnsandboxed  True" $theFile
     fi
done

elif [ $DICT_COUNT -gt 0 ] && [ $VPN_PRESENT -eq 0 ]; then
#Java array has DICT entries, but vnet is not one of them. Add it to the next available array index
      sudo -u $USER /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies array" $theFile
      sudo -u $USER /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${DICT_COUNT}:PlugInHostname string **VPNSERVER**" $theFile
      sudo -u $USER /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${DICT_COUNT}:PlugInLastVisitedDate date $(date)" $theFile
      sudo -u $USER /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${DICT_COUNT}:PlugInPageURL string **VPN_SERVER_ADDRESS**" $theFile
      sudo -u $USER /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${DICT_COUNT}:PlugInPolicy string PlugInPolicyAllowNoSecurityRestrictions" $theFile
      sudo -u $USER /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${DICT_COUNT}:PlugInRunUnsandboxed bool True" $theFile

else
#No DICT entries exist. Create new one at index 0
      sudo -u $USER /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies array" $theFile
      sudo -u $USER /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:0:PlugInHostname string **VPNSERVER**" $theFile
      sudo -u $USER /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:0:PlugInLastVisitedDate date $(date)" $theFile
      sudo -u $USER /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:0:PlugInPageURL string **VPN_SERVER_ADDRESS**" $theFile
      sudo -u $USER /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:0:PlugInPolicy string PlugInPolicyAllowNoSecurityRestrictions" $theFile
      sudo -u $USER /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:0:PlugInRunUnsandboxed bool True" $theFile
fi

antoinekinch
New Contributor III

Good morning Max,

I have 4 different VPN server addresses that I need to set for the Java plugin. Your script assumes that there is only one VPNSERVER. @maxbehr

Also, you can remove the sudo commands in the script since it would be ran as root.

antoinekinch
New Contributor III

I tried your script @maxbehr and it runs at load but when you try to look at Safari preferences in the gui it crashes Safari 6.1 I think it's a bug.

maxbehr
Contributor II

I've updated the script fixing an error in the first if section of the Java preference section.

antoinekinch
New Contributor III

Here is an example of the modified script that I have been working with @maxbehr][/url][/url. Handling multiple plugins and 4 diff VPN servers.

#!/bin/bash

#path to user's Safari plist
theFile=$HOME/Library/Preferences/com.apple.Safari.plist

#################
#Citrix Plug-In#
#################
 /usr/libexec/plistbuddy -c "delete ManagedPlugInPolicies:com.citrix.citrixcaclientplugin" $theFile
 /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.citrix.citrixcaclientplugin:PlugInFirstVisitPolicy string PlugInPolicyAllowNoSecurityRestrictions" $theFile
 /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.citrix.citrixcaclientplugin:PlugInDisallowPromptBeforeUseDialog bool True" $theFile
 /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.citrix.citrixcaclientplugin:PlugInUpdateWasAvailableWhenUnAvailableDialogWasLastShown bool True" $theFile
 /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.citrix.citrixcaclientplugin:PlugInVersionWhenUnAvailableDialogWasLastShown string 241823" $theFile

#################
#Macromedia Flash Plug-In#
#################
 /usr/libexec/plistbuddy -c "delete ManagedPlugInPolicies:com.macromedia.Flash Player.Plugin" $theFile
 /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.macromedia.Flash Player.Plugin" $theFile
 /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.macromedia.Flash Player.Plugin:PlugInFirstVisitPolicy string PlugInPolicyAllowNoSecurityRestrictions" $theFile
 /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.macromedia.Flash Player.Plugin:PlugInDisallowPromptBeforeUseDialog bool True" $theFile
 /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.macromedia.Flash Player.Plugin:PlugInUpdateWasAvailableWhenUnAvailableDialogWasLastShown bool True" $theFile

#################
#Microsoft Silverlight Plug-In#
#################
 /usr/libexec/plistbuddy -c "delete ManagedPlugInPolicies:com.microsoft.SilverlightPlugin" $theFile
 /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.microsoft.SilverlightPlugin" $theFile
 /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.microsoft.SilverlightPlugin:PlugInFirstVisitPolicy string PlugInPolicyAllowNoSecurityRestrictions" $theFile
 /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.microsoft.SilverlightPlugin:PlugInDisallowPromptBeforeUseDialog bool True" $theFile

#################
#Microsoft Sharepoint Plug-In#
#################
 /usr/libexec/plistbuddy -c "delete ManagedPlugInPolicies:com.microsoft.sharepoint.browserplugin" $theFile
 /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.microsoft.sharepoint.browserplugin" $theFile
 /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.microsoft.sharepoint.browserplugin:PlugInFirstVisitPolicy string PlugInPolicyAllowNoSecurityRestrictions" $theFile
 /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.microsoft.sharepoint.browserplugin:PlugInDisallowPromptBeforeUseDialog bool True" $theFile

#################
#Apple QuickTime Plug-In#
#################
 /usr/libexec/plistbuddy -c "delete ManagedPlugInPolicies:com.apple.QuickTime Plugin" $theFile
 /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.apple.QuickTime Plugin" $theFile
 /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.apple.QuickTime Plugin:PlugInFirstVisitPolicy string PlugInPolicyAllowWithSecurityRestrictions" $theFile
 /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.apple.QuickTime Plugin:PlugInDisallowPromptBeforeUseDialog bool True" $theFile

#################
#Adobe Acrobat Reader Plug-In#
#################
 /usr/libexec/plistbuddy -c "delete ManagedPlugInPolicies:com.acrobat.pdfviewerNPAPI" $theFile
 /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.acrobat.pdfviewerNPAPI" $theFile
 /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.acrobat.pdfviewerNPAPI:PlugInFirstVisitPolicy string PlugInPolicyAllowNoSecurityRestrictions" $theFile
 /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.acrobat.pdfviewerNPAPI:PlugInDisallowPromptBeforeUseDialog bool True" $theFile


#################
#Juniper Plug-In#
#################
 /usr/libexec/plistbuddy -c "delete ManagedPlugInPolicies:net.juniper.DSSafariExtensions.plugin" $theFile
 /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:net.juniper.DSSafariExtensions.plugin:PlugInHostnamePolicies array" $theFile
 /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:net.juniper.DSSafariExtensions.plugin:PlugInHostnamePolicies:0:PlugInRunUnsandboxed bool False" $theFile
 /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:net.juniper.DSSafariExtensions.plugin:PlugInHostnamePolicies:0:PlugInPolicy string PlugInPolicyAllowNoSecurityRestrictions" $theFile


##############
#JAVA Plug-In#
##############

#Determine how many DICT items exist in plist
DICT_COUNT=`/usr/libexec/plistbuddy -c "print ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies" $theFile | grep "Dict" | wc -l | tr -d " "`
#Determine if a entry already exists for your server
VPN_PRESENT=`/usr/libexec/plistbuddy -c "print ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies" $theFile | grep "Server1" | wc -l | tr -d " "`


if [ $DICT_COUNT -gt 0 ] && [ $VPN_PRESENT -gt 0 ]; then
#Both DICT exists and a vnet entry exists. Set the preferences
for idx in `seq 0 $((DICT_COUNT - 1))`
do

     val=`/usr/libexec/PlistBuddy -c "Print ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${idx}:PlugInHostname" $theFile`

 if [ $val = "Server1" ]; then
      /usr/libexec/plistbuddy -c "set ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${idx}:PlugInHostname string Server1" $theFile
      /usr/libexec/plistbuddy -c "set ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${idx}:PlugInLastVisitedDate $(date)" $theFile
      /usr/libexec/plistbuddy -c "set ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${idx}:PlugInPageURL string https://Server1" $theFile
      /usr/libexec/plistbuddy -c "set ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${idx}:PlugInPolicy string PlugInPolicyAllowNoSecurityRestrictions" $theFile
      /usr/libexec/plistbuddy -c "set ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${idx}:PlugInRunUnsandboxed  True" $theFile
     fi
 if [ $val = "Server3" ]; then
      /usr/libexec/plistbuddy -c "set ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${idx}:PlugInHostname string Server2" $theFile
      /usr/libexec/plistbuddy -c "set ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${idx}:PlugInLastVisitedDate $(date)" $theFile
      /usr/libexec/plistbuddy -c "set ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${idx}:PlugInPageURL string https://Server2" $theFile
      /usr/libexec/plistbuddy -c "set ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${idx}:PlugInPolicy string PlugInPolicyAllowNoSecurityRestrictions" $theFile
      /usr/libexec/plistbuddy -c "set ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${idx}:PlugInRunUnsandboxed  True" $theFile
     fi
 if [ $val = "Server2" ]; then
     /usr/libexec/plistbuddy -c "set ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${idx}:PlugInHostname string Server3" $theFile
     /usr/libexec/plistbuddy -c "set ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${idx}:PlugInLastVisitedDate $(date)" $theFile
     /usr/libexec/plistbuddy -c "set ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${idx}:PlugInPageURL string https://Server3" $theFile
     /usr/libexec/plistbuddy -c "set ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${idx}:PlugInPolicy string PlugInPolicyAllowNoSecurityRestrictions" $theFile
     /usr/libexec/plistbuddy -c "set ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${idx}:PlugInRunUnsandboxed  True" $theFile
     fi
 if [ $val = "Server4" ]; then
     /usr/libexec/plistbuddy -c "set ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${idx}:PlugInHostname string Server4" $theFile
     /usr/libexec/plistbuddy -c "set ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${idx}:PlugInLastVisitedDate $(date)" $theFile
     /usr/libexec/plistbuddy -c "set ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${idx}:PlugInPageURL string https://Server4" $theFile
     /usr/libexec/plistbuddy -c "set ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${idx}:PlugInPolicy string PlugInPolicyAllowNoSecurityRestrictions" $theFile
     /usr/libexec/plistbuddy -c "set ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${idx}:PlugInRunUnsandboxed  True" $theFile
     fi
done

elif [ $DICT_COUNT -gt 0 ] && [ $VPN_PRESENT -eq 0 ]; then
#Java array has DICT entries, but vnet is not one of them. Add it to the next available array index
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies array" $theFile
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${DICT_COUNT}:PlugInHostname string Server1" $theFile
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${DICT_COUNT}:PlugInLastVisitedDate date $(date)" $theFile
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${DICT_COUNT}:PlugInPageURL string https://Server1" $theFile
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${DICT_COUNT}:PlugInPolicy string PlugInPolicyAllowNoSecurityRestrictions" $theFile
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${DICT_COUNT}:PlugInRunUnsandboxed bool True" $theFile

      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies array" $theFile
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${DICT_COUNT}:PlugInHostname string Server2" $theFile
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${DICT_COUNT}:PlugInLastVisitedDate date $(date)" $theFile
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${DICT_COUNT}:PlugInPageURL string https://Server2" $theFile
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${DICT_COUNT}:PlugInPolicy string PlugInPolicyAllowNoSecurityRestrictions" $theFile
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${DICT_COUNT}:PlugInRunUnsandboxed bool True" $theFile

      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies array" $theFile
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${DICT_COUNT}:PlugInHostname string Server3" $theFile
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${DICT_COUNT}:PlugInLastVisitedDate date $(date)" $theFile
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${DICT_COUNT}:PlugInPageURL string https://Server3" $theFile
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${DICT_COUNT}:PlugInPolicy string PlugInPolicyAllowNoSecurityRestrictions" $theFile
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracleServer1.java.JavaAppletPlugin:PlugInHostnamePolicies:${DICT_COUNT}:PlugInRunUnsandboxed bool True" $theFile

      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies array" $theFile
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${DICT_COUNT}:PlugInHostname string Server4" $theFile
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${DICT_COUNT}:PlugInLastVisitedDate date $(date)" $theFile
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${DICT_COUNT}:PlugInPageURL string https://Server4" $theFile
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${DICT_COUNT}:PlugInPolicy string PlugInPolicyAllowNoSecurityRestrictions" $theFile
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:${DICT_COUNT}:PlugInRunUnsandboxed bool True" $theFile

else
#No DICT entries exist. Create new one at indexes 0-3
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies array" $theFile
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:0:PlugInHostname string Server1" $theFile
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:0:PlugInLastVisitedDate date $(date)" $theFile
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:0:PlugInPageURL string https://Server1" $theFile
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:0:PlugInPolicy string PlugInPolicyAllowNoSecurityRestrictions" $theFile
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:0:PlugInRunUnsandboxed bool True" $theFile

      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies array" $theFile
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:1:PlugInHostname string Server2" $theFile
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:1:PlugInLastVisitedDate date $(date)" $theFile
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:1:PlugInPageURL string https://Server2" $theFile
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:1:PlugInPolicy string PlugInPolicyAllowNoSecurityRestrictions" $theFile
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:1:PlugInRunUnsandboxed bool True" $theFile

      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies array" $theFile
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:2:PlugInHostname string Server3" $theFile
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:2:PlugInLastVisitedDate date $(date)" $theFile
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:2:PlugInPageURL string https://Server3" $theFile
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:2:PlugInPolicy string PlugInPolicyAllowNoSecurityRestrictions" $theFile
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:2:PlugInRunUnsandboxed bool True" $theFile

      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies array" $theFile
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:3:PlugInHostname string Server4" $theFile
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:3:PlugInLastVisitedDate date $(date)" $theFile
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:3:PlugInPageURL string https://Server4" $theFile
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:3:PlugInPolicy string PlugInPolicyAllowNoSecurityRestrictions" $theFile
      /usr/libexec/plistbuddy -c "add ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies:3:PlugInRunUnsandboxed bool True" $theFile
fi

WUSLS
New Contributor

@bajankinch][/url][/url,

Please pardon my newbness. I only see the following line once.

VPN_PRESENT=/usr/libexec/plistbuddy -c "print ManagedPlugInPolicies:com.oracle.java.JavaAppletPlugin:PlugInHostnamePolicies" $theFile | grep "Server1" | wc -l | tr -d " "
Since the script is suppose to work for 4 VPN's, how does one go about pulling the other 3 different url's to fill in the Server2, Server3, and Server4?

I am just not understanding where the other url's are being pulled from.

WUSLS
New Contributor

NM, I get it. Needed some breakfast to get the brain going this morning.

drowe
New Contributor

@maxbehr - I think your script will hep resolve an issue I'm having with Google Talk Plugins in Safari, just wanted to know, are you running the script on Startup or is it part of your image and I noticed a few people said they couldn't get this to work in Casper 9, does it now work or only for version 8. This is the only viable solution I found that could possibly resolve my issue.

maxbehr
Contributor II

@drowe - I run my script on user login every time. It might be overkill to run it more than once, but this way if the user's decide to change settings I'm assured they get these settings every time they login to a system. I'm using it successfully on Casper 9.21 without any problems.

drowe
New Contributor

@maxbehr - ok great to know. I am looking to mimic this to set google plugins

drowe
New Contributor

@maxbehr - ok great to know. I am looking to mimic this to set google plugins