Inserting the client certificate in a header

mischamischa Member
When you need the client certificate on the real server:

when CLIENTSSL_CLIENTCERT { set cert [SSL::cert 0] session add ssl [SSL::sessionid] $cert } when HTTP_REQUEST { set cert [session lookup ssl [SSL::sessionid]] regsub -all {([\\-]+(BEGIN|END) CERTIFICATE[\\-]+)|\n} [X509::whole $cert] {} chdr HTTP::header insert CLIENT_CERT $chdr }

Comments

  • mischamischa Member
    edited February 2014
    Slightly modified version without the persistency table:

    when CLIENTSSL_CLIENTCERT { set cert [SSL::cert 0] } when HTTP_REQUEST { regsub -all {([\\-]+(BEGIN|END) CERTIFICATE[\\-]+)|\n} [X509::whole $cert] {} chdr HTTP::header insert X-CLIENT-CERT $chdr }
  • mischamischa Member
    edited February 2014
    Other alternative
    when HTTP_REQUEST { set cert [X509::whole [SSL::cert 0]] regsub -all {\n|-----BEGIN CERTIFICATE-----|-----END CERTIFICATE-----} $cert "" newcert HTTP::header insert "X-Client-SSL-Cert" $newcert }
Sign In or Register to comment.