ssl Chrome,Linux,headless,使用客户端证书

uklbhaso  于 2022-11-14  发布在  Linux
关注(0)|答案(1)|浏览(193)

I am having a problem passing my test user's PKI certificates in the headless mode. I am using Java Selenium WebDriver 4.3.0. When I run my test suite in normal mode, my profile and certificates are picked up perfectly. Profile users are selected by the ChromeOptions class by identifying the --user-data-dir= . I have different profiles for each of my test users. Then the certificate is selected by the policy setting (i.e, AutoSelectCertificateForUrls). That also works perfectly. As I navigate to different URL locations my test certificates are presented and accepted correctly when I run in the normal mode.
When I change the mode to Headless=true (i.e., ChromeOptions.addArguents("--headless"), it all falls apart and no certificate is presented when I open a Chrome browser and hit any webpage.
I found that Firefox was extremely simple to manage profiles and PKI test certificates!!! When a test runs in normal mode and works perfectly, all I have to do is set the FirefoxOptions.addCommandLineOptions("--headless"); and it still works perfectly in the headless mode. Not so with Chrome!!!
Does anyone know the correct solution? I could use the information. I am really stuck here.... Is there a way to still make Chrome present PKI certificates in headless mode or does anyone know that this feature really does not work for Chrome/Chromium? Then I could stop wasting my time!
Thanks in advance for your help!

fcg9iug3

fcg9iug31#

其实我找到了自己的答案。
不幸的是,它不起作用!
这是所有解释在下面的问题。
第1310715期:Headless Chrome未使用商店中已安装的客户端(身份验证)证书。

此问题显示重现的步骤。

用户代理:Mozilla/5.0(Windows NT 10.0;苹果网络工具包/537.36(KHTML,类似壁虎)Chrome浏览器/99.0.4844.82 Safari/537.36
重现问题的步骤:
1.在Web服务器后面有一个网站,该Web服务器具有使用SSL证书的浏览器客户端身份验证。
1.把证书安装在Chrome的$HOME/pki/nssdb文件夹下的证书库中,我的证书是pk 12格式的,所以我用pk 12 util安装了它。
1.安装必须退出,并显示:“pk 12 util:PKCS 12导入成功”消息。
1.在/etc/opt/chrome/policies/managed下向您的网站添加一个策略,以便Chrome自动向网站的Web服务器提供证书。
1.打开网站。
当浏览器以headless或headful模式启动时,浏览器应该向Web服务器提供证书并继续。
出了什么问题?只有在headful模式下浏览器才会向Web服务器提供证书。Headless模式则不会。日志中有以下错误:

问题回应声明如下:

Headless Chrome目前还没有实现客户端证书。将其转换为一个特性请求,以便headless用户可以进行分类。从机械上讲,客户端证书是通过CreateClientCertStore和SelectClientCertificate从//内容中产生的。Headless没有显示UI的方法,所以它总是在没有客户端证书的情况下继续运行。
https://bugs.chromium.org/p/chromium/issues/detail?id=1310715&q=component%3AInternals%3EHeadless&can=2

相关问题