summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/pam
diff options
context:
space:
mode:
authorAdrian Dudau <adrian.dudau@enea.com>2013-12-12 13:38:32 +0100
committerAdrian Dudau <adrian.dudau@enea.com>2013-12-12 13:50:20 +0100
commite2e6f6fe07049f33cb6348780fa975162752e421 (patch)
treeb1813295411235d1297a0ed642b1346b24fdfb12 /meta/recipes-extended/pam
downloadpoky-e2e6f6fe07049f33cb6348780fa975162752e421.tar.gz
initial commit of Enea Linux 3.1
Migrated from the internal git server on the dora-enea branch Signed-off-by: Adrian Dudau <adrian.dudau@enea.com>
Diffstat (limited to 'meta/recipes-extended/pam')
-rw-r--r--meta/recipes-extended/pam/libpam/99_pam1
-rw-r--r--meta/recipes-extended/pam/libpam/add-checks-for-crypt-returning-NULL.patch63
-rw-r--r--meta/recipes-extended/pam/libpam/destdirfix.patch24
-rw-r--r--meta/recipes-extended/pam/libpam/fixsepbuild.patch24
-rw-r--r--meta/recipes-extended/pam/libpam/libpam-fix-for-CVE-2010-4708.patch41
-rw-r--r--meta/recipes-extended/pam/libpam/libpam-xtests.patch35
-rw-r--r--meta/recipes-extended/pam/libpam/pam-no-innetgr.patch97
-rw-r--r--meta/recipes-extended/pam/libpam/pam-security-abstract-securetty-handling.patch200
-rw-r--r--meta/recipes-extended/pam/libpam/pam-unix-nullok-secure.patch222
-rw-r--r--meta/recipes-extended/pam/libpam/pam.d/common-account25
-rw-r--r--meta/recipes-extended/pam/libpam/pam.d/common-auth18
-rw-r--r--meta/recipes-extended/pam/libpam/pam.d/common-password26
-rw-r--r--meta/recipes-extended/pam/libpam/pam.d/common-session19
-rw-r--r--meta/recipes-extended/pam/libpam/pam.d/common-session-noninteractive19
-rw-r--r--meta/recipes-extended/pam/libpam/pam.d/other24
-rw-r--r--meta/recipes-extended/pam/libpam/reflect-the-enforce_for_root-semantics-change-in-pam.patch35
-rw-r--r--meta/recipes-extended/pam/libpam_1.1.6.bb116
17 files changed, 989 insertions, 0 deletions
diff --git a/meta/recipes-extended/pam/libpam/99_pam b/meta/recipes-extended/pam/libpam/99_pam
new file mode 100644
index 0000000000..97e990d10b
--- /dev/null
+++ b/meta/recipes-extended/pam/libpam/99_pam
@@ -0,0 +1 @@
d root root 0755 /var/run/sepermit none
diff --git a/meta/recipes-extended/pam/libpam/add-checks-for-crypt-returning-NULL.patch b/meta/recipes-extended/pam/libpam/add-checks-for-crypt-returning-NULL.patch
new file mode 100644
index 0000000000..d364cea97e
--- /dev/null
+++ b/meta/recipes-extended/pam/libpam/add-checks-for-crypt-returning-NULL.patch
@@ -0,0 +1,63 @@
1Backport from linux-pam git repo.
2
3[YOCTO #4107]
4
5Upstream-Status: Backport
6
7Signed-off-by: Kang Kai <kai.kang@windriver.com>
8
9From 8dc056c1c8bc7acb66c4decc49add2c3a24e6310 Mon Sep 17 00:00:00 2001
10From: Tomas Mraz <tmraz@fedoraproject.org>
11Date: Fri, 8 Feb 2013 15:04:26 +0100
12Subject: [PATCH] Add checks for crypt() returning NULL.
13
14modules/pam_pwhistory/opasswd.c (compare_password): Add check for crypt() NULL return.
15modules/pam_unix/bigcrypt.c (bigcrypt): Likewise.
16---
17 modules/pam_pwhistory/opasswd.c | 2 +-
18 modules/pam_unix/bigcrypt.c | 9 +++++++++
19 2 files changed, 10 insertions(+), 1 deletions(-)
20
21diff --git a/modules/pam_pwhistory/opasswd.c b/modules/pam_pwhistory/opasswd.c
22index 274fdb9..836d713 100644
23--- a/modules/pam_pwhistory/opasswd.c
24+++ b/modules/pam_pwhistory/opasswd.c
25@@ -108,7 +108,7 @@ compare_password(const char *newpass, const char *oldpass)
26 outval = crypt (newpass, oldpass);
27 #endif
28
29- return strcmp(outval, oldpass) == 0;
30+ return outval != NULL && strcmp(outval, oldpass) == 0;
31 }
32
33 /* Check, if the new password is already in the opasswd file. */
34diff --git a/modules/pam_unix/bigcrypt.c b/modules/pam_unix/bigcrypt.c
35index e10d1c5..e1d57a0 100644
36--- a/modules/pam_unix/bigcrypt.c
37+++ b/modules/pam_unix/bigcrypt.c
38@@ -109,6 +109,10 @@ char *bigcrypt(const char *key, const char *salt)
39 #else
40 tmp_ptr = crypt(plaintext_ptr, salt); /* libc crypt() */
41 #endif
42+ if (tmp_ptr == NULL) {
43+ free(dec_c2_cryptbuf);
44+ return NULL;
45+ }
46 /* and place in the static area */
47 strncpy(cipher_ptr, tmp_ptr, 13);
48 cipher_ptr += ESEGMENT_SIZE + SALT_SIZE;
49@@ -130,6 +134,11 @@ char *bigcrypt(const char *key, const char *salt)
50 #else
51 tmp_ptr = crypt(plaintext_ptr, salt_ptr);
52 #endif
53+ if (tmp_ptr == NULL) {
54+ _pam_overwrite(dec_c2_cryptbuf);
55+ free(dec_c2_cryptbuf);
56+ return NULL;
57+ }
58
59 /* skip the salt for seg!=0 */
60 strncpy(cipher_ptr, (tmp_ptr + SALT_SIZE), ESEGMENT_SIZE);
61--
621.7.5.4
63
diff --git a/meta/recipes-extended/pam/libpam/destdirfix.patch b/meta/recipes-extended/pam/libpam/destdirfix.patch
new file mode 100644
index 0000000000..52145ecb34
--- /dev/null
+++ b/meta/recipes-extended/pam/libpam/destdirfix.patch
@@ -0,0 +1,24 @@
1Avoid the failure:
2
3| mkdir -p /etc/security/namespace.d
4| mkdir: cannot create directory `/etc/security/namespace.d': Permission denied
5
6if /etc/security/namespace.d doesn't exist. The DESTDIR prefix is missing.
7
8RP 2012/8/19
9
10Upstream-Status: Pending
11
12Index: Linux-PAM-1.1.6/modules/pam_namespace/Makefile.am
13===================================================================
14--- Linux-PAM-1.1.6.orig/modules/pam_namespace/Makefile.am 2012-08-15 11:08:43.000000000 +0000
15+++ Linux-PAM-1.1.6/modules/pam_namespace/Makefile.am 2012-08-19 12:25:32.311038943 +0000
16@@ -40,7 +40,7 @@
17 secureconf_SCRIPTS = namespace.init
18
19 install-data-local:
20- mkdir -p $(namespaceddir)
21+ mkdir -p $(DESTDIR)$(namespaceddir)
22 endif
23
24
diff --git a/meta/recipes-extended/pam/libpam/fixsepbuild.patch b/meta/recipes-extended/pam/libpam/fixsepbuild.patch
new file mode 100644
index 0000000000..8a9c3b2fa1
--- /dev/null
+++ b/meta/recipes-extended/pam/libpam/fixsepbuild.patch
@@ -0,0 +1,24 @@
1Fix the build error when a separate build directory is used:
2
3Making install in xtestsmake[1]: Entering directory `/media/build1/poky/build1/tmp/work/i586-poky-linux/libpam/1.1.6-r2/build/xtests'/usr/bin/install -c -d /media/build1/poky/build1/tmp/work/i586-poky-linux/libpam/1.1.6-r2/image/usr/share/Linux-PAM/xtestsfor file in run-xtests.sh tst-pam_dispatch1.pamd tst-pam_dispatch2.pamd tst-pam_dispatch3.pamd tst-pam_dispatch4.pamd tst-pam_dispatch5.pamd tst-pam_cracklib1.pamd tst-pam_cracklib2.pamd tst-pam_unix1.pamd tst-pam_unix2.pamd tst-pam_unix3.pamd tst-pam_unix4.pamd tst-pam_unix1.sh tst-pam_unix2.sh tst-pam_unix3.sh tst-pam_unix4.sh access.conf tst-pam_access1.pamd tst-pam_access1.sh tst-pam_access2.pamd tst-pam_access2.sh tst-pam_access3.pamd tst-pam_access3.sh tst-pam_access4.pamd tst-pam_access4.sh limits.conf tst-pam_limits1.pamd tst-pam_limits1.sh tst-pam_succeed_if1.pamd tst-pam_succeed_if1.sh group.conf tst-pam_group1.pamd tst-pam_group1.sh tst-pam_authfail.pamd tst-pam_authsucceed.pamd tst-pam_substack1.pamd tst-pam_substack1a.pamd tst-pam_substack1.sh tst-pam_substack2.pamd tst-pam_substack2a.pamd tst-pam_substack2.sh tst-pam_substack3.pamd tst-pam_substack3a.pamd tst-pam_substack3.sh tst-pam_substack4.pamd tst-pam_substack4a.pamd tst-pam_substack4.sh tst-pam_substack5.pamd tst-pam_substack5a.pamd tst-pam_substack5.sh tst-pam_assemble_line1.pamd tst-pam_assemble_line1.sh tst-pam_pwhistory1.pamd tst-pam_pwhistory1.sh tst-pam_time1.pamd time.conf ; do \/usr/bin/install -c $file /media/build1/poky/build1/tmp/work/i586-poky-linux/libpam/1.1.6-r2/image/usr/share/Linux-PAM/xtests ; \ done
4/usr/bin/install: cannot stat `run-xtests.sh': No such file or directory
5/usr/bin/install: cannot stat `tst-pam_dispatch1.pamd': No such file or directory
6/usr/bin/install: cannot stat `tst-pam_dispatch2.pamd': No such file or directory
7
8Upstream-Status: Pending
9
10RP 2013/03/21
11
12Index: Linux-PAM-1.1.6/xtests/Makefile.am
13===================================================================
14--- Linux-PAM-1.1.6.orig/xtests/Makefile.am 2013-03-08 12:26:30.360266000 +0000
15+++ Linux-PAM-1.1.6/xtests/Makefile.am 2013-03-21 11:39:58.557166650 +0000
16@@ -59,7 +59,7 @@
17 install_xtests:
18 $(INSTALL) -d $(DESTDIR)$(pkgdatadir)/xtests
19 for file in $(EXTRA_DIST) ; do \
20- $(INSTALL) $$file $(DESTDIR)$(pkgdatadir)/xtests ; \
21+ $(INSTALL) $(srcdir)/$$file $(DESTDIR)$(pkgdatadir)/xtests ; \
22 done
23 for file in $(XTESTS); do \
24 $(INSTALL) .libs/$$file $(DESTDIR)$(pkgdatadir)/xtests ; \
diff --git a/meta/recipes-extended/pam/libpam/libpam-fix-for-CVE-2010-4708.patch b/meta/recipes-extended/pam/libpam/libpam-fix-for-CVE-2010-4708.patch
new file mode 100644
index 0000000000..5d2b69aae0
--- /dev/null
+++ b/meta/recipes-extended/pam/libpam/libpam-fix-for-CVE-2010-4708.patch
@@ -0,0 +1,41 @@
1Upstream-Status: Backport
2
3Fix for CVE-2010-4708
4
5Change default for user_readenv to 0 and document the
6new default for user_readenv.
7
8This fix is got from:
9http://pam.cvs.sourceforge.net/viewvc/pam/Linux-PAM/modules/pam_env
10/pam_env.c?r1=1.22&r2=1.23&view=patch
11http://pam.cvs.sourceforge.net/viewvc/pam/Linux-PAM/modules/pam_env
12/pam_env.8.xml?r1=1.7&r2=1.8&view=patch
13
14Signed-off-by: Wenzong Fan <wenzong.fan@windriver.com>
15
16---
17--- a/modules/pam_env/pam_env.c 2012-09-05 13:57:47.000000000 +0800
18+++ b/modules/pam_env/pam_env.c 2012-09-05 13:58:05.000000000 +0800
19@@ -10,7 +10,7 @@
20 #define DEFAULT_READ_ENVFILE 1
21
22 #define DEFAULT_USER_ENVFILE ".pam_environment"
23-#define DEFAULT_USER_READ_ENVFILE 1
24+#define DEFAULT_USER_READ_ENVFILE 0
25
26 #include "config.h"
27
28--- a/modules/pam_env/pam_env.8.xml 2012-09-05 13:58:24.000000000 +0800
29+++ b/modules/pam_env/pam_env.8.xml 2012-09-05 13:59:36.000000000 +0800
30@@ -147,7 +147,10 @@
31 <listitem>
32 <para>
33 Turns on or off the reading of the user specific environment
34- file. 0 is off, 1 is on. By default this option is on.
35+ file. 0 is off, 1 is on. By default this option is off as user
36+ supplied environment variables in the PAM environment could affect
37+ behavior of subsequent modules in the stack without the consent
38+ of the system administrator.
39 </para>
40 </listitem>
41 </varlistentry>
diff --git a/meta/recipes-extended/pam/libpam/libpam-xtests.patch b/meta/recipes-extended/pam/libpam/libpam-xtests.patch
new file mode 100644
index 0000000000..be687457f8
--- /dev/null
+++ b/meta/recipes-extended/pam/libpam/libpam-xtests.patch
@@ -0,0 +1,35 @@
1This patch is used to create a new sub package libpam-xtests to do more checks.
2
3Upstream-Status: Pending
4
5Signed-off-by: Kang Kai <kai.kang@windriver.com>
6--- Linux-PAM-1.1.4/xtests/Makefile.am.orig 2011-07-19 17:00:09.619980001 +0800
7+++ Linux-PAM-1.1.4/xtests/Makefile.am 2011-07-19 16:54:00.229979998 +0800
8@@ -7,7 +7,7 @@
9 AM_LDFLAGS = -L$(top_builddir)/libpam -lpam \
10 -L$(top_builddir)/libpam_misc -lpam_misc
11
12-CLEANFILES = *~ $(XTESTS)
13+CLEANFILES = *~
14
15 EXTRA_DIST = run-xtests.sh tst-pam_dispatch1.pamd tst-pam_dispatch2.pamd \
16 tst-pam_dispatch3.pamd tst-pam_dispatch4.pamd \
17@@ -51,3 +51,18 @@
18
19 xtests: $(XTESTS) run-xtests.sh
20 "$(srcdir)"/run-xtests.sh "$(srcdir)" ${XTESTS} ${NOSRCTESTS}
21+
22+all: $(XTESTS)
23+
24+install: install_xtests
25+
26+install_xtests:
27+ $(INSTALL) -d $(DESTDIR)$(pkgdatadir)/xtests
28+ for file in $(EXTRA_DIST) ; do \
29+ $(INSTALL) $$file $(DESTDIR)$(pkgdatadir)/xtests ; \
30+ done
31+ for file in $(XTESTS); do \
32+ $(INSTALL) .libs/$$file $(DESTDIR)$(pkgdatadir)/xtests ; \
33+ done
34+
35+.PHONY: all install_xtests
diff --git a/meta/recipes-extended/pam/libpam/pam-no-innetgr.patch b/meta/recipes-extended/pam/libpam/pam-no-innetgr.patch
new file mode 100644
index 0000000000..5e551ac48f
--- /dev/null
+++ b/meta/recipes-extended/pam/libpam/pam-no-innetgr.patch
@@ -0,0 +1,97 @@
1innetgr may not be there so make sure that when innetgr is not present
2then we inform about it and not use it.
3
4-Khem
5
6Upstream-Status: Pending
7
8Signed-off-by: Scott Garman <scott.a.garman@intel.com>
9
10Index: Linux-PAM-1.1.3/modules/pam_group/pam_group.c
11===================================================================
12--- Linux-PAM-1.1.3.orig/modules/pam_group/pam_group.c
13+++ Linux-PAM-1.1.3/modules/pam_group/pam_group.c
14@@ -659,7 +659,11 @@ static int check_account(pam_handle_t *p
15 }
16 /* If buffer starts with @, we are using netgroups */
17 if (buffer[0] == '@')
18- good &= innetgr (&buffer[1], NULL, user, NULL);
19+#ifdef HAVE_INNETGR
20+ good &= innetgr (&buffer[1], NULL, user, NULL);
21+#else
22+ pam_syslog (pamh, LOG_ERR, "pam_group does not have netgroup support");
23+#endif
24 /* otherwise, if the buffer starts with %, it's a UNIX group */
25 else if (buffer[0] == '%')
26 good &= pam_modutil_user_in_group_nam_nam(pamh, user, &buffer[1]);
27Index: Linux-PAM-1.1.3/modules/pam_time/pam_time.c
28===================================================================
29--- Linux-PAM-1.1.3.orig/modules/pam_time/pam_time.c
30+++ Linux-PAM-1.1.3/modules/pam_time/pam_time.c
31@@ -555,9 +555,13 @@ check_account(pam_handle_t *pamh, const
32 }
33 /* If buffer starts with @, we are using netgroups */
34 if (buffer[0] == '@')
35- good &= innetgr (&buffer[1], NULL, user, NULL);
36+#ifdef HAVE_INNETGR
37+ good &= innetgr (&buffer[1], NULL, user, NULL);
38+#else
39+ pam_syslog (pamh, LOG_ERR, "pam_time does not have netgroup support");
40+#endif
41 else
42- good &= logic_field(pamh, user, buffer, count, is_same);
43+ good &= logic_field(pamh, user, buffer, count, is_same);
44 D(("with user: %s", good ? "passes":"fails" ));
45
46 /* here we get the time field */
47Index: Linux-PAM-1.1.3/modules/pam_succeed_if/pam_succeed_if.c
48===================================================================
49--- Linux-PAM-1.1.3.orig/modules/pam_succeed_if/pam_succeed_if.c
50+++ Linux-PAM-1.1.3/modules/pam_succeed_if/pam_succeed_if.c
51@@ -231,18 +231,27 @@ evaluate_notingroup(pam_handle_t *pamh,
52 }
53 /* Return PAM_SUCCESS if the (host,user) is in the netgroup. */
54 static int
55-evaluate_innetgr(const char *host, const char *user, const char *group)
56+evaluate_innetgr(const pam_handle_t* pamh, const char *host, const char *user, const char *group)
57 {
58+#ifdef HAVE_INNETGR
59 if (innetgr(group, host, user, NULL) == 1)
60 return PAM_SUCCESS;
61+#else
62+ pam_syslog (pamh, LOG_ERR, "pam_succeed_if does not have netgroup support");
63+#endif
64+
65 return PAM_AUTH_ERR;
66 }
67 /* Return PAM_SUCCESS if the (host,user) is NOT in the netgroup. */
68 static int
69-evaluate_notinnetgr(const char *host, const char *user, const char *group)
70+evaluate_notinnetgr(const pam_handle_t* pamh, const char *host, const char *user, const char *group)
71 {
72+#ifdef HAVE_INNETGR
73 if (innetgr(group, host, user, NULL) == 0)
74 return PAM_SUCCESS;
75+#else
76+ pam_syslog (pamh, LOG_ERR, "pam_succeed_if does not have netgroup support");
77+#endif
78 return PAM_AUTH_ERR;
79 }
80
81@@ -361,14 +370,14 @@ evaluate(pam_handle_t *pamh, int debug,
82 const void *rhost;
83 if (pam_get_item(pamh, PAM_RHOST, &rhost) != PAM_SUCCESS)
84 rhost = NULL;
85- return evaluate_innetgr(rhost, user, right);
86+ return evaluate_innetgr(pamh, rhost, user, right);
87 }
88 /* (Rhost, user) is not in this group. */
89 if (strcasecmp(qual, "notinnetgr") == 0) {
90 const void *rhost;
91 if (pam_get_item(pamh, PAM_RHOST, &rhost) != PAM_SUCCESS)
92 rhost = NULL;
93- return evaluate_notinnetgr(rhost, user, right);
94+ return evaluate_notinnetgr(pamh, rhost, user, right);
95 }
96 /* Fail closed. */
97 return PAM_SERVICE_ERR;
diff --git a/meta/recipes-extended/pam/libpam/pam-security-abstract-securetty-handling.patch b/meta/recipes-extended/pam/libpam/pam-security-abstract-securetty-handling.patch
new file mode 100644
index 0000000000..f1834f6ce3
--- /dev/null
+++ b/meta/recipes-extended/pam/libpam/pam-security-abstract-securetty-handling.patch
@@ -0,0 +1,200 @@
1Description: extract the securetty logic for use with the "nullok_secure" option
2 introduced in the "055_pam_unix_nullok_secure" patch.
3
4Upstream-Status: Pending
5
6Signed-off-by: Ming Liu <ming.liu@windriver.com>
7===================================================================
8diff -urpN a/modules/pam_securetty/Makefile.am b/modules/pam_securetty/Makefile.am
9--- a/modules/pam_securetty/Makefile.am 2013-07-05 11:08:23.224483237 +0800
10+++ b/modules/pam_securetty/Makefile.am 2013-07-05 11:15:21.304486456 +0800
11@@ -24,6 +24,10 @@ endif
12 securelib_LTLIBRARIES = pam_securetty.la
13 pam_securetty_la_LIBADD = -L$(top_builddir)/libpam -lpam
14
15+pam_securetty_la_SOURCES = \
16+ pam_securetty.c \
17+ tty_secure.c
18+
19 if ENABLE_REGENERATE_MAN
20 noinst_DATA = README
21 README: pam_securetty.8.xml
22diff -urpN a/modules/pam_securetty/pam_securetty.c b/modules/pam_securetty/pam_securetty.c
23--- a/modules/pam_securetty/pam_securetty.c 2013-07-05 11:07:50.064483568 +0800
24+++ b/modules/pam_securetty/pam_securetty.c 2013-07-05 11:12:23.994483344 +0800
25@@ -1,7 +1,5 @@
26 /* pam_securetty module */
27
28-#define SECURETTY_FILE "/etc/securetty"
29-#define TTY_PREFIX "/dev/"
30 #define CMDLINE_FILE "/proc/cmdline"
31 #define CONSOLEACTIVE_FILE "/sys/class/tty/console/active"
32
33@@ -40,6 +38,9 @@
34 #include <security/pam_modutil.h>
35 #include <security/pam_ext.h>
36
37+extern int _pammodutil_tty_secure(const pam_handle_t *pamh,
38+ const char *uttyname);
39+
40 #define PAM_DEBUG_ARG 0x0001
41 #define PAM_NOCONSOLE_ARG 0x0002
42
43@@ -73,11 +74,7 @@ securetty_perform_check (pam_handle_t *p
44 const char *username;
45 const char *uttyname;
46 const void *void_uttyname;
47- char ttyfileline[256];
48- char ptname[256];
49- struct stat ttyfileinfo;
50 struct passwd *user_pwd;
51- FILE *ttyfile;
52
53 /* log a trail for debugging */
54 if (ctrl & PAM_DEBUG_ARG) {
55@@ -105,50 +102,7 @@ securetty_perform_check (pam_handle_t *p
56 return PAM_SERVICE_ERR;
57 }
58
59- /* The PAM_TTY item may be prefixed with "/dev/" - skip that */
60- if (strncmp(TTY_PREFIX, uttyname, sizeof(TTY_PREFIX)-1) == 0) {
61- uttyname += sizeof(TTY_PREFIX)-1;
62- }
63-
64- if (stat(SECURETTY_FILE, &ttyfileinfo)) {
65- pam_syslog(pamh, LOG_NOTICE, "Couldn't open %s: %m", SECURETTY_FILE);
66- return PAM_SUCCESS; /* for compatibility with old securetty handling,
67- this needs to succeed. But we still log the
68- error. */
69- }
70-
71- if ((ttyfileinfo.st_mode & S_IWOTH) || !S_ISREG(ttyfileinfo.st_mode)) {
72- /* If the file is world writable or is not a
73- normal file, return error */
74- pam_syslog(pamh, LOG_ERR,
75- "%s is either world writable or not a normal file",
76- SECURETTY_FILE);
77- return PAM_AUTH_ERR;
78- }
79-
80- ttyfile = fopen(SECURETTY_FILE,"r");
81- if (ttyfile == NULL) { /* Check that we opened it successfully */
82- pam_syslog(pamh, LOG_ERR, "Error opening %s: %m", SECURETTY_FILE);
83- return PAM_SERVICE_ERR;
84- }
85-
86- if (isdigit(uttyname[0])) {
87- snprintf(ptname, sizeof(ptname), "pts/%s", uttyname);
88- } else {
89- ptname[0] = '\0';
90- }
91-
92- retval = 1;
93-
94- while ((fgets(ttyfileline, sizeof(ttyfileline)-1, ttyfile) != NULL)
95- && retval) {
96- if (ttyfileline[strlen(ttyfileline) - 1] == '\n')
97- ttyfileline[strlen(ttyfileline) - 1] = '\0';
98-
99- retval = ( strcmp(ttyfileline, uttyname)
100- && (!ptname[0] || strcmp(ptname, uttyname)) );
101- }
102- fclose(ttyfile);
103+ retval = _pammodutil_tty_secure(pamh, uttyname);
104
105 if (retval && !(ctrl & PAM_NOCONSOLE_ARG)) {
106 FILE *cmdlinefile;
107diff -urpN a/modules/pam_securetty/tty_secure.c b/modules/pam_securetty/tty_secure.c
108--- a/modules/pam_securetty/tty_secure.c 1970-01-01 08:30:00.000000000 +0830
109+++ b/modules/pam_securetty/tty_secure.c 2013-07-05 11:14:21.534482900 +0800
110@@ -0,0 +1,90 @@
111+/*
112+ * A function to determine if a particular line is in /etc/securetty
113+ */
114+
115+
116+#define SECURETTY_FILE "/etc/securetty"
117+#define TTY_PREFIX "/dev/"
118+
119+/* This function taken out of pam_securetty by Sam Hartman
120+ * <hartmans@debian.org>*/
121+/*
122+ * by Elliot Lee <sopwith@redhat.com>, Red Hat Software.
123+ * July 25, 1996.
124+ * Slight modifications AGM. 1996/12/3
125+ */
126+
127+#include <unistd.h>
128+#include <sys/types.h>
129+#include <sys/stat.h>
130+#include <security/pam_modules.h>
131+#include <stdarg.h>
132+#include <syslog.h>
133+#include <sys/syslog.h>
134+#include <stdio.h>
135+#include <string.h>
136+#include <stdlib.h>
137+#include <ctype.h>
138+#include <security/pam_modutil.h>
139+#include <security/pam_ext.h>
140+
141+extern int _pammodutil_tty_secure(const pam_handle_t *pamh,
142+ const char *uttyname);
143+
144+int _pammodutil_tty_secure(const pam_handle_t *pamh, const char *uttyname)
145+{
146+ int retval = PAM_AUTH_ERR;
147+ char ttyfileline[256];
148+ char ptname[256];
149+ struct stat ttyfileinfo;
150+ FILE *ttyfile;
151+ /* The PAM_TTY item may be prefixed with "/dev/" - skip that */
152+ if (strncmp(TTY_PREFIX, uttyname, sizeof(TTY_PREFIX)-1) == 0)
153+ uttyname += sizeof(TTY_PREFIX)-1;
154+
155+ if (stat(SECURETTY_FILE, &ttyfileinfo)) {
156+ pam_syslog(pamh, LOG_NOTICE, "Couldn't open %s: %m",
157+ SECURETTY_FILE);
158+ return PAM_SUCCESS; /* for compatibility with old securetty handling,
159+ this needs to succeed. But we still log the
160+ error. */
161+ }
162+
163+ if ((ttyfileinfo.st_mode & S_IWOTH) || !S_ISREG(ttyfileinfo.st_mode)) {
164+ /* If the file is world writable or is not a
165+ normal file, return error */
166+ pam_syslog(pamh, LOG_ERR,
167+ "%s is either world writable or not a normal file",
168+ SECURETTY_FILE);
169+ return PAM_AUTH_ERR;
170+ }
171+
172+ ttyfile = fopen(SECURETTY_FILE,"r");
173+ if(ttyfile == NULL) { /* Check that we opened it successfully */
174+ pam_syslog(pamh, LOG_ERR, "Error opening %s: %m", SECURETTY_FILE);
175+ return PAM_SERVICE_ERR;
176+ }
177+
178+ if (isdigit(uttyname[0])) {
179+ snprintf(ptname, sizeof(ptname), "pts/%s", uttyname);
180+ } else {
181+ ptname[0] = '\0';
182+ }
183+
184+ retval = 1;
185+
186+ while ((fgets(ttyfileline,sizeof(ttyfileline)-1, ttyfile) != NULL)
187+ && retval) {
188+ if(ttyfileline[strlen(ttyfileline) - 1] == '\n')
189+ ttyfileline[strlen(ttyfileline) - 1] = '\0';
190+ retval = ( strcmp(ttyfileline,uttyname)
191+ && (!ptname[0] || strcmp(ptname, uttyname)) );
192+ }
193+ fclose(ttyfile);
194+
195+ if(retval) {
196+ retval = PAM_AUTH_ERR;
197+ }
198+
199+ return retval;
200+}
diff --git a/meta/recipes-extended/pam/libpam/pam-unix-nullok-secure.patch b/meta/recipes-extended/pam/libpam/pam-unix-nullok-secure.patch
new file mode 100644
index 0000000000..b285e96c27
--- /dev/null
+++ b/meta/recipes-extended/pam/libpam/pam-unix-nullok-secure.patch
@@ -0,0 +1,222 @@
1Debian patch to add a new 'nullok_secure' option to pam_unix, which
2accepts users with null passwords only when the applicant is connected
3from a tty listed in /etc/securetty.
4
5Authors: Sam Hartman <hartmans@debian.org>,
6 Steve Langasek <vorlon@debian.org>
7
8Upstream-Status: Pending
9
10Signed-off-by: Ming Liu <ming.liu@windriver.com>
11===================================================================
12diff -urpN a/modules/pam_unix/Makefile.am b/modules/pam_unix/Makefile.am
13--- a/modules/pam_unix/Makefile.am 2013-07-05 09:51:31.014483164 +0800
14+++ b/modules/pam_unix/Makefile.am 2013-07-05 10:26:12.884484000 +0800
15@@ -30,7 +30,8 @@ if HAVE_VERSIONING
16 pam_unix_la_LDFLAGS += -Wl,--version-script=$(srcdir)/../modules.map
17 endif
18 pam_unix_la_LIBADD = $(top_builddir)/libpam/libpam.la \
19- @LIBCRYPT@ @LIBSELINUX@ $(NIS_LIBS)
20+ @LIBCRYPT@ @LIBSELINUX@ $(NIS_LIBS) \
21+ ../pam_securetty/tty_secure.lo
22
23 securelib_LTLIBRARIES = pam_unix.la
24
25diff -urpN a/modules/pam_unix/pam_unix.8 b/modules/pam_unix/pam_unix.8
26--- a/modules/pam_unix/pam_unix.8 2013-07-05 09:52:16.825108201 +0800
27+++ b/modules/pam_unix/pam_unix.8 2013-07-05 10:28:34.724483774 +0800
28@@ -220,7 +220,14 @@ A little more extreme than debug\&.
29 .RS 4
30 The default action of this module is to not permit the user access to a service if their official password is blank\&. The
31 \fBnullok\fR
32-argument overrides this default\&.
33+argument overrides this default and allows any user with a blank password to access the service\&.
34+.RE
35+.PP
36+\fBnullok_secure\fR
37+.RS 4
38+The default action of this module is to not permit the user access to a service if their official password is blank\&. The
39+\fBnullok_secure\fR
40+argument overrides this default and allows any user with a blank password to access the service as long as the value of PAM_TTY is set to one of the values found in /etc/securetty\&.
41 .RE
42 .PP
43 \fBtry_first_pass\fR
44diff -urpN a/modules/pam_unix/pam_unix.8.xml b/modules/pam_unix/pam_unix.8.xml
45--- a/modules/pam_unix/pam_unix.8.xml 2013-07-05 09:52:38.775108523 +0800
46+++ b/modules/pam_unix/pam_unix.8.xml 2013-07-05 10:30:23.084483630 +0800
47@@ -135,7 +135,24 @@
48 <para>
49 The default action of this module is to not permit the
50 user access to a service if their official password is blank.
51- The <option>nullok</option> argument overrides this default.
52+ The <option>nullok</option> argument overrides this default
53+ and allows any user with a blank password to access the
54+ service.
55+ </para>
56+ </listitem>
57+ </varlistentry>
58+ <varlistentry>
59+ <term>
60+ <option>nullok_secure</option>
61+ </term>
62+ <listitem>
63+ <para>
64+ The default action of this module is to not permit the
65+ user access to a service if their official password is blank.
66+ The <option>nullok_secure</option> argument overrides this
67+ default and allows any user with a blank password to access
68+ the service as long as the value of PAM_TTY is set to one of
69+ the values found in /etc/securetty.
70 </para>
71 </listitem>
72 </varlistentry>
73diff -urpN a/modules/pam_unix/README b/modules/pam_unix/README
74--- a/modules/pam_unix/README 2013-07-05 09:51:52.205107846 +0800
75+++ b/modules/pam_unix/README 2013-07-05 10:27:10.774484537 +0800
76@@ -57,7 +57,16 @@ nullok
77
78 The default action of this module is to not permit the user access to a
79 service if their official password is blank. The nullok argument overrides
80- this default.
81+ this default and allows any user with a blank password to access the
82+ service.
83+
84+nullok_secure
85+
86+ The default action of this module is to not permit the user access to a
87+ service if their official password is blank. The nullok_secure argument
88+ overrides this default and allows any user with a blank password to access
89+ the service as long as the value of PAM_TTY is set to one of the values
90+ found in /etc/securetty.
91
92 try_first_pass
93
94diff -urpN a/modules/pam_unix/support.c b/modules/pam_unix/support.c
95--- a/modules/pam_unix/support.c 2013-07-05 09:50:49.134482523 +0800
96+++ b/modules/pam_unix/support.c 2013-07-05 09:56:26.924484267 +0800
97@@ -84,14 +84,22 @@ int _set_ctrl(pam_handle_t *pamh, int fl
98 /* now parse the arguments to this module */
99
100 for (; argc-- > 0; ++argv) {
101- int j;
102+ int j, sl;
103
104 D(("pam_unix arg: %s", *argv));
105
106 for (j = 0; j < UNIX_CTRLS_; ++j) {
107- if (unix_args[j].token
108- && !strncmp(*argv, unix_args[j].token, strlen(unix_args[j].token))) {
109- break;
110+ if (unix_args[j].token) {
111+ sl = strlen(unix_args[j].token);
112+ if (unix_args[j].token[sl-1] == '=') {
113+ /* exclude argument from comparison */
114+ if (!strncmp(*argv, unix_args[j].token, sl))
115+ break;
116+ } else {
117+ /* compare full strings */
118+ if (!strcmp(*argv, unix_args[j].token))
119+ break;
120+ }
121 }
122 }
123
124@@ -461,6 +469,7 @@ static int _unix_run_helper_binary(pam_h
125 child = fork();
126 if (child == 0) {
127 int i=0;
128+ int nullok = off(UNIX__NONULL, ctrl);
129 struct rlimit rlim;
130 static char *envp[] = { NULL };
131 char *args[] = { NULL, NULL, NULL, NULL };
132@@ -488,7 +497,18 @@ static int _unix_run_helper_binary(pam_h
133 /* exec binary helper */
134 args[0] = strdup(CHKPWD_HELPER);
135 args[1] = x_strdup(user);
136- if (off(UNIX__NONULL, ctrl)) { /* this means we've succeeded */
137+
138+ if (on(UNIX_NULLOK_SECURE, ctrl)) {
139+ const void *uttyname;
140+ retval = pam_get_item(pamh, PAM_TTY, &uttyname);
141+ if (retval != PAM_SUCCESS || uttyname == NULL
142+ || _pammodutil_tty_secure(pamh, (const char *)uttyname) != PAM_SUCCESS)
143+ {
144+ nullok = 0;
145+ }
146+ }
147+
148+ if (nullok) {
149 args[2]=strdup("nullok");
150 } else {
151 args[2]=strdup("nonull");
152@@ -567,6 +587,17 @@ _unix_blankpasswd (pam_handle_t *pamh, u
153 if (on(UNIX__NONULL, ctrl))
154 return 0; /* will fail but don't let on yet */
155
156+ if (on(UNIX_NULLOK_SECURE, ctrl)) {
157+ int retval2;
158+ const void *uttyname;
159+ retval2 = pam_get_item(pamh, PAM_TTY, &uttyname);
160+ if (retval2 != PAM_SUCCESS || uttyname == NULL)
161+ return 0;
162+
163+ if (_pammodutil_tty_secure(pamh, (const char *)uttyname) != PAM_SUCCESS)
164+ return 0;
165+ }
166+
167 /* UNIX passwords area */
168
169 retval = get_pwd_hash(pamh, name, &pwd, &salt);
170@@ -653,7 +684,8 @@ int _unix_verify_password(pam_handle_t *
171 }
172 }
173 } else {
174- retval = verify_pwd_hash(p, salt, off(UNIX__NONULL, ctrl));
175+ retval = verify_pwd_hash(p, salt,
176+ _unix_blankpasswd(pamh, ctrl, name));
177 }
178
179 if (retval == PAM_SUCCESS) {
180diff -urpN a/modules/pam_unix/support.h b/modules/pam_unix/support.h
181--- a/modules/pam_unix/support.h 2013-07-05 09:51:10.385107934 +0800
182+++ b/modules/pam_unix/support.h 2013-07-05 10:23:54.815107842 +0800
183@@ -90,8 +90,9 @@ typedef struct {
184 password hash algorithms */
185 #define UNIX_BLOWFISH_PASS 26 /* new password hashes will use blowfish */
186 #define UNIX_MIN_PASS_LEN 27 /* min length for password */
187+#define UNIX_NULLOK_SECURE 28 /* NULL passwords allowed only on secure ttys */
188 /* -------------- */
189-#define UNIX_CTRLS_ 28 /* number of ctrl arguments defined */
190+#define UNIX_CTRLS_ 29 /* number of ctrl arguments defined */
191
192 #define UNIX_DES_CRYPT(ctrl) (off(UNIX_MD5_PASS,ctrl)&&off(UNIX_BIGCRYPT,ctrl)&&off(UNIX_SHA256_PASS,ctrl)&&off(UNIX_SHA512_PASS,ctrl)&&off(UNIX_BLOWFISH_PASS,ctrl))
193
194@@ -109,7 +110,7 @@ static const UNIX_Ctrls unix_args[UNIX_C
195 /* UNIX_NOT_SET_PASS */ {"not_set_pass", _ALL_ON_, 0100},
196 /* UNIX__PRELIM */ {NULL, _ALL_ON_^(0600), 0200},
197 /* UNIX__UPDATE */ {NULL, _ALL_ON_^(0600), 0400},
198-/* UNIX__NONULL */ {NULL, _ALL_ON_, 01000},
199+/* UNIX__NONULL */ {NULL, _ALL_ON_^(0x10000000), 0x200},
200 /* UNIX__QUIET */ {NULL, _ALL_ON_, 02000},
201 /* UNIX_USE_AUTHTOK */ {"use_authtok", _ALL_ON_, 04000},
202 /* UNIX_SHADOW */ {"shadow", _ALL_ON_, 010000},
203@@ -127,7 +128,8 @@ static const UNIX_Ctrls unix_args[UNIX_C
204 /* UNIX_SHA512_PASS */ {"sha512", _ALL_ON_^(0260420000), 040000000},
205 /* UNIX_ALGO_ROUNDS */ {"rounds=", _ALL_ON_, 0100000000},
206 /* UNIX_BLOWFISH_PASS */ {"blowfish", _ALL_ON_^(0260420000), 0200000000},
207-/* UNIX_MIN_PASS_LEN */ {"minlen=", _ALL_ON_, 0400000000},
208+/* UNIX_MIN_PASS_LEN */ {"minlen=", _ALL_ON_, 0400000000},
209+/* UNIX_NULLOK_SECURE */ {"nullok_secure", _ALL_ON_^(0x200), 0x10000000},
210 };
211
212 #define UNIX_DEFAULTS (unix_args[UNIX__NONULL].flag)
213@@ -163,6 +165,9 @@ extern int _unix_read_password(pam_handl
214 ,const char *data_name
215 ,const void **pass);
216
217+extern int _pammodutil_tty_secure(const pam_handle_t *pamh,
218+ const char *uttyname);
219+
220 extern int _unix_run_verify_binary(pam_handle_t *pamh,
221 unsigned int ctrl, const char *user, int *daysleft);
222 #endif /* _PAM_UNIX_SUPPORT_H */
diff --git a/meta/recipes-extended/pam/libpam/pam.d/common-account b/meta/recipes-extended/pam/libpam/pam.d/common-account
new file mode 100644
index 0000000000..316b17337b
--- /dev/null
+++ b/meta/recipes-extended/pam/libpam/pam.d/common-account
@@ -0,0 +1,25 @@
1#
2# /etc/pam.d/common-account - authorization settings common to all services
3#
4# This file is included from other service-specific PAM config files,
5# and should contain a list of the authorization modules that define
6# the central access policy for use on the system. The default is to
7# only deny service to users whose accounts are expired in /etc/shadow.
8#
9# As of pam 1.0.1-6, this file is managed by pam-auth-update by default.
10# To take advantage of this, it is recommended that you configure any
11# local modules either before or after the default block, and use
12# pam-auth-update to manage selection of other modules. See
13# pam-auth-update(8) for details.
14#
15
16# here are the per-package modules (the "Primary" block)
17account [success=1 new_authtok_reqd=done default=ignore] pam_unix.so
18# here's the fallback if no module succeeds
19account requisite pam_deny.so
20# prime the stack with a positive return value if there isn't one already;
21# this avoids us returning an error just because nothing sets a success code
22# since the modules above will each just jump around
23account required pam_permit.so
24# and here are more per-package modules (the "Additional" block)
25# end of pam-auth-update config
diff --git a/meta/recipes-extended/pam/libpam/pam.d/common-auth b/meta/recipes-extended/pam/libpam/pam.d/common-auth
new file mode 100644
index 0000000000..460b69f198
--- /dev/null
+++ b/meta/recipes-extended/pam/libpam/pam.d/common-auth
@@ -0,0 +1,18 @@
1#
2# /etc/pam.d/common-auth - authentication settings common to all services
3#
4# This file is included from other service-specific PAM config files,
5# and should contain a list of the authentication modules that define
6# the central authentication scheme for use on the system
7# (e.g., /etc/shadow, LDAP, Kerberos, etc.). The default is to use the
8# traditional Unix authentication mechanisms.
9
10# here are the per-package modules (the "Primary" block)
11auth [success=1 default=ignore] pam_unix.so nullok_secure
12# here's the fallback if no module succeeds
13auth requisite pam_deny.so
14# prime the stack with a positive return value if there isn't one already;
15# this avoids us returning an error just because nothing sets a success code
16# since the modules above will each just jump around
17auth required pam_permit.so
18# and here are more per-package modules (the "Additional" block)
diff --git a/meta/recipes-extended/pam/libpam/pam.d/common-password b/meta/recipes-extended/pam/libpam/pam.d/common-password
new file mode 100644
index 0000000000..3896057328
--- /dev/null
+++ b/meta/recipes-extended/pam/libpam/pam.d/common-password
@@ -0,0 +1,26 @@
1#
2# /etc/pam.d/common-password - password-related modules common to all services
3#
4# This file is included from other service-specific PAM config files,
5# and should contain a list of modules that define the services to be
6# used to change user passwords. The default is pam_unix.
7
8# Explanation of pam_unix options:
9#
10# The "sha512" option enables salted SHA512 passwords. Without this option,
11# the default is Unix crypt. Prior releases used the option "md5".
12#
13# The "obscure" option replaces the old `OBSCURE_CHECKS_ENAB' option in
14# login.defs.
15#
16# See the pam_unix manpage for other options.
17
18# here are the per-package modules (the "Primary" block)
19password [success=1 default=ignore] pam_unix.so obscure sha512
20# here's the fallback if no module succeeds
21password requisite pam_deny.so
22# prime the stack with a positive return value if there isn't one already;
23# this avoids us returning an error just because nothing sets a success code
24# since the modules above will each just jump around
25password required pam_permit.so
26# and here are more per-package modules (the "Additional" block)
diff --git a/meta/recipes-extended/pam/libpam/pam.d/common-session b/meta/recipes-extended/pam/libpam/pam.d/common-session
new file mode 100644
index 0000000000..a4a551f711
--- /dev/null
+++ b/meta/recipes-extended/pam/libpam/pam.d/common-session
@@ -0,0 +1,19 @@
1#
2# /etc/pam.d/common-session - session-related modules common to all services
3#
4# This file is included from other service-specific PAM config files,
5# and should contain a list of modules that define tasks to be performed
6# at the start and end of sessions of *any* kind (both interactive and
7# non-interactive).
8#
9
10# here are the per-package modules (the "Primary" block)
11session [default=1] pam_permit.so
12# here's the fallback if no module succeeds
13session requisite pam_deny.so
14# prime the stack with a positive return value if there isn't one already;
15# this avoids us returning an error just because nothing sets a success code
16# since the modules above will each just jump around
17session required pam_permit.so
18# and here are more per-package modules (the "Additional" block)
19session required pam_unix.so
diff --git a/meta/recipes-extended/pam/libpam/pam.d/common-session-noninteractive b/meta/recipes-extended/pam/libpam/pam.d/common-session-noninteractive
new file mode 100644
index 0000000000..b110bb2b49
--- /dev/null
+++ b/meta/recipes-extended/pam/libpam/pam.d/common-session-noninteractive
@@ -0,0 +1,19 @@
1#
2# /etc/pam.d/common-session-noninteractive - session-related modules
3# common to all non-interactive services
4#
5# This file is included from other service-specific PAM config files,
6# and should contain a list of modules that define tasks to be performed
7# at the start and end of all non-interactive sessions.
8#
9
10# here are the per-package modules (the "Primary" block)
11session [default=1] pam_permit.so
12# here's the fallback if no module succeeds
13session requisite pam_deny.so
14# prime the stack with a positive return value if there isn't one already;
15# this avoids us returning an error just because nothing sets a success code
16# since the modules above will each just jump around
17session required pam_permit.so
18# and here are more per-package modules (the "Additional" block)
19session required pam_unix.so
diff --git a/meta/recipes-extended/pam/libpam/pam.d/other b/meta/recipes-extended/pam/libpam/pam.d/other
new file mode 100644
index 0000000000..ec970ecbe0
--- /dev/null
+++ b/meta/recipes-extended/pam/libpam/pam.d/other
@@ -0,0 +1,24 @@
1#
2# /etc/pam.d/other - specify the PAM fallback behaviour
3#
4# Note that this file is used for any unspecified service; for example
5#if /etc/pam.d/cron specifies no session modules but cron calls
6#pam_open_session, the session module out of /etc/pam.d/other is
7#used.
8
9# We use pam_warn.so to generate syslog notes that the 'other'
10#fallback rules are being used (as a hint to suggest you should setup
11#specific PAM rules for the service and aid to debugging). Then to be
12#secure, deny access to all services by default.
13
14auth required pam_warn.so
15auth required pam_deny.so
16
17account required pam_warn.so
18account required pam_deny.so
19
20password required pam_warn.so
21password required pam_deny.so
22
23session required pam_warn.so
24session required pam_deny.so
diff --git a/meta/recipes-extended/pam/libpam/reflect-the-enforce_for_root-semantics-change-in-pam.patch b/meta/recipes-extended/pam/libpam/reflect-the-enforce_for_root-semantics-change-in-pam.patch
new file mode 100644
index 0000000000..c13535ecc2
--- /dev/null
+++ b/meta/recipes-extended/pam/libpam/reflect-the-enforce_for_root-semantics-change-in-pam.patch
@@ -0,0 +1,35 @@
1Backport from linux-pam git repo.
2
3[YOCTO #4107]
4
5Upstream-Status: Backport
6
7Signed-off-by: Kang Kai <kai.kang@windriver.com>
8
9From bd07ad3adc626f842a4391d256541883426fd389 Mon Sep 17 00:00:00 2001
10From: Tomas Mraz <tmraz@fedoraproject.org>
11Date: Tue, 13 Nov 2012 09:19:05 +0100
12Subject: [PATCH] Reflect the enforce_for_root semantics change in
13 pam_pwhistory xtest.
14
15xtests/tst-pam_pwhistory1.pamd: Use enforce_for_root as the test is
16running with real uid == 0.
17---
18 xtests/tst-pam_pwhistory1.pamd | 2 +-
19 1 file changed, 1 insertion(+), 1 deletion(-)
20
21diff --git a/xtests/tst-pam_pwhistory1.pamd b/xtests/tst-pam_pwhistory1.pamd
22index 68e1b94..d60db7c 100644
23--- a/xtests/tst-pam_pwhistory1.pamd
24+++ b/xtests/tst-pam_pwhistory1.pamd
25@@ -1,6 +1,6 @@
26 #%PAM-1.0
27 auth required pam_permit.so
28 account required pam_permit.so
29-password required pam_pwhistory.so remember=10 retry=1
30+password required pam_pwhistory.so remember=10 retry=1 enforce_for_root
31 password required pam_unix.so use_authtok md5
32 session required pam_permit.so
33--
341.7.11.7
35
diff --git a/meta/recipes-extended/pam/libpam_1.1.6.bb b/meta/recipes-extended/pam/libpam_1.1.6.bb
new file mode 100644
index 0000000000..c9bdcb0908
--- /dev/null
+++ b/meta/recipes-extended/pam/libpam_1.1.6.bb
@@ -0,0 +1,116 @@
1SUMMARY = "Linux-PAM (Pluggable Authentication Modules)"
2DESCRIPTION = "Linux-PAM (Pluggable Authentication Modules for Linux), a flexible mechanism for authenticating users"
3HOMEPAGE = "https://fedorahosted.org/linux-pam/"
4BUGTRACKER = "https://fedorahosted.org/linux-pam/newticket"
5SECTION = "base"
6# PAM is dual licensed under GPL and BSD.
7# /etc/pam.d comes from Debian libpam-runtime in 2009-11 (at that time
8# libpam-runtime-1.0.1 is GPLv2+), by openembedded
9LICENSE = "GPLv2+ | BSD"
10LIC_FILES_CHKSUM = "file://COPYING;md5=7eb5c1bf854e8881005d673599ee74d3"
11
12SRC_URI = "http://linux-pam.org/library/Linux-PAM-${PV}.tar.bz2 \
13 file://99_pam \
14 file://pam.d/common-account \
15 file://pam.d/common-auth \
16 file://pam.d/common-password \
17 file://pam.d/common-session \
18 file://pam.d/common-session-noninteractive \
19 file://pam.d/other \
20 file://libpam-xtests.patch \
21 file://destdirfix.patch \
22 file://fixsepbuild.patch \
23 file://reflect-the-enforce_for_root-semantics-change-in-pam.patch \
24 file://add-checks-for-crypt-returning-NULL.patch \
25 file://libpam-fix-for-CVE-2010-4708.patch \
26 file://pam-security-abstract-securetty-handling.patch \
27 file://pam-unix-nullok-secure.patch \
28 "
29SRC_URI[md5sum] = "7b73e58b7ce79ffa321d408de06db2c4"
30SRC_URI[sha256sum] = "bab887d6280f47fc3963df3b95735a27a16f0f663636163ddf3acab5f1149fc2"
31
32SRC_URI_append_libc-uclibc = " file://pam-no-innetgr.patch"
33
34DEPENDS = "bison flex flex-native cracklib"
35
36EXTRA_OECONF = "--with-db-uniquename=_pam \
37 --includedir=${includedir}/security \
38 --libdir=${base_libdir} \
39 --disable-nis \
40 --disable-regenerate-docu \
41 --disable-prelude"
42
43CFLAGS_append = " -fPIC "
44
45PR = "r3"
46
47S = "${WORKDIR}/Linux-PAM-${PV}"
48
49inherit autotools gettext pkgconfig
50
51PACKAGECONFIG[audit] = "--enable-audit,--disable-audit,audit,"
52
53PACKAGES += "${PN}-runtime ${PN}-xtests"
54FILES_${PN} = "${base_libdir}/lib*${SOLIBS}"
55FILES_${PN}-dbg += "${base_libdir}/security/.debug \
56 ${base_libdir}/security/pam_filter/.debug \
57 ${datadir}/Linux-PAM/xtests/.debug"
58
59FILES_${PN}-dev += "${base_libdir}/security/*.la ${base_libdir}/*.la ${base_libdir}/lib*${SOLIBSDEV}"
60FILES_${PN}-runtime = "${sysconfdir}"
61FILES_${PN}-xtests = "${datadir}/Linux-PAM/xtests"
62
63PACKAGES_DYNAMIC += "^pam-plugin-.*"
64
65RDEPENDS_${PN}-runtime = "libpam pam-plugin-deny pam-plugin-permit pam-plugin-warn pam-plugin-unix"
66RDEPENDS_${PN}-xtests = "libpam pam-plugin-access pam-plugin-debug pam-plugin-cracklib pam-plugin-pwhistory pam-plugin-succeed-if pam-plugin-time coreutils"
67RRECOMMENDS_${PN} = "libpam-runtime"
68
69python populate_packages_prepend () {
70 def pam_plugin_append_file(pn, dir, file):
71 nf = os.path.join(dir, file)
72 of = d.getVar('FILES_' + pn, True)
73 if of:
74 nf = of + " " + nf
75 d.setVar('FILES_' + pn, nf)
76
77 dvar = bb.data.expand('${WORKDIR}/package', d, True)
78 pam_libdir = d.expand('${base_libdir}/security')
79 pam_sbindir = d.expand('${sbindir}')
80 pam_filterdir = d.expand('${base_libdir}/security/pam_filter')
81
82 do_split_packages(d, pam_libdir, '^pam(.*)\.so$', 'pam-plugin%s', 'PAM plugin for %s', extra_depends='')
83 mlprefix = d.getVar('MLPREFIX', True) or ''
84 pam_plugin_append_file('%spam-plugin-unix' % mlprefix, pam_sbindir, 'unix_chkpwd')
85 pam_plugin_append_file('%spam-plugin-unix' % mlprefix, pam_sbindir, 'unix_update')
86 pam_plugin_append_file('%spam-plugin-tally' % mlprefix, pam_sbindir, 'pam_tally')
87 pam_plugin_append_file('%spam-plugin-tally2' % mlprefix, pam_sbindir, 'pam_tally2')
88 pam_plugin_append_file('%spam-plugin-timestamp' % mlprefix, pam_sbindir, 'pam_timestamp_check')
89 pam_plugin_append_file('%spam-plugin-mkhomedir' % mlprefix, pam_sbindir, 'mkhomedir_helper')
90 do_split_packages(d, pam_filterdir, '^(.*)$', 'pam-filter-%s', 'PAM filter for %s', extra_depends='')
91}
92
93do_install() {
94 autotools_do_install
95
96 # don't install /var/run when populating rootfs. Do it through volatile
97 rm -rf ${D}${localstatedir}
98 install -d ${D}${sysconfdir}/default/volatiles
99 install -m 0644 ${WORKDIR}/99_pam ${D}${sysconfdir}/default/volatiles
100
101 install -d ${D}${sysconfdir}/pam.d/
102 install -m 0644 ${WORKDIR}/pam.d/* ${D}${sysconfdir}/pam.d/
103
104 # The lsb requires unix_chkpwd has setuid permission
105 chmod 4755 ${D}${sbindir}/unix_chkpwd
106
107 if ${@base_contains('DISTRO_FEATURES','systemd','true','false',d)}; then
108 echo "session optional pam_systemd.so" >> ${D}${sysconfdir}/pam.d/common-session
109 fi
110}
111
112python do_pam_sanity () {
113 if "pam" not in d.getVar("DISTRO_FEATURES", True).split():
114 bb.warn("Building libpam but 'pam' isn't in DISTRO_FEATURES, PAM won't work correctly")
115}
116addtask pam_sanity before do_configure