My generated CA and server certs do not work on my Ubuntu 22.04 host. Find a test script below. Does anyone have any hints on how to fix? Thanks in advance...
#!/usr/bin/env bash
# this script is to test certstrap on ubuntu 22.04
# - generating certs - works
# - installing certs in trusted root store - works
# - testing installed certs - fails
#
# this script requires:
# - certstrap - to generate a RootCA and Server cert
# - certigo - to inspect and validate certs
# - openssl - to run a test server and a test client
# - curl - to run a test client
# - browser - to run a test client
export args="-o TestOrg -c US"
echo "----- Generate RootCA (MyCA) and Server Cert (mycert)"
certstrap init $args -cn MyCA
certstrap request-cert $args --domain localhost --cn mycert
certstrap sign mycert --CA MyCA
echo "----- Install MyCA into trusted root store"
sudo cp out/MyCA.crt /usr/local/share/ca-certificates
sudo update-ca-certificates
echo "------ Examine the generated certs"
echo "Dump using certigo..."
certigo dump out/mycert.crt
echo "Verify using certigo..."
certigo verify --name=localhost out/mycert.crt
echo "------ test server"
echo "AFTER THE TEST SERVER STARTS, RUN TEST CLIENTS IN ANOTHER TERMINAL..."
echo "#> TESTCLIENT-1 - Connect using certigo..."
echo "certigo connect localhost:4444"
echo "#> TESTCLIENT-2 - Pull using openssl s_client..."
echo "echo | openssl s_client -connect localhost:4444"
echo "#> TESTCLIENT-3 - Pull using curl"
echo "curl https://localhost:4444"
echo "#> TESTCLIENT-4 - try in browser: https://localhost:4444"
echo "#"
echo "----- Starting test server!!"
openssl s_server --port 4444 -www -key out/mycert.key -cert out/mycert.crt
# TEST NOTES ON MY SYSTEM (Ubuntu 22.04):
#
# TESTCLIENT-1 and TESTCLIENT-2 WORKS
# TESTCLIENT-3 (curl https://localhost:4444) FAILS (no client cert available)
# TESTCLIENT-4 (chrome-browser https://localhost:4444) FAILS (NET::ERR_CERT_AUTHORITY_INVALID)
#
# WHY???????
My generated CA and server certs do not work on my Ubuntu 22.04 host. Find a test script below. Does anyone have any hints on how to fix? Thanks in advance...