如何确定连接在mod_perl中使用的SSL客户端证书?

时间:2022-10-05 17:33:00

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?

我正在Perl中编写一个Web服务,它将在SSL(HTTPS)下运行,并带有客户端证书。如何确定客户端在当前连接中使用的证书,以便我可以过滤掉不需要的证书?

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

注意:Web服务作为mod_perl脚本运行。

1 个解决方案

#1


Found the answer on PerlMonks:

在PerlMonks上找到答案:

Use the Apache::SSLLookup module

使用Apache :: SSLLookup模块

  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.

mod_ssl环境引用这里。

#1


Found the answer on PerlMonks:

在PerlMonks上找到答案:

Use the Apache::SSLLookup module

使用Apache :: SSLLookup模块

  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.

mod_ssl环境引用这里。