通过pam_script进行PAM身份验证的Nginx

有没有人设置这样的配置?这不适合我.

我在Ubuntu 12.04上安装了Nginx-extras(它是用PAM模块构建的),并添加站点配置中:

location ^~ /restricted_place/ {
    auth_pam              "Please specify login and password from main_site";
    auth_pam_service_name "Nginx";
}

之后,在/etc/pam.d/Nginx中:

auth    required    pam_script.so dir=/path/to/my/auth_scripts

并写了simplest / path / to / my / auth_scripts / pam_script_auth(我也尝试编写复杂的脚本)

#!/bin/sh
exit 0 # should allow anyone

不起作用.该脚本已启动(我编写了完整的功能脚本,成功执行,检查凭据,写入自己的日志并返回正确的退出代码,执行时间明显长).但是没有授予访问权限,只有被拒绝.

在/var/log/Nginx/error.log中出现以下行:

2012/09/13 10:44:42 [alert] 1666#0: waitpid() Failed (10: No child processes)

如果我在/etc/pam.d/Nginx中指定:

auth    required    pam_unix.so

并授予www-data用户权限读取/ etc / shadow,unix授权正常.但脚本验证不起作用.

我无法理解,麻烦在哪里.它是在Nginx模块中还是在pam_script模块中?

最佳答案
nginx PAM module还运行PAM帐户操作,因此您还需要配置它.您可以使用pam_permit模块始终成功:

auth    required    pam_script.so dir=/path/to/my/auth_scripts
account required    pam_permit.so

相关文章

Nginx (engine x) 是一个高性能的HTTP和反向代理服务,也是一...
本地项目配置 1 复制 luffy/settings/dev.py为prop.py 修改l...
nginx不仅可以隐藏版本信息,还支持自定义web服务器信息 先看...
一 、此次漏洞分析 1 nginx HTTP/2漏洞 [nginx-announce] ng...
###进入nginx 目录cd /usr/local/nginx###递归显示 2 级目录...
在cmd命令窗口输入下面命令进行查看 tasklist /fi "ima...