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>2014-02-09 23:43:40 +0000
commit2bb37315c1e077bc176e703fbf0028a1f6315d37 (patch)
tree8c0fc9e5af8b442fbfa6688bfa03ca05fc9f0c19 /auth.c
parent05609b1cb381eafb999214bf4a95138e63abdbf2 (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 9a36f1dac..0c45f0954 100644
--- a/auth.c
+++ b/auth.c
@@ -407,8 +407,7 @@ check_key_in_hostfiles(struct passwd *pw, Key *key, const char *host,
407 user_hostfile = tilde_expand_filename(userfile, pw->pw_uid); 407 user_hostfile = tilde_expand_filename(userfile, pw->pw_uid);
408 if (options.strict_modes && 408 if (options.strict_modes &&
409 (stat(user_hostfile, &st) == 0) && 409 (stat(user_hostfile, &st) == 0) &&
410 ((st.st_uid != 0 && st.st_uid != pw->pw_uid) || 410 !secure_permissions(&st, pw->pw_uid)) {
411 (st.st_mode & 022) != 0)) {
412 logit("Authentication refused for %.100s: " 411 logit("Authentication refused for %.100s: "
413 "bad owner or modes for %.200s", 412 "bad owner or modes for %.200s",
414 pw->pw_name, user_hostfile); 413 pw->pw_name, user_hostfile);
@@ -470,8 +469,7 @@ auth_secure_path(const char *name, struct stat *stp, const char *pw_dir,
470 snprintf(err, errlen, "%s is not a regular file", buf); 469 snprintf(err, errlen, "%s is not a regular file", buf);
471 return -1; 470 return -1;
472 } 471 }
473 if ((!platform_sys_dir_uid(stp->st_uid) && stp->st_uid != uid) || 472 if (!secure_permissions(stp, uid)) {
474 (stp->st_mode & 022) != 0) {
475 snprintf(err, errlen, "bad ownership or modes for file %s", 473 snprintf(err, errlen, "bad ownership or modes for file %s",
476 buf); 474 buf);
477 return -1; 475 return -1;
@@ -486,8 +484,7 @@ auth_secure_path(const char *name, struct stat *stp, const char *pw_dir,
486 strlcpy(buf, cp, sizeof(buf)); 484 strlcpy(buf, cp, sizeof(buf));
487 485
488 if (stat(buf, &st) < 0 || 486 if (stat(buf, &st) < 0 ||
489 (!platform_sys_dir_uid(st.st_uid) && st.st_uid != uid) || 487 !secure_permissions(&st, uid)) {
490 (st.st_mode & 022) != 0) {
491 snprintf(err, errlen, 488 snprintf(err, errlen,
492 "bad ownership or modes for directory %s", buf); 489 "bad ownership or modes for directory %s", buf);
493 return -1; 490 return -1;