How to complete the "PAM Authentication" task

Helpful hint & question is quite tricky @Inderpreet @kiran

This question was asked 23 days ago. I no longer remember the point of the task.
I will try again next time around.

Task: PAM Authentication for Apache.

@hprasanna @kiran @hasmukhrathod @Inderpreet @vijin.palazhi

as per this url: CentOS 7 : Apache httpd : Basic Auth+PAM : Server World

followed the steps until restarting httpd on app1 server. All went fine until this point.

when I am selecting port to view host1. I get below error message displayed.

what is it I am missing, any hint or place that I should look at, will help me.

Please comment. Thank you!

@swaroopcs88 protected directory supposed to be configured at URL /protected, did you try that?

@Inderpreet I am sorry, unable to understand the below requirement i.e. what action is required from me.

protected directory supposed to be configured at URL /protected, did you try that?

Hi there,

I am a pretty newbie and just was able to do a basic install of the Apache server. I never didnt encounter with a PAM in the real life.
Could someone help me out? Could you share the right solution with me, step by step? I have spent with this task several hours and do not know what to do.

Thanks a lot.

@OndrejH

Try CentOS 7 : Apache httpd : Basic Auth+PAM : Server World if it helps.

I have already tried that (also googled a lot) but didn’t help. Would be possible to share the right solution, step by step?

@Inderpreet @kodekloud-support3 @Ayman @mmumshad @kiran @andrzej @Krishna Can anyone please guide on task “PAM Authentication For Apache”. unable to understand the requirements in this task.

Followed the steps given in CentOS 6 - Apache httpd - Basic Auth + PAM : Server World and many other docs from google still its not successful.

Really it will be helpful if we get clear cut steps or clues to complete this task.

Thanks in advance for your help.

according to task install PAM configuration
write some config into PAM default config file
generate htpasswd
and check by curl -u user-name http://ip-addr:ip
hope you got it

Thanks for your reply @Tej-Singh-Rana.

“Generate htpasswd” - In the task its mentioned that “We dont want to use htpasswd file for authentication.” Please find the attached screenshot. Here is the confusion :slight_smile:

What is BASIC+PAM Authentication? is this .htaccess and PAM config?

CC: @mmumshad @Inderpreet

actually i replied according to PAM Authentication. Sorry, i don’t know your tasks was Basic Auth + PAM.

Hi @Inderpreet

I completed my task for PAM authentication on all three APP servers , but it is showed it was failed. Can you please help check why it failed.

Regards

Vikram

@vikki.saroha

Seems like you configured it to work on URL http://<website-url>:<apache_port> however in the question is was specifcally asked to run it on http://<website-url>:<apache_port>/protected URL.

Hi @kiran, @Inderpreet , @hprasanna , @Chudo
Since the question asks for Basic + PAM Authentication ,for the Basic Authentication part , do we need to also setup .htaccess file . If so what is the AuthUserFile to use since the question says to not use htpasswd file ?

@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