summaryrefslogtreecommitdiff
path: root/auth.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2014-02-09 16:09:58 +0000
committerColin Watson <cjwatson@debian.org>2015-11-24 20:45:16 +0000
commit113450cad7a19b997e51945f012539836bba6f17 (patch)
tree8de7d0887897574f9adbd66d7ffe684bd96c0c45 /auth.c
parentcc53919ec39bb8a84127b7ba1f23acf3809dc2a0 (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.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/auth.c b/auth.c
index e6c094d1f..a99c4759b 100644
--- a/auth.c
+++ b/auth.c
@@ -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;