diff options
author | Colin Watson <cjwatson@debian.org> | 2014-02-09 16:09:58 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2016-01-04 15:07:00 +0000 |
commit | c60b1066b877429b723b351f44efb9e84bc64252 (patch) | |
tree | a9ff77b802c536867b18e60a386c54e18155b02a /auth.c | |
parent | 86d7bcd53809aacc75344386bd8b88bf5fcb2fce (diff) |
Allow harmless group-writability
Allow secure files (~/.ssh/config, ~/.ssh/authorized_keys, etc.) to be
group-writable, provided that the group in question contains only the file's
owner. Rejected upstream for IMO incorrect reasons (e.g. a misunderstanding
about the contents of gr->gr_mem). Given that per-user groups and umask 002
are the default setup in Debian (for good reasons - this makes operating in
setgid directories with other groups much easier), we need to permit this by
default.
Bug: https://bugzilla.mindrot.org/show_bug.cgi?id=1060
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=314347
Last-Update: 2013-09-14
Patch-Name: user-group-modes.patch
Diffstat (limited to 'auth.c')
-rw-r--r-- | auth.c | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -425,8 +425,7 @@ check_key_in_hostfiles(struct passwd *pw, Key *key, const char *host, | |||
425 | user_hostfile = tilde_expand_filename(userfile, pw->pw_uid); | 425 | user_hostfile = tilde_expand_filename(userfile, pw->pw_uid); |
426 | if (options.strict_modes && | 426 | if (options.strict_modes && |
427 | (stat(user_hostfile, &st) == 0) && | 427 | (stat(user_hostfile, &st) == 0) && |
428 | ((st.st_uid != 0 && st.st_uid != pw->pw_uid) || | 428 | !secure_permissions(&st, pw->pw_uid)) { |
429 | (st.st_mode & 022) != 0)) { | ||
430 | logit("Authentication refused for %.100s: " | 429 | logit("Authentication refused for %.100s: " |
431 | "bad owner or modes for %.200s", | 430 | "bad owner or modes for %.200s", |
432 | pw->pw_name, user_hostfile); | 431 | pw->pw_name, user_hostfile); |
@@ -488,8 +487,7 @@ auth_secure_path(const char *name, struct stat *stp, const char *pw_dir, | |||
488 | snprintf(err, errlen, "%s is not a regular file", buf); | 487 | snprintf(err, errlen, "%s is not a regular file", buf); |
489 | return -1; | 488 | return -1; |
490 | } | 489 | } |
491 | if ((!platform_sys_dir_uid(stp->st_uid) && stp->st_uid != uid) || | 490 | if (!secure_permissions(stp, uid)) { |
492 | (stp->st_mode & 022) != 0) { | ||
493 | snprintf(err, errlen, "bad ownership or modes for file %s", | 491 | snprintf(err, errlen, "bad ownership or modes for file %s", |
494 | buf); | 492 | buf); |
495 | return -1; | 493 | return -1; |
@@ -504,8 +502,7 @@ auth_secure_path(const char *name, struct stat *stp, const char *pw_dir, | |||
504 | strlcpy(buf, cp, sizeof(buf)); | 502 | strlcpy(buf, cp, sizeof(buf)); |
505 | 503 | ||
506 | if (stat(buf, &st) < 0 || | 504 | if (stat(buf, &st) < 0 || |
507 | (!platform_sys_dir_uid(st.st_uid) && st.st_uid != uid) || | 505 | !secure_permissions(&st, uid)) { |
508 | (st.st_mode & 022) != 0) { | ||
509 | snprintf(err, errlen, | 506 | snprintf(err, errlen, |
510 | "bad ownership or modes for directory %s", buf); | 507 | "bad ownership or modes for directory %s", buf); |
511 | return -1; | 508 | return -1; |