Skip to content

Commit c8fe922

Browse files
committed
chore: improve cert-signed.sh and doc
Signed-off-by: Sebastian Davids <[email protected]>
1 parent bbd94bb commit c8fe922

6 files changed

+32
-4
lines changed

README.adoc

+30-3
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ $ npm run docker:run:secure
456456

457457
[IMPORTANT]
458458
====
459-
You need to create the necessary private key and certificate via <<cert_self_signed>>.
459+
One needs to create the necessary private key and certificate via <<cert_self_signed>>.
460460
====
461461

462462
==== docker:sh
@@ -543,8 +543,35 @@ The generated certificate is valid for 10 days.
543543

544544
===== MacOS
545545

546-
You need to add the created certificate to _Keychain Access_.
546+
One needs to add the created certificate to one's login keychain:
547547

548-
Add `docker/app/cert.pem` to your "login" keychain and set _Secure Sockets Layer (SSL)_ to "Always Trust":
548+
[source,shell]
549+
----
550+
$ security add-trusted-cert -p ssl -k "$(security login-keychain | xargs)" docker/app/cert.pem
551+
----
552+
553+
Check your login keychain in _Keychain Access_; _Secure Sockets Layer (SSL)_ should be set to "Always Trust":
549554

550555
image::src/docs/asciidoc/images/self-signed-macos.png[]
556+
557+
[NOTE]
558+
====
559+
Chrome and Safari need no further configuration.
560+
====
561+
562+
===== Firefox (MOZILLA_PKIX_ERROR_SELF_SIGNED_CERT)
563+
564+
One needs to bypass the https://support.mozilla.org/en-US/kb/error-codes-secure-websites#w_self-signed-certificate[self-signed certificate warning] by clicking on "Advanced" and then "Accept the Risk and Continue":
565+
566+
image::src/docs/asciidoc/images/self-signed-firefox.png[]
567+
568+
[NOTE]
569+
====
570+
One can delete the bypass via `Firefox > Preferences > Privacy & Security > Certificates`; click "View Certificates...":
571+
572+
image::src/docs/asciidoc/images/self-signed-firefox-delete-1.png[]
573+
574+
Click on the "Servers" tab:
575+
576+
image::src/docs/asciidoc/images/self-signed-firefox-delete-2.png[]
577+
====

scripts/cert-self-signed.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ readonly days="${1:-10}"
2424

2525
mkdir -p docker/app
2626

27+
# https://developer.chrome.com/blog/chrome-58-deprecations/#remove_support_for_commonname_matching_in_certificates
2728
openssl req \
2829
-newkey rsa:2048 \
2930
-x509 \
@@ -33,6 +34,6 @@ openssl req \
3334
-out docker/app/cert.pem \
3435
-subj '/CN=localhost' \
3536
-extensions EXT -config <( \
36-
printf "[dn]\nCN=localhost\n[req]\ndistinguished_name = dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth") \
37+
printf "[dn]\nCN=localhost\n[req]\ndistinguished_name=dn\n[EXT]\nsubjectAltName=DNS:localhost\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth") \
3738
-sha256 \
3839
-days "${days}"
Loading
Loading
Loading
100 KB
Loading

0 commit comments

Comments
 (0)