Search code examples
clinuxcentoscentos7pam

PAM standard macros and logging on CentOS7


According to the D(x) macro defined in pam_macros.h (source code) and used as follows:

D(("Hello PAM World"));

Where is this log located on CentOS7?

Note that I am using as flag debug in my pam.d conf file.

I tried also the following command:

grep -rnw '/var/log/' -e "Hello Pam World"

But with no success.


Solution

  • In the file you link, there are these lines at the top:

    /*
     * This is for debugging purposes ONLY. DO NOT use on live systems !!!
     * You have been warned :-) - CG
     *
     * to get automated debugging to the log file, it must be created manually.
     * _PAM_LOGFILE must exist, mode 666
     */
    
    #ifndef _PAM_LOGFILE
    #define _PAM_LOGFILE "/tmp/pam-debug.log"
    #endif
    

    So it looks like the output will be directed to /tmp/pam-debug.log, but you have to create it before, and give it full read-write permissions:

    $ touch /tmp/pam-debug.log
    $ chmod 666 /tmp/pam-debug.log
    

    Looking to the Linux version of this file, it looks like it is written to /var/run/pam-debug.log, but only if it is compiled with PAM_DEBUG.

    There a nice comment in configure.ac:

    if test x"$enable_debug" = x"yes" ; then
           AC_DEFINE([PAM_DEBUG],,
                    [lots of stuff gets written to /var/run/pam-debug.log])