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