diff options
author | Colin Watson <cjwatson@debian.org> | 2014-02-09 16:09:58 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2014-02-09 23:43:40 +0000 |
commit | 2bb37315c1e077bc176e703fbf0028a1f6315d37 (patch) | |
tree | 8c0fc9e5af8b442fbfa6688bfa03ca05fc9f0c19 /readconf.c | |
parent | 05609b1cb381eafb999214bf4a95138e63abdbf2 (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 'readconf.c')
-rw-r--r-- | readconf.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/readconf.c b/readconf.c index dab7963d6..c74193424 100644 --- a/readconf.c +++ b/readconf.c | |||
@@ -30,6 +30,8 @@ | |||
30 | #include <stdio.h> | 30 | #include <stdio.h> |
31 | #include <string.h> | 31 | #include <string.h> |
32 | #include <unistd.h> | 32 | #include <unistd.h> |
33 | #include <pwd.h> | ||
34 | #include <grp.h> | ||
33 | #ifdef HAVE_UTIL_H | 35 | #ifdef HAVE_UTIL_H |
34 | #include <util.h> | 36 | #include <util.h> |
35 | #endif | 37 | #endif |
@@ -1155,8 +1157,7 @@ read_config_file(const char *filename, const char *host, Options *options, | |||
1155 | 1157 | ||
1156 | if (fstat(fileno(f), &sb) == -1) | 1158 | if (fstat(fileno(f), &sb) == -1) |
1157 | fatal("fstat %s: %s", filename, strerror(errno)); | 1159 | fatal("fstat %s: %s", filename, strerror(errno)); |
1158 | if (((sb.st_uid != 0 && sb.st_uid != getuid()) || | 1160 | if (!secure_permissions(&sb, getuid())) |
1159 | (sb.st_mode & 022) != 0)) | ||
1160 | fatal("Bad owner or permissions on %s", filename); | 1161 | fatal("Bad owner or permissions on %s", filename); |
1161 | } | 1162 | } |
1162 | 1163 | ||