{"id":4,"date":"2007-08-08T18:15:41","date_gmt":"2007-08-08T22:15:41","guid":{"rendered":"http:\/\/blogs.law.harvard.edu\/mypain\/2007\/08\/08\/pam-configurations\/"},"modified":"2007-08-08T18:15:41","modified_gmt":"2007-08-08T22:15:41","slug":"pam-configurations","status":"publish","type":"post","link":"https:\/\/archive.blogs.harvard.edu\/mypain\/2007\/08\/08\/pam-configurations\/","title":{"rendered":"PAM configurations"},"content":{"rendered":"<p>Ok, so this one did not take me hours, but I did have to go read a manual because no one seems to explain these settings &#8211; everyone just says &#8220;hey!  these settings worked for me, plug em in.&#8221;  That was my cue to try and understand it better.<\/p>\n<p>Turns out that the <a href=\"http:\/\/www.kernel.org\/pub\/linux\/libs\/pam\/Linux-PAM-html\/Linux-PAM_SAG.html\">Linux PAM system administrators guide<\/a> was not really that bad and had some very useful explanations of how things work.<\/p>\n<p>One thing I was looking to find out what the new bracket &#8220;[]&#8221; syntax for PAM config files works.  Most admins will probably have seen this example somewhere:<\/p>\n<p><code>auth [success=1 default=ignore] pam_ldap.so<br \/>\nauth required pam_unix.so try_first_pass<br \/>\nauth required pam_permit.so <\/code><\/p>\n<p>What is up with those brackets?  Turns out its pretty simple.  According to the docs, the <code>value=action<\/code> control values are just a way of telling PAM what to do with the result of the rule (In this case, the rule is go check <code>pam_unix.so<\/code> and tell me what it said).<\/p>\n<p>The value for the control can be set to any of the return values of the rule &#8211; success being rather obvious, default meaning anything that I didnt explicitly write.  The action for the control can be ignore, bad, die, ok, done, reset or a number &#8211; the number just means skip the next N rules (the <a href=\"http:\/\/www.kernel.org\/pub\/linux\/libs\/pam\/Linux-PAM-html\/sag-configuration-file.html\">PAM SAG<\/a> explains the config syntax fully).<\/p>\n<p>In the above case, PAM is being instructed, in the <code>common-auth<\/code> config file to check LDAP first, ignore its failure if it cant find a username:password pair in the directory, or skip the next rule if it does find the pair.  If it fails, it falls back to local accounts, if it succeeds iit jumps to the <code>pam_permit.so<\/code> rule which just permits anything it gets (keep in mind that if any <code>required<\/code> rule fails, the whole block fails, so thats why <code>pam_permit.so<\/code> cant permit something that <code>pam_unix.so<\/code> fails).<\/p>\n<p>Thats it &#8211; pretty thought out by those clever PAM people.  I hope I&#8217;ve explained it well enough here to help out.  For a more in depth read, check out the <a href=\"http:\/\/www.kernel.org\/pub\/linux\/libs\/pam\/Linux-PAM-html\/Linux-PAM_SAG.html\">Linux PAM system administrators guide<\/a>.<\/p>\n<p>My &#8211; aww man, do I really have to read this manual &#8211; pain, your gain.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PAM is good stuff.  It abstracts the authentication for applications from the backend that will ultimately verify accounts and settings.  But what are those pesky brackets doing in that config file.  I thought that only required, sufficient and optional were required.<\/p>\n","protected":false},"author":758,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1855,1854,1853],"tags":[],"class_list":["post-4","post","type-post","status-publish","format-standard","hentry","category-configs","category-ldap","category-pam","post-preview"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/archive.blogs.harvard.edu\/mypain\/wp-json\/wp\/v2\/posts\/4","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/archive.blogs.harvard.edu\/mypain\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/archive.blogs.harvard.edu\/mypain\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/archive.blogs.harvard.edu\/mypain\/wp-json\/wp\/v2\/users\/758"}],"replies":[{"embeddable":true,"href":"https:\/\/archive.blogs.harvard.edu\/mypain\/wp-json\/wp\/v2\/comments?post=4"}],"version-history":[{"count":0,"href":"https:\/\/archive.blogs.harvard.edu\/mypain\/wp-json\/wp\/v2\/posts\/4\/revisions"}],"wp:attachment":[{"href":"https:\/\/archive.blogs.harvard.edu\/mypain\/wp-json\/wp\/v2\/media?parent=4"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/archive.blogs.harvard.edu\/mypain\/wp-json\/wp\/v2\/categories?post=4"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/archive.blogs.harvard.edu\/mypain\/wp-json\/wp\/v2\/tags?post=4"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}