Google Chrome settings from User Template - "Some settings were reset"

fernando_gonzal
Contributor

I've been trying to create a Composer pkg that places pre-configured Google Chrome settings into the User Template from

~/Library/Application Support/Google

but when I deploy this package to my test machines the settings won't apply and going to the Chrome settings provides the following message of "Some settings were reset"
53bf0cd0802c4f4aba9a940f5bee174d

So I know that other threads recommend using the Google Chrome Master Preferences via JSON coding but here's my dilemma:

I must include an extension, Color Enhancer in this case, but this extension must also be disabled by default.

Basically they only want the user the have the option to go to Extensions and enable Color Enhancer if they want.

While I think there are ways to use the Google Chrome Master Preferences and also add an extension I'm not aware of how to programmatically disable an extension BEFORE the profile in ~/Library/Application Support/Google has even been created.

To add to my problems the PC packager has this working on our Windows clients by doing the equivalent thing I am trying to do which is taking a pre-configured Google Chrome prefs folder and putting that into the Windows 10 default user profile.

Any suggestions on how to make my method work or if I can use the Google Chrome Master Preferences way plus add an extension that should be disabled by default?

Thanks.

1 ACCEPTED SOLUTION

fernando_gonzal
Contributor

@ssrussell thanks for taking the time to respond.

So in the end I managed to figure it out using the Google Chrome Master Preferences.

The key is to not try to manually code all the JSON and instead configure Google Chrome as you want it with all the settings and extensions that need to be configured. Then, as you mentioned, two key files are the “Preferences” and “Secure Preferences” located in ~/Library/Application Support/Google/Chrome/Default. While some values in Secure Preferences are encrypted or machine ID specific, all the values in the "Preferences" file are clear text and not machine specific and also already in the proper JSON format.

So rather than trying to look at the developer documentation for Chrome to figure out which JSON name/values correspond to a GUI setting simply take the "Preferences" file and rename it to Google Chrome Master Preferences.

If your Chrome settings are highly customized this literally takes care of 75% of everything. And the file just works!

As for the “Secure Preferences” you can also take a giant chunk out of it to make it useable for your Google Chrome Master Preferences file.

In Chrome's case “Secure Preferences” is what keeps all the configuration syntax for the Extensions including their state (enabled/disabled).

This section is not machine ID specific. So I copied the entire Extension array inside of “Secure Preferences” and pasted into my Google Chrome Master Preferences file.

I then used the super simple instructions on how to add External Extensions from the link below:
https://developer.chrome.com/extensions/external_extensions

Summary instructions for External Extensions:
Place the json file named using the ID of the extension you want in:
/Library/Application Support/Google/Chrome/External Extensions
Example:
/Library/Application Support/Google/Chrome/External Extensions/ipkjmjaledkapilfdigkgfmpekpfnkih.json

The actual JSON files all have the same content so the only unique thing about them is the actual name of the file:

  {
    "external_update_url": "https://clients2.google.com/service/update2/crx"
  }

As Chrome starts up it installs the Extensions but configures them per your Google Chrome Master Preferences file. Including whether they are Enabled or Disabled!

Secure Preferences also contains the object names you need for Homepage and Startup tabs but their values are encrypted so you cannot simply paste those. But simply looking at the object names sends you in the right direction. For that I mainly used Google's "Google Chrome Master Preferences" sample template file to create the Distribution array etc and pasted that in.

Actually another file that contains values you can copy and paste in the "Google Chrome Master Preferences" file is ~/Library/Application Support/Google/Chrome/Local State.

So while the Preferences file can just be renamed to Google Chrome Master Preferences as is once you start merging things from Secure Preferences or Local State you need to make sure that all your sections, brackets and comas are properly notated.
I used an online JavaScript Beautifier to convert single line JSON code to multi line for editing:
https://beautifier.io

And this JSON script verifier to validate my code format:
http://jslint.com

Everything worked after that!

View solution in original post

2 REPLIES 2

russeller
Contributor III

Hey @mk2000 take a look at this. I was experimenting with Chrome Preferences with the latest version and they now have “Preferences” and “Secure Preferences”. The idea is if malware found a way to modify your chrome preferences (homepage etc) it’ll revert the changes.

Hopefully you’ll find a way around this or you can also look at using a Config Profile with the com.google.Chrome plist that you can use to force some preferences and extensions. Guide on creating that Config Profile here.

If you are a jamf customer you can upload the configured plist as a “custom” setting in a macOS Config Profile. Be sure to convert it to the right format with

plutil -convert xml1 /path/to/com.google.Chrome.plist

before you upload it.

fernando_gonzal
Contributor

@ssrussell thanks for taking the time to respond.

So in the end I managed to figure it out using the Google Chrome Master Preferences.

The key is to not try to manually code all the JSON and instead configure Google Chrome as you want it with all the settings and extensions that need to be configured. Then, as you mentioned, two key files are the “Preferences” and “Secure Preferences” located in ~/Library/Application Support/Google/Chrome/Default. While some values in Secure Preferences are encrypted or machine ID specific, all the values in the "Preferences" file are clear text and not machine specific and also already in the proper JSON format.

So rather than trying to look at the developer documentation for Chrome to figure out which JSON name/values correspond to a GUI setting simply take the "Preferences" file and rename it to Google Chrome Master Preferences.

If your Chrome settings are highly customized this literally takes care of 75% of everything. And the file just works!

As for the “Secure Preferences” you can also take a giant chunk out of it to make it useable for your Google Chrome Master Preferences file.

In Chrome's case “Secure Preferences” is what keeps all the configuration syntax for the Extensions including their state (enabled/disabled).

This section is not machine ID specific. So I copied the entire Extension array inside of “Secure Preferences” and pasted into my Google Chrome Master Preferences file.

I then used the super simple instructions on how to add External Extensions from the link below:
https://developer.chrome.com/extensions/external_extensions

Summary instructions for External Extensions:
Place the json file named using the ID of the extension you want in:
/Library/Application Support/Google/Chrome/External Extensions
Example:
/Library/Application Support/Google/Chrome/External Extensions/ipkjmjaledkapilfdigkgfmpekpfnkih.json

The actual JSON files all have the same content so the only unique thing about them is the actual name of the file:

  {
    "external_update_url": "https://clients2.google.com/service/update2/crx"
  }

As Chrome starts up it installs the Extensions but configures them per your Google Chrome Master Preferences file. Including whether they are Enabled or Disabled!

Secure Preferences also contains the object names you need for Homepage and Startup tabs but their values are encrypted so you cannot simply paste those. But simply looking at the object names sends you in the right direction. For that I mainly used Google's "Google Chrome Master Preferences" sample template file to create the Distribution array etc and pasted that in.

Actually another file that contains values you can copy and paste in the "Google Chrome Master Preferences" file is ~/Library/Application Support/Google/Chrome/Local State.

So while the Preferences file can just be renamed to Google Chrome Master Preferences as is once you start merging things from Secure Preferences or Local State you need to make sure that all your sections, brackets and comas are properly notated.
I used an online JavaScript Beautifier to convert single line JSON code to multi line for editing:
https://beautifier.io

And this JSON script verifier to validate my code format:
http://jslint.com

Everything worked after that!