Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Certs Failing on Ubuntu 22.04 #218

Open
andyl opened this issue Dec 18, 2023 · 0 comments
Open

Certs Failing on Ubuntu 22.04 #218

andyl opened this issue Dec 18, 2023 · 0 comments

Comments

@andyl
Copy link

andyl commented Dec 18, 2023

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???????
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant