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>2016-02-29 12:33:29 +0000
commit6f05f80017871238b4e50fc4e09d57d722416743 (patch)
tree1bfe799dc3909da0ffc4bb5640955d8f1be80b16 /auth.c
parent5c2c0e042d57cee75528686f47b4c47db434ad8b (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 bd6a026a1..782b7f8fe 100644
--- a/auth.c
+++ b/auth.c
@@ -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;