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