Search code examples
regexapachemod-ssl

mod_ssl SSLRequire allow variable starting with underscore


I am trying to enforce a rule so that only variables staring with underscore can authenticate a site.

1.Trying with SSLRequire %{SSL_CLIENT_S_DN_CN} option(will take the client cert CN)

allow from all SSLOptions +StdEnvVars SSLRequireSSL

            SSLRequire  %{SSL_CLIENT_S_DN_CN} =~ ^_

            SSLVerifyClient require
            SSLVerifyDepth  5
            SSLUserName SSL_CLIENT_S_DN_CN
            RequestHeader set userid %{REMOTE_USER}s

Tried above but getting syntax error for SSLRequire %{SSL_CLIENT_S_DN_CN} =~ ^_


Solution

  • Achieved this by below.

    SSLRequire %{SSL_CLIENT_S_DN_CN} =~ m#(^_)#