@@ -1074,7 +1074,54 @@ RUN mkdir -p -m755 /home/seluser/.pki/nssdb \ #create nssdb folder
1074
1074
&& pk12util -d sql:/home/seluser/.pki/nssdb -i client_cert.p12 -W password_of_clent_cert # client certificate install
1075
1075
```
1076
1076
This way the certificates will be installed and the node will start automatically as before.
1077
+ ___
1078
+
1079
+ ## Alternative method: Add certificates to existing Selenium based images for browsers
1080
+
1081
+ As an alternative, you can add your certificate files to existing Selenium images. This practical example
1082
+ assumes you have a known image to use as a build image and have a way to publish new images to your local
1083
+ docker registry.
1084
+
1085
+ This example uses a RedHat based distro as build image (Rocky Linux) but it can be * any* linux image of your choice.
1086
+ Please note that build instrutions will vary between distributions. You can check instructions for Ubuntu
1087
+ in previous example.
1088
+
1089
+ The example also assumes your internal CA is already in * /etc/pki/ca-trust/source/anchors/YOUR_CA.pem* ,
1090
+ the default location for Rocky Linux. Alternatively, you can also provide these files from your host and
1091
+ copy them into build image.
1092
+
1093
+ For Chrome and Edge browsers, the recipe is the same, just adapt image name (node-chrome or node-edge):
1094
+ ```
1095
+ # Get a standard image for creating nssdb file
1096
+ FROM rockylinux:8.6 as build
1097
+ RUN yum install -y nss-tools
1098
+ RUN mkdir -p -m755 /seluser/.pki/nssdb \
1099
+ && certutil -d sql:/seluser/.pki/nssdb -N --empty-password \
1100
+ && certutil -d sql:/seluser/.pki/nssdb -A -t "C,," -n YOUR_CA -i /etc/pki/ca-trust/source/anchors/YOUR_CA.pem \
1101
+ && chown -R 1200:1201 /seluser
1077
1102
1103
+ # Start from Selenium image and add relevant files from build image
1104
+ FROM selenium/node-chrome:4.9.1-20230508
1105
+ USER root
1106
+ COPY --from=build /seluser/ /home/seluser/
1107
+ USER seluser
1108
+ ```
1109
+
1110
+ Example for Firefox:
1111
+ ```
1112
+ # Get a standard image for working on
1113
+ FROM rockylinux:8.6 as build
1114
+ RUN mkdir -p "/distribution" "/certs" && \
1115
+ cp /etc/pki/ca-trust/source/anchors/YOUR_CA*.pem /certs/ && \
1116
+ echo '{ "policies": { "Certificates": { "Install": ["/opt/firefox-latest/YOUR_CA.pem"] }} }' >"/distribution/policies.json"
1117
+
1118
+ # Start from Selenium image and add relevant files from build image
1119
+ FROM selenium/node-firefox:4.9.1-20230508
1120
+ USER root
1121
+ COPY --from=build /certs /opt/firefox-latest
1122
+ COPY --from=build /distribution /opt/firefox-latest/distribution
1123
+ USER seluser
1124
+ ```
1078
1125
___
1079
1126
1080
1127
## Debugging
0 commit comments