linux - Using client certificate in Curl command -


curl command:

curl -k -vvvv --request post --header "content-type: application/json" --cert client.pem:password --key key.pem "https://test.com:8443/testing" 

i trying send client certificate using curl command specified above. trying know following:

  1. what http request header should looking @ server side pull out client certificate http request.

  2. if cannot pull out client certificate on server side http request, can add custom request header in http request , send client certificate value of custom header. great if provide me example of approach.

tls client certificates not sent in http headers. transmitted client part of tls handshake, , server typically check validity of certificate during handshake well.

if certificate accepted, web servers can configured add headers transmitting certificate or information contained on certificate application. environment variables populated certificate information in apache , nginx can used in other directives setting headers.

as example of approach, following nginx config snippet validate client certificate, , set ssl_client_cert header pass entire certificate application. only set when certificate validated, application can parse certificate , rely on information bears.

server {     listen 443 ssl;     server_name example.com;     ssl_certificate /path/to/chainedcert.pem;  # server certificate     ssl_certificate_key /path/to/key;          # server key      ssl_client_certificate /path/to/ca.pem;    # client ca     ssl_verify_client on;     proxy_set_header ssl_client_cert $ssl_client_cert;      location / {         proxy_pass http://localhost:3000;     } } 

Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -