Skip to content

Commit ef28802

Browse files
committed
#ifdef out file permissions check on SSL key file when on Windows, as
we also have done for the data directory permissions check. Dave Page
1 parent 7d7806d commit ef28802

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/backend/libpq/be-secure.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $PostgreSQL: pgsql/src/backend/libpq/be-secure.c,v 1.45 2003/12/18 22:49:26 tgl Exp $
14+
* $PostgreSQL: pgsql/src/backend/libpq/be-secure.c,v 1.46 2004/06/25 15:07:52 tgl Exp $
1515
*
1616
* Since the server static private key ($DataDir/server.key)
1717
* will normally be stored unencrypted so that the database
@@ -650,13 +650,24 @@ initialize_SSL(void)
650650
(errcode_for_file_access(),
651651
errmsg("could not access private key file \"%s\": %m",
652652
fnbuf)));
653+
654+
/*
655+
* Require no public access to key file.
656+
*
657+
* XXX temporarily suppress check when on Windows, because there may
658+
* not be proper support for Unix-y file permissions. Need to think
659+
* of a reasonable check to apply on Windows. (See also the data
660+
* directory permission check in postmaster.c)
661+
*/
662+
#if !defined(__CYGWIN__) && !defined(WIN32)
653663
if (!S_ISREG(buf.st_mode) || (buf.st_mode & (S_IRWXG | S_IRWXO)) ||
654664
buf.st_uid != getuid())
655665
ereport(FATAL,
656666
(errcode(ERRCODE_CONFIG_FILE_ERROR),
657667
errmsg("unsafe permissions on private key file \"%s\"",
658668
fnbuf),
659669
errdetail("File must be owned by the database user and must have no permissions for \"group\" or \"other\".")));
670+
#endif
660671

661672
if (!SSL_CTX_use_PrivateKey_file(SSL_context, fnbuf, SSL_FILETYPE_PEM))
662673
ereport(FATAL,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy