--- myst: html_meta: "description lang=en": "Chome Managed policy and extension configuration for Workspaces. Easily manage Chrome based browsers in Kasm Workspaces sessions for your organization." "keywords": "Kasm, How to, How-to, Chrome, Policies, Managed Policies" "property=og:locale": "en_US" --- ```{title} Chrome Managed Policies ``` # Chrome Managed Policies Kasm administrators may wish to have certain configurations be automatically set when launching new instances of Google Chrome in a Kasm Workspace. This guide will cover two different methods of achieving this. The first is to use the File Mapping feature to manage files in the Admin UI, that will be mapped to the inside of user containers. The second method is to create a custom Workspace Docker Image. See [Chrome Policies](https://chromeenterprise.google/policies/) for full documentation on what can managed in Chrome from managed policies. ## Video Tutorial This video walks through Chrome Managed Policies with Kasm Workspaces. ```{raw} html ``` ## File Mappings Administrators can add File Mappings to a {doc}`User <../guide/users>`, {doc}`Group <../guide/groups>`, or {doc}`Workspace <../guide/workspaces>` definition. File Mappings define file content and where that content will be placed in a container based session. The following examples show how to add a File Mappings to a Workspace definition to manage Chrome Managed Policies. ### Managed Bookmarks To build bookmarks into the image's bookmarks bar we will make use of the "ManagedBookmarks" Chrome Policy. 1. Using the following example, create a managed policy for Managed Bookmarks. ```json { "BookmarkBarEnabled": true, "ManagedBookmarks":[ { "toplevel_name":"Managed Bookmarks" }, { "name":"Google", "url":"google.com" }, { "name":"Youtube", "url":"youtube.com" }, { "name":"Chrome links", "children":[ { "name":"Chromium", "url":"chromium.org" }, { "name":"Chromium Developers", "url":"dev.chromium.org" } ] } ] } ``` 2. From the Admin panel in Kasm Workspaces, navigate to Workspaces and Edit the desired Workspace definition. 3. Scroll down to the bottom of the Edit Workspace page and click **Add File Mapping**. Provide the file mapping a name and description. 4. Set the destination to `/etc/opt/chrome/policies/managed/bookmarks.json` and copy in your policy json into the Content section. Click Add. ```{figure} /images/images/file_mapping.png :align: center Workspace File Definition ``` The next Workspace launched will have the file `/etc/opt/chrome/policies/managed/bookmarks.json` created with the content you defined. ### Managed Extensions To build extensions into the image we make use of the "ExtensionSettings" Chrome Policy. 1. Find a chrome extension you want to add to an image, in this case we will use "UBlock Origin" from the Chrome Web Store, making a note of the URL. ``` https://chrome.google.com/webstore/detail/ublock-origin/cjpalhdlnbpafiamejdnhcphjbkeiagm?hl=en ``` 2. Use the following example to create your Managed Policy to specify extensions to install. ```json { "ExtensionSettings": { "*": { "installation_mode": "blocked" }, "cjpalhdlnbpafiamejdnhcphjbkeiagm": { "installation_mode": "force_installed", "update_url": "https://clients2.google.com/service/update2/crx", "toolbar_pin" : "force_pinned" } } } ``` 2. From the Admin panel in Kasm Workspaces, navigate to Workspaces and Edit the desired Workspace definition. 3. Navigate to the **File Mapping** tab and click **Add File Mapping**. Provide the file mapping a name and description. 4. Set the destination to `/etc/opt/chrome/policies/managed/extensions.json` and copy in your policy json into the Content section. Click Save. ## Custom Image Another method for managing Chrome Managed Policies is to create a custom Docker image that incorporates all customizations. As an example we will be editing the [Kasm Chrome Dockerfile](https://github.com/kasmtech/workspaces-images/blob/develop/dockerfile-kasm-chrome), but any Desktop Dockerfile that installs Chrome can be used. For instructions on how to build a Kasm image please see the {doc}`Building Image Documentation. ` ### Managed Bookmarks To build bookmarks into the image's bookmarks bar we will make use of the "ManagedBookmarks" Chrome Policy. 1. Create a file called 'bookmarks.json' with the following contents: ```json { "BookmarkBarEnabled": true, "ManagedBookmarks":[ { "toplevel_name":"Managed Bookmarks" }, { "name":"Google", "url":"google.com" }, { "name":"Youtube", "url":"youtube.com" }, { "name":"Chrome links", "children":[ { "name":"Chromium", "url":"chromium.org" }, { "name":"Chromium Developers", "url":"dev.chromium.org" } ] } ] } ``` 2. Edit the following line just before the "End Customizations" line in the 'dockerfile-kasm-chrome' file. ``` COPY ./bookmarks.json /etc/opt/chrome/policies/managed/bookmarks.json ``` 3. Build the image using the instructions from the {doc}`Building Images Documentation. ` ### Managed Extensions To build extensions into the image we make use of the "ExtensionSettings" Chrome Policy. 1. Find a chrome extension you want to add to an image, in this case we will use "UBlock Origin" from the Chrome Web Store, making a note of the URL. ``` https://chrome.google.com/webstore/detail/ublock-origin/cjpalhdlnbpafiamejdnhcphjbkeiagm?hl=en ``` 2. Create a file called 'extensions.json' with the following contents, note the Extension ID is copied from the Chrome Web Store URL. ```json { "ExtensionSettings": { "*": { "installation_mode": "blocked" }, "cjpalhdlnbpafiamejdnhcphjbkeiagm": { "installation_mode": "force_installed", "update_url": "https://clients2.google.com/service/update2/crx", "toolbar_pin" : "force_pinned" } } } ``` 2. Edit the following line just before the "End Customizations" line in the 'dockerfile-kasm-chrome' file. ``` COPY ./extensions.json /etc/opt/chrome/policies/managed/extensions.json ``` 3. Build the image using the instructions from the {doc}`Building Images Documentation. `