Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save alanbacelar/a4365324c15e683a02cc6791c285a7ea to your computer and use it in GitHub Desktop.

Select an option

Save alanbacelar/a4365324c15e683a02cc6791c285a7ea to your computer and use it in GitHub Desktop.
Policy file to configure Chrome/Chromium to automatically select a client certificate (useful for Kiosk mode)
{
"AutoSelectCertificateForUrls": ["{\"pattern\":\"*\",\"filter\":{}}"]
}
@alanbacelar
Copy link
Author

Linux path: /etc/opt/chrome/policies/managed

@alanbacelar
Copy link
Author

alanbacelar commented Jun 29, 2023

LINUX: https://gist.github.com/njh/1d6f2c6acdf39fb3c1b0

MAC:

defaults write com.google.Chrome AutoSelectCertificateForUrls -array

defaults write com.google.Chrome AutoSelectCertificateForUrls -array-add -string '{"pattern":"[*.]","filter":{"ISSUER":{"CN":"NOME DA EMPRESA:227497234872"}}}'

WINDOWS:

Registros

  1. Click Start, click Run, type regedit in the Open box, and then click OK.

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome\AutoSelectCertificateForUrls]

name = 1
Value = {"pattern": "[*.]", "filter" : {}}


If you are using Google Chrome and Client SSL Cert and you are tired of constantly selecting certificates, try this:

  1. Download and extract Chrome policy templates from here: http://dl.google.com/dl/edgedl/chrome/policy/policy_templates.zip
  2. Start the Local Group Policy Editor: Start > Run > gpedit.msc > OK
  3. Right-click on Computer Policy > Computer Configuration > Administrative Templates and choose Add/Remove Templates…
  4. Click Add…, choose policy_templates\windows\adm\en-US\chrome.adm (from the already downloaded and extracted policy templates) and click Open (Note: if your Windows language is different from en-US choose the chrome.adm from the respective language folder)
  5. Navigate to Local Computer Policy > Computer Configuration > Administrative Templates > Classic Administrative Templates (ADM) > Google > Google Chrome > Content Settings
  6. Double-click on Automatically select client certificates for these sites
  7. Click Enabled
  8. Click Show… in the Options pane
  9. Consecutively add the following lines:

{"pattern":"https://[*.]example.com","filter":{"ISSUER":{"CN":"example.com"}}}

  1. Click OK
  2. Re-launch Chrome
  3. Done. No more annoying pop-ups!

If you’re on a Mac you’ll have to create/edit file /Library/Preferences/com.google.Chrome.plist and insert the following code (extend it for more server addresses):

<plist version="1.0″>

AutoSelectCertificateForUrls

{"pattern":"[*.]example.corp","filter":{"ISSUER":{"CN":"example.com"}}}


For all sites:
{"pattern":"https://","filter":{}}
{"pattern": "[
.]", "filter" : {"ISSUER": {"CN":"AC SOLUTI Multipla v5"} } }

@alanbacelar
Copy link
Author

@ram-wesco
Copy link

ram-wesco commented Jul 18, 2025

Can anyone help here. I tried placing the JSON file in /etc/opt/chrome/policies/managed on my Linux GitHub Actions runner.

But the Chrome policy is not updated. We use Setup Chrome job for our workflow. Where should we place the json file for chrome to detect the policy

Mine is Ubuntu Distro

@dansiqces
Copy link

It worked for me for all sites by adding this to windows register:
{"pattern": "*", "filter": { "ISSUER": { "CN": "your_issuer_cn" }, "SUBJECT": { "CN": "your_subject_cn" } }}

@ram-wesco
Copy link

It works fine on Windows but does not work on Linux with ChromeForTesting builds.
I have already logged a bug on Chromium site.

With Chrome Official build, it works fine on Linux as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment