PAM Authentication For Apache question


I am new to Linux.
I got the task named “PAM Authentication For Apache” and I followed the tutorial below.

  1. enable the httpd service in stapp01
  2. install PAM and configure mod_authnz_external pwauth in the ststor01
  3. restart the httpd service in stapp01

After all, doesn’t work. When I enter the locahost/protected page, it doesn’t ask for any authentication.
I have no idea now where can I find the error.
Can anyone give me some tips for it? Or is there any other tutorial I should read?

Many Thanks

1 Like


It’s working when I set it to the app server. My question is: does this suppose set to the directory /data under the ststor01 server?

you have to do all task in app server not in storage server. One of the directory is in storage server and that’s linked via NFS i guess. So make all changes in app server not in storage server.

thanks for the reply

Below steps works for me :

you have to do all task in all app servers not in storage server.

yum --enablerepo=epel -y install mod_authnz_external pwauth

vi /etc/httpd/conf.d/authnz_external.conf

Add below line end of file

<Directory /var/www/html/protected> 
    AuthType Basic
    AuthName "PAM Authentication"
    AuthBasicProvider external
    AuthExternal pwauth
    require valid-user

systemctl enable httpd && systemctl start httpd && systemctl status httpd

To validate in all app server

You can access the website on LBR link. To do so click on the + button on top of your terminal, select Select port to view on Host 1, and after adding port 80 click on Display Port

In URL please add ‘/protected’ to get subpage.

Using Curl

curl  http://stapp01:8080/protected/index.html -> it will give error
curl -u rose:TmPcZjtRQx http://stapp01:8080/protected/
curl -u rose:TmPcZjtRQx http://stapp01:8080/protected/index.html
curl -u rose:TmPcZjtRQx http://localhost:8080/protected/

curl http://stapp02:8080/protected/index.html -> it will give error
curl -u rose:TmPcZjtRQx http://stapp02:8080/protected/
curl -u rose:TmPcZjtRQx http://stapp02:8080/protected/index.html
curl -u rose:TmPcZjtRQx http://localhost:8080/protected/index.html
curl -u rose:TmPcZjtRQx http://localhost:8080/protected/

curl http://stapp03:8080/protected/index.html -> it will give error
curl -u rose:TmPcZjtRQx http://stapp03:8080/protected/
curl -u rose:TmPcZjtRQx http://stapp03:8080/protected/index.html
curl -u rose:TmPcZjtRQx http://localhost:8080/protected/
curl -u rose:TmPcZjtRQx http://stlb01:8080/protected/

1 Like