I used openssl to generate the following certificates:
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout server.key -out server.crt -subj "/C=IT/ST=Mi/L=Milan/O=MyOrg/OU=RnD/CN=localhost/[email protected]"
openssl rsa -in server.key -out server.insicure.key
cat server.insicure.key > certificate.pem
cat server.crt >> certificate.pem
I then setup nginx to client-secure a site:
server {
listen 80 ssl;
root /var/www/site;
index index.html;
ssl_certificate /root/server.crt;
ssl_certificate_key /root/server.key;
ssl_client_certificate /root/certificate.pem;
ssl_verify_client on;
ssl_verify_depth 2;
location / {
try_files $uri $uri/ =404;
}
}
However, when I try to get the site with curl, it doesn't work as expected:
curl --cacert certificate.pem https://localhost:80
and I get the following error page from nginx:
<html>
<head><title>400 No required SSL certificate was sent</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<center>No required SSL certificate was sent</center>
<hr><center>nginx/1.14.0 (Ubuntu)</center>
</body>
</html>
Anything I'm doing wrong? Thanks