How to complete the "PAM Authentication" task

@antonysavio1111

Hi! No need to setup .htaccess file.

Please go through this link CentOS 7 : Apache httpd : Basic Auth+PAM : Server World

1 Like

Thanks @Lakshmi , but than what was the expectation of Basic Auth in the task ?

HI @kiran I did all the steps but im able to access it without mentioning the username n password. What might have I done wrong? Pls help.

Hi @akshayyw and all geeks

hope below steps might help you, i followed exactly as below and was able to succeed.
make sure you do these steps in all 3 app servers

step1:
yum --enablerepo=epel -y install mod_authnz_external pwauth

step2: vi /etc/httpd/conf.d/authnz_external.conf
and add below details in this conf file

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

step3: mkdir -p /var/www/html/protected
vi /var/www/html/protected.index.html
you should see below content

step4: systemctl restart httpd

step5: curl -u username:password http:/localhost:8080/protected
you will get some reply in the shell sorry i missed to snip it.

step6: verify it by following step “d” in the question.
once you enter port 80 the page will open as test page, then enter /protected at an end in the url to open sub page. when this /protected page opens it asks for username and password.
Post giving correct credentials you will see the required page.

Let me know if it is worth for you all.

Regards,
Yogendra

1 Like

hey @balu.networks7

Hi @akshayyw and all geeks

hope below steps might help you, i followed exactly as below and was able to succeed.
make sure you do these steps in all 3 app servers

step1:
yum --enablerepo=epel -y install mod_authnz_external pwauth

step2: vi /etc/httpd/conf.d/authnz_external.conf
and add below details in this conf file

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

step3: mkdir -p /var/www/html/protected
vi /var/www/html/protected.index.html
you should see below content

step4: systemctl restart httpd

step5: curl -u username:password http:/localhost:8080/protected
you will get some reply in the shell sorry i missed to snip it.

step6: verify it by following step “d” in the question.
once you enter port 80 the page will open as test page, then enter /protected at an end in the url to open sub page. when this /protected page opens it asks for username and password.
Post giving correct credentials you will see the required page.

Let me know if it is worth for you all.

Regards,
Yogendra

1 Like

thanks @yogendra.Your solution helped me to get my task done successfully.

Cheers
Nidhin

1 Like

Solution for beginners : PAM Authentication For Apache Kodekloud

Follow the steps mention in this blog:
[CentOS 8 : Apache httpd : Configure mod_authnz_pam : Server World]