diff options
author | Colin Watson <cjwatson@debian.org> | 2014-02-09 16:09:58 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2015-08-19 17:09:56 +0100 |
commit | 209c51110996719eab04236d72f776eed6bd8226 (patch) | |
tree | a099dc0f9ea7c6740083d222e25be00ca79dea8b /auth.c | |
parent | 1197fd975ab8fd11b1ac83557ef750129b16c0d8 (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
@@ -422,8 +422,7 @@ check_key_in_hostfiles(struct passwd *pw, Key *key, const char *host, | |||
422 | user_hostfile = tilde_expand_filename(userfile, pw->pw_uid); | 422 | user_hostfile = tilde_expand_filename(userfile, pw->pw_uid); |
423 | if (options.strict_modes && | 423 | if (options.strict_modes && |
424 | (stat(user_hostfile, &st) == 0) && | 424 | (stat(user_hostfile, &st) == 0) && |
425 | ((st.st_uid != 0 && st.st_uid != pw->pw_uid) || | 425 | !secure_permissions(&st, pw->pw_uid)) { |
426 | (st.st_mode & 022) != 0)) { | ||
427 | logit("Authentication refused for %.100s: " | 426 | logit("Authentication refused for %.100s: " |
428 | "bad owner or modes for %.200s", | 427 | "bad owner or modes for %.200s", |
429 | pw->pw_name, user_hostfile); | 428 | pw->pw_name, user_hostfile); |
@@ -485,8 +484,7 @@ auth_secure_path(const char *name, struct stat *stp, const char *pw_dir, | |||
485 | snprintf(err, errlen, "%s is not a regular file", buf); | 484 | snprintf(err, errlen, "%s is not a regular file", buf); |
486 | return -1; | 485 | return -1; |
487 | } | 486 | } |
488 | if ((!platform_sys_dir_uid(stp->st_uid) && stp->st_uid != uid) || | 487 | if (!secure_permissions(stp, uid)) { |
489 | (stp->st_mode & 022) != 0) { | ||
490 | snprintf(err, errlen, "bad ownership or modes for file %s", | 488 | snprintf(err, errlen, "bad ownership or modes for file %s", |
491 | buf); | 489 | buf); |
492 | return -1; | 490 | return -1; |
@@ -501,8 +499,7 @@ auth_secure_path(const char *name, struct stat *stp, const char *pw_dir, | |||
501 | strlcpy(buf, cp, sizeof(buf)); | 499 | strlcpy(buf, cp, sizeof(buf)); |
502 | 500 | ||
503 | if (stat(buf, &st) < 0 || | 501 | if (stat(buf, &st) < 0 || |
504 | (!platform_sys_dir_uid(st.st_uid) && st.st_uid != uid) || | 502 | !secure_permissions(&st, uid)) { |
505 | (st.st_mode & 022) != 0) { | ||
506 | snprintf(err, errlen, | 503 | snprintf(err, errlen, |
507 | "bad ownership or modes for directory %s", buf); | 504 | "bad ownership or modes for directory %s", buf); |
508 | return -1; | 505 | return -1; |