0

I wrote a pam_module whichs does a couple of things and became to huge to post any code here. It basically works similar to pam_abl but with a couple of additional features like City/Country based blocking as well as checking with a dns blacklist.

Now I want to give the user a reason why his login was not successful. Something like: login failed because your country is blocked.

I hope you get the idea. Although I did some research I did not find a possibility yet to do this in pam_auth. I hope someone can give me a hint and/or lead me in the right direction. Thanks in advance.

Edit: For anyone else with a similar problem: pam_info is what you are looking for.

Wirsiing
  • 77
  • 3
  • 9
  • The programming pages of this site _often provide help_ for a specific problem, but _rarely design_ a solution. You must typically show what you have tried. Don't post the whole thing, just a compilable snippet. Then describe what did not work with that method. You will get a better response. – ryyker Dec 25 '15 at 15:04
  • 1
    source of [`pam_motd`](http://manpages.ubuntu.com/manpages/wily/man8/pam_motd.8.html) or others should give you some idea how to write back to the user. – Jakuje Dec 25 '15 at 15:42
  • pam_motd was a good hint! pam_info 3 should be useful - if it is working in auth. Will test it and accept your answere if you want post it. And it does – Wirsiing Dec 25 '15 at 17:17
  • @ryyker Thanks for the tip. The thing is there should be (and there is) a pam function to communicate with the user. I just could not find it. That is why I asked here and Jakuje had actually a perfect answer which lead me into the right direction and it is working now. – Wirsiing Dec 25 '15 at 17:21
  • 1
    I'm glad @Jakuje was able to help! I notice you edited your post with the solution. Another option would be to paste that line into your own answer below, then, mark it as accepted (the hollow check mark to the left of your answer). That way the post is seen as complete for other users of this site. – ryyker Dec 25 '15 at 23:40

1 Answers1

0

Source code of pam_motd(8) or should give you some idea how to write back to the user.

Actually, there is function pam_info(3), which does exactly what you want.

Jakuje
  • 24,773
  • 12
  • 69
  • 75