Puppeteer: Client certificate authentication

 

I was struggling with the client certificate with Puppeteer. Can you use client certificate for authentication? Yes, you can , but you have to do 3 things:

– Run the puppeteer in normal mode (headlesss=false)
– Import the certificate to your profile , you need a certificate file in pfx format , this is my script to import

echo "Importing certificate" mkdir -p $HOME/.pki/nssdb certutil -d sql:$HOME/.pki/nssdb -N --empty-password certutil -d sql:$HOME/.pki/nssdb -L pk12util -d sql:$HOME/.pki/nssdb -i /config/cert.pfx -W ""

– Update the policy:
/etc/chromium/policies/managed/policy.json ( if you using Chrome, then it should be /etc/opt/chrome/policies/managed/policy.json)
Here is my sample file:

 

{
"AutoSelectCertificateForUrls": ["{\"pattern\":\"*\",\"filter\":{}}"]
,
"AuthServerWhitelist": "*.org",
"AuthNegotiateDelegateWhitelist": "*.org" ,
"AuthSchemes":"basic,digest,ntlm,negotiate",
"DisableAuthNegotiateCnameLookup": true

}

Leave a Reply

Your email address will not be published. Required fields are marked *