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,
