meta-ibm: Include google-auth PAM config files

This commit installs custom versions of common-auth, common-account
that enables google authenticator pam configuration.

Tested By:
* Verified that PAM config files are installed based on the distro
  feature enablement

Change-Id: Ifa721907b7f56847444edca3c5f2428ac3793583
Signed-off-by: Asmitha Karunanithi <asmitk01@in.ibm.com>
diff --git a/meta-ibm/recipes-extended/pam/libpam/pam.d/common-account b/meta-ibm/recipes-extended/pam/libpam/pam.d/common-account
new file mode 100644
index 0000000..f9759d5
--- /dev/null
+++ b/meta-ibm/recipes-extended/pam/libpam/pam.d/common-account
@@ -0,0 +1,29 @@
+#
+# /etc/pam.d/common-account - authorization settings common to all services
+#
+# This file is included from other service-specific PAM config files,
+# and should contain a list of the authorization modules that define
+# the central access policy for use on the system.  The default is to
+# only deny service to users whose accounts are expired in /etc/shadow.
+#
+# As of pam 1.0.1-6, this file is managed by pam-auth-update by default.
+# To take advantage of this, it is recommended that you configure any
+# local modules either before or after the default block, and use
+# pam-auth-update to manage selection of other modules.  See
+# pam-auth-update(8) for details.
+#
+
+# here are the per-package modules (the "Primary" block)
+account [success=ignore default=ignore]                         pam_google_authenticator.so
+account	[success=2 new_authtok_reqd=done default=ignore]	pam_unix.so
+-account [success=1 new_authtok_reqd=done default=ignore]    	pam_ldap.so	 ignore_unknown_user ignore_authinfo_unavail
+# here's the fallback if no module succeeds
+account	requisite			pam_deny.so
+# Announce if faillock is blocking access
+account	required			pam_faillock.so
+# prime the stack with a positive return value if there isn't one already;
+# this avoids us returning an error just because nothing sets a success code
+# since the modules above will each just jump around
+account	required			pam_permit.so
+# and here are more per-package modules (the "Additional" block)
+# end of pam-auth-update config
diff --git a/meta-ibm/recipes-extended/pam/libpam/pam.d/common-auth b/meta-ibm/recipes-extended/pam/libpam/pam.d/common-auth
new file mode 100644
index 0000000..65f9c83
--- /dev/null
+++ b/meta-ibm/recipes-extended/pam/libpam/pam.d/common-auth
@@ -0,0 +1,22 @@
+#
+# /etc/pam.d/common-auth - authentication settings common to all services
+#
+# This file is included from other service-specific PAM config files,
+# and should contain a list of the authentication modules that define
+# the central authentication scheme for use on the system
+# (e.g., /etc/shadow, LDAP, Kerberos, etc.).  The default is to use the
+# traditional Unix authentication mechanisms.
+
+# here are the per-package modules (the "Primary" block)
+# Try for local user first, and then try for ldap
+auth required pam_google_authenticator.so forward_pass nullok
+auth    [success=3 default=ignore]          pam_unix.so quiet
+-auth   [success=2 default=ignore]          pam_ldap.so ignore_unknown_user ignore_authinfo_unavail
+# Control gets here when no authentication module succeeds.  Increment the
+# failure tally and return failure status to PAM.
+auth    [default=die]                   pam_faillock.so authfail
+auth    requisite                       pam_deny.so
+# Control gets here when authentication succeeds.  Check if the user is locked
+# out due to consecutive authentication failures and return status accordingly.
+auth    required                        pam_faillock.so authsucc
+# and here are more per-package modules (the "Additional" block)
diff --git a/meta-ibm/recipes-extended/pam/libpam_%.bbappend b/meta-ibm/recipes-extended/pam/libpam_%.bbappend
new file mode 100644
index 0000000..676898f
--- /dev/null
+++ b/meta-ibm/recipes-extended/pam/libpam_%.bbappend
@@ -0,0 +1,5 @@
+FILESEXTRAPATHS:prepend:df-google-authenticator-libpam := "${THISDIR}/${PN}:"
+SRC_URI:append:df-google-authenticator-libpam = " \
+    file://pam.d/common-account \
+    file://pam.d/common-auth \
+"