diff options
author | Sebastian <sebasjm@gmail.com> | 2022-12-06 09:21:17 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-12-06 09:21:17 -0300 |
commit | e382b022030db96b8282337b304ec5e599a5f405 (patch) | |
tree | 6ba9afb72a1b3e5ce35f37a987d74286b0e45c92 /packages/web-util/create_certificate.sh | |
parent | 219e48f35196e54361dc17d6ca7de6e095c46eeb (diff) | |
download | wallet-core-e382b022030db96b8282337b304ec5e599a5f405.tar.xz |
web-util: utils for developing webapps
Diffstat (limited to 'packages/web-util/create_certificate.sh')
-rw-r--r-- | packages/web-util/create_certificate.sh | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/packages/web-util/create_certificate.sh b/packages/web-util/create_certificate.sh new file mode 100644 index 000000000..980aaf642 --- /dev/null +++ b/packages/web-util/create_certificate.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash +set -eu +org=localhost-ca +domain=localhost + +rm -rf keys +mkdir keys +cd keys + +openssl genpkey -algorithm RSA -out ca.key +openssl req -x509 -key ca.key -out ca.crt \ + -subj "/CN=$org/O=$org" + +openssl genpkey -algorithm RSA -out "$domain".key +openssl req -new -key "$domain".key -out "$domain".csr \ + -subj "/CN=$domain/O=$org" + +openssl x509 -req -in "$domain".csr -days 365 -out "$domain".crt \ + -CA ca.crt -CAkey ca.key -CAcreateserial \ + -extfile <(cat <<END +basicConstraints = CA:FALSE +subjectKeyIdentifier = hash +authorityKeyIdentifier = keyid,issuer +subjectAltName = DNS:$domain +END + ) + +sudo cp ca.crt /usr/local/share/ca-certificates/testing.crt +sudo update-ca-certificates + + +echo ' +## Chrome +1. go to chrome://settings/certificates +2. tab "authorities" +3. button "import" +4. choose "ca.crt" +5. trust for identify websites + +## Firefox +1. go to about:preferences#privacy +2. button "view certificates" +3. button "import" +4. choose "ca.crt" +5. trust for identify websites +' + +echo done! |