File: 02-relax-sslkey-permscheck.patch

package info (click to toggle)
postgresql-9.1 9.1.15-0%2Bdeb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 109,092 kB
  • sloc: ansic: 575,877; sql: 43,887; yacc: 26,399; perl: 6,352; lex: 6,171; sh: 5,282; makefile: 3,772; asm: 65; sed: 15; python: 12
file content (27 lines) | stat: -rw-r--r-- 1,436 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Description: Relax security check on private SSL key file: The file is also considered safe if it has owner and/or group "root", and if it is group-readable (unless the group is something other than root or the database owner group).
Author: Martin Pitt <mpitt@debian.org>
Forwarded: Yes, but rejected upstream
Bug-Debian: http://bugs.debian.org/327901

Index: postgresql-9.1-9.1.0/src/backend/libpq/be-secure.c
===================================================================
--- postgresql-9.1-9.1.0.orig/src/backend/libpq/be-secure.c	2011-09-09 07:21:46.091745835 +0200
+++ postgresql-9.1-9.1.0/src/backend/libpq/be-secure.c	2011-09-09 07:21:48.061745850 +0200
@@ -767,12 +767,15 @@
 		 * directory permission check in postmaster.c)
 		 */
 #if !defined(WIN32) && !defined(__CYGWIN__)
-		if (!S_ISREG(buf.st_mode) || buf.st_mode & (S_IRWXG | S_IRWXO))
+		if (!S_ISREG(buf.st_mode) || (buf.st_mode & (S_IWGRP | S_IRWXO)) ||
+			((buf.st_uid != geteuid()) && buf.st_uid != 0))
 			ereport(FATAL,
 					(errcode(ERRCODE_CONFIG_FILE_ERROR),
 				  errmsg("private key file \"%s\" has group or world access",
 						 SERVER_PRIVATE_KEY_FILE),
-				   errdetail("Permissions should be u=rw (0600) or less.")));
+					 errdetail("File must be owned by the \
+database user or root, must have no write permission for \"group\", and must \
+have no permissions for \"other\".")));
 #endif
 
 		if (SSL_CTX_use_PrivateKey_file(SSL_context,