Skip to content

Nginx with PAM authentication through pam_script #221

@kuznetcoff777

Description

@kuznetcoff777

System information

Operating system (e.g. Ubuntu 22.04): oracle linux 8.5
Do you use selinux? (check with e.g. sestatus): disabled

Steps to reproduce

  1. Assembled nginx docker container with pam auth module, added apk google-authenticator to container
  2. /etc/pam.d/nginx contains this:
    auth required /lib/security/pam_google_authenticator.so
  3. locally created /root/.google_authenticator - chekcked it via sshd pam, works
  4. nginx.conf has this in config
    load_module /etc/nginx/modules/ngx_http_auth_pam_module.so;

and this in location /

                auth_pam "Secure area";
                auth_pam_service_name "nginx";

5 launching docker
docker run --name nginx-pam -e TZ="Europe/Moscow" --network host -v /etc/ssl/nginx:/etc/ssl/nginx:ro -v /etc/pam.d/nginx:/etc/pam.d/nginx:ro -v /etc/nginx/nginx.conf:/etc/nginx/nginx.conf:ro -v /root/.google_authenticator:/root/.google_authenticator -d nginx-pam-assemble

When enter http address in browser i see http auth "Secure area", but when enter root and OTP - in logs i see this:

2022/12/30 12:47:26 [error] 23#23: *3 PAM: user 'root' - not authenticated: Authentication failure, client: 1.1.1.1, server: _, request: "GET / HTTP/1.1", host: "2.2.2.2"

If i do something wrong and it cannot work as i expect?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions