diff options
| author | Ming Liu <ming.liu@windriver.com> | 2013-07-18 10:04:22 +0800 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-07-24 11:35:33 +0100 |
| commit | 784d7b77294ae8066ff0ac91f7fc90f9795d2bd7 (patch) | |
| tree | 1a101aca6397782d00d0cfd9b2860d243bb3a5c3 /meta | |
| parent | 7af92f8fa3a12fc8fcb22dbd12f87d89768b2d39 (diff) | |
| download | poky-784d7b77294ae8066ff0ac91f7fc90f9795d2bd7.tar.gz | |
libpam: add a new 'nullok_secure' option support to pam_unix
Debian patch to add a new 'nullok_secure' option to pam_unix, which
accepts users with null passwords only when the applicant is connected
from a tty listed in /etc/securetty.
The original pam_unix.so was configured with nullok_secure in
meta/recipes-extended/pam/libpam/pam.d/common-auth, but no such code
exists actually.
The patch set comes from:
http://patch-tracker.debian.org/patch/series/view/pam/1.1.3-7.1/054_pam_security_abstract_securetty_handling
http://patch-tracker.debian.org/patch/series/view/pam/1.1.3-7.1/055_pam_unix_nullok_secure
(From OE-Core rev: 10cdd66fe800cffe3f2cbf5c95550b4f7902a311)
Signed-off-by: Ming Liu <ming.liu@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
3 files changed, 425 insertions, 1 deletions
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 @@ | |||
| 1 | Description: extract the securetty logic for use with the "nullok_secure" option | ||
| 2 | introduced in the "055_pam_unix_nullok_secure" patch. | ||
| 3 | |||
| 4 | Upstream-Status: Pending | ||
| 5 | |||
| 6 | Signed-off-by: Ming Liu <ming.liu@windriver.com> | ||
| 7 | =================================================================== | ||
| 8 | diff -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 | ||
| 22 | diff -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; | ||
| 107 | diff -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 @@ | |||
| 1 | Debian patch to add a new 'nullok_secure' option to pam_unix, which | ||
| 2 | accepts users with null passwords only when the applicant is connected | ||
| 3 | from a tty listed in /etc/securetty. | ||
| 4 | |||
| 5 | Authors: Sam Hartman <hartmans@debian.org>, | ||
| 6 | Steve Langasek <vorlon@debian.org> | ||
| 7 | |||
| 8 | Upstream-Status: Pending | ||
| 9 | |||
| 10 | Signed-off-by: Ming Liu <ming.liu@windriver.com> | ||
| 11 | =================================================================== | ||
| 12 | diff -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 | |||
| 25 | diff -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 | ||
| 44 | diff -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> | ||
| 73 | diff -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 | |||
| 94 | diff -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) { | ||
| 180 | diff -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_1.1.6.bb b/meta/recipes-extended/pam/libpam_1.1.6.bb index 62ad7b16a2..3d8999de41 100644 --- a/meta/recipes-extended/pam/libpam_1.1.6.bb +++ b/meta/recipes-extended/pam/libpam_1.1.6.bb | |||
| @@ -23,6 +23,8 @@ SRC_URI = "http://linux-pam.org/library/Linux-PAM-${PV}.tar.bz2 \ | |||
| 23 | file://reflect-the-enforce_for_root-semantics-change-in-pam.patch \ | 23 | file://reflect-the-enforce_for_root-semantics-change-in-pam.patch \ |
| 24 | file://add-checks-for-crypt-returning-NULL.patch \ | 24 | file://add-checks-for-crypt-returning-NULL.patch \ |
| 25 | file://libpam-fix-for-CVE-2010-4708.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 \ | ||
| 26 | " | 28 | " |
| 27 | SRC_URI[md5sum] = "7b73e58b7ce79ffa321d408de06db2c4" | 29 | SRC_URI[md5sum] = "7b73e58b7ce79ffa321d408de06db2c4" |
| 28 | SRC_URI[sha256sum] = "bab887d6280f47fc3963df3b95735a27a16f0f663636163ddf3acab5f1149fc2" | 30 | SRC_URI[sha256sum] = "bab887d6280f47fc3963df3b95735a27a16f0f663636163ddf3acab5f1149fc2" |
| @@ -39,7 +41,7 @@ EXTRA_OECONF = "--with-db-uniquename=_pam \ | |||
| 39 | 41 | ||
| 40 | CFLAGS_append = " -fPIC " | 42 | CFLAGS_append = " -fPIC " |
| 41 | 43 | ||
| 42 | PR = "r2" | 44 | PR = "r3" |
| 43 | 45 | ||
| 44 | S = "${WORKDIR}/Linux-PAM-${PV}" | 46 | S = "${WORKDIR}/Linux-PAM-${PV}" |
| 45 | 47 | ||
