Zack McCauley - WardsParadox

Hi, I’m a macadmin for a school district in Montana. Never stop learning.

uBlock Origin Admin Settings Deployment

2019-02-27

As our district has made the decision to push out uBlock, we had to include a whitelist. The documentation on uBlock's github wiki was not clear enough for me on how to deploy settings. On the macOS side of things, pushing out the configuration profile was easy enough, but the ChromeOS configuration was a bit trickier.

Our configuration for our macs is:

      <dict>
        <key>PayloadType</key>
        <string>com.google.Chrome.extensions.cjpalhdlnbpafiamejdnhcphjbkeiagm</string>
        <key>PayloadVersion</key>
        <integer>1</integer>
        <key>PayloadIdentifier</key>
        <string>6104A0A4-10AB-4219-9AD7-8FADDB1EC29D</string>
        <key>PayloadUUID</key>
        <string>6104A0A4-10AB-4219-9AD7-8FADDB1EC29D</string>
        <key>PayloadEnabled</key>
        <true/>
        <key>PayloadDisplayName</key>
        <string>uBlock settings</string>
        <key>adminSettings</key>
        <string>{"userSettings":{"alwaysDetachLogger":true,"autoUpdate":true},"selectedFilterLists":["plowe-0","malware-1","malware-0","easyprivacy","easylist","ublock-unbreak","ublock-abuse","ublock-privacy","ublock-badware","ublock-filters","user-filters"],"netWhitelist":"about-scheme\nchrome-extension-scheme\nchrome-scheme\ncloud.sophos.com\nimaginelearning.com\nimaginelearning.net\nlibrary.bsd7.org\nmoz-extension-scheme\nopera-scheme\nsecure2.sophos.com\nvivaldi-scheme\nwww.dell.com\nwww.paragon-software.com\nwww.thedash.com\nwyciwyg-scheme\nwalsworthyearbooks.com"}</string>
      </dict>

Per the documentation: Now, the value for adminSettings must itself be a plain string, and this means we need to encode the above text into a string, using JSON.stringify. Here is a small utility to help you deal with this step: http://raymondhill.net/ublock/adminSetting.html.

We need to set the admin settings to a string value. For some reason this just really didn't sit with my brain when converting back to a JSON value for the Chrome config. I could see that there was a key caled adminSettings and that it needed a value that was a stringifyied dictionary of the settings. What I didn't realize is that for the ChromeOS json file is that it needed a key called Value and that it's value was the stringified dictionary.

Here is our ChromeOS configuration. Hopefully this helps.

{
    "adminSettings": {
        "Value": "{\"selectedFilterLists\":[\"plowe-0\",\"malware-1\",\"malware-0\",\"easyprivacy\",\"easylist\",\"ublock-unbreak\",\"ublock-abuse\",\"ublock-privacy\",\"ublock-badware\",\"ublock-filters\",\"user-filters\"],\"netWhitelist\":\"about-scheme\\nchrome-extension-scheme\\nchrome-scheme\\ncloud.sophos.com\\nimaginelearning.com\\nimaginelearning.net\\nlibrary.bsd7.org\\nmoz-extension-scheme\\nopera-scheme\\nsecure2.sophos.com\\nvivaldi-scheme\\nwww.dell.com\\nwww.paragon-software.com\\nwww.thedash.com\\nwyciwyg-scheme\\nwalsworthyearbooks.com\"}"
    }
}

To update and modify the values, I'd recommend using the adminSetting tool to un-stringify the JSON, make the change to the section you need, then re-stringify the edits.