httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrei Ivanov <andrei.iva...@gmail.com>
Subject [users@httpd] mod_lua and subprocess_env
Date Tue, 14 Feb 2017 11:38:14 GMT
Hi,
I'm trying to create a lua authorization script but I can't seem to access
the request environment:

require 'apache2'

function authz_check_remote_ip_in_client_san(r)
        r:err("remote_ip_in_client_san running...");
        r:alert("uri: " .. r.uri);
        r:alert("useragent_ip: " .. r.useragent_ip);
        local ip = r.subprocess_env["REMOTE_ADDRESS"];
        r:crit("REMOTE_ADDRESS: " .. (ip or "N/A"));
        r:emerg("SSL_CLIENT_SAN_IPaddr: " ..
(r.subprocess_env["SSL_CLIENT_SAN_IPaddr"] or "N/A"));

        return apache2.AUTHZ_GRANTED
end

The logs show entries like this for the values accessed from
r.subprocess_env:
REMOTE_ADDRESS: N/A
SSL_CLIENT_SAN_IPaddr: N/A


LuaScope thread
LuaAuthzProvider remote_ip_in_client_san
/etc/httpd/authz/authz_check_remote_ip_in_client_san.lua
authz_check_remote_ip_in_client_san
<Location />
    Require remote_ip_in_client_san

    # these don't seem to work so I'm trying to implement them in a LUA
script
    #NSSRequire %{REMOTE_ADDR} in %{SSL_CLIENT_SAN_IPaddr}
    #Require expr "%{REMOTE_ADDR} in %{SSL_CLIENT_SAN_IPaddr}"
</Location>

What am I doing wrong?

Thank you in advance.

Mime
View raw message