Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I determine which SSL client certificate a connection is using in mod_perl?

I am writing a web service in Perl that will run under SSL (HTTPS) with client certificates. How can I determine which certificate is being used by the client in the current connection so I can filter out unwanted ones?

Note: the web service is being run as a mod_perl script.

like image 904
Sklivvz Avatar asked Mar 30 '09 11:03

Sklivvz


People also ask

How do I check my SSL certificate details?

Chrome has made it simple for any site visitor to get certificate information with just a few clicks: Click the padlock icon in the address bar for the website. Click on Certificate (Valid) in the pop-up. Check the Valid from dates to validate the SSL certificate is current.

How do I find client and server certificates?

Just ask Equifax! Client certificates also use public key infrastructure (PKI) for authentication, just like Server certificates. However, there is one significant difference between the two. Unlike Server certificates, Client certificates don't encrypt any data; they're installed for validation purposes only.

How do I find the SSL certificate on my server?

Android (v.Click the padlock icon next to the URL. Then click the "Details" link. 2. From here you can see some more information about the certificate and encrypted connection, including the issuing CA and some of the cipher, protocol, and algorithm information.

How do I find client certificate settings?

In Chrome, go to Settings. On the Settings page, below Default browser, click Show advanced settings. Under HTTPS/SSL, click Manage certificates. In the Certificates window, on the Personal tab, you should see your Client Certificate.


1 Answers

Found the answer on PerlMonks:

Use the Apache::SSLLookup module

  sub handler {
    my $r = Apache::SSLLookup->new(shift);
    my $request_is_over_ssl = $r->is_https;
    my $certificate = $r->lookup_var('SSL_CLIENT_CERT');

    ...
  }

mod_ssl environment reference here.

like image 183
Sklivvz Avatar answered Oct 12 '22 13:10

Sklivvz