Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit15b95cf

Browse files
committed
Allow SSL to work withouth client-side certificate infrastructure.
1 parentc889c9c commit15b95cf

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

‎doc/src/sgml/runtime.sgml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.139 2002/09/25 21:16:10 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.140 2002/09/26 04:41:54 momjian Exp $
33
-->
44

55
<Chapter Id="runtime">
@@ -2876,6 +2876,7 @@ openssl rsa -in privkey.pem -out cert.pem
28762876
Enter the old passphrase to unlock the existing key. Now do
28772877
<programlisting>
28782878
openssl req -x509 -in cert.req -text -key cert.pem -out cert.cert
2879+
chmod og-rwx cert.pem
28792880
cp cert.pem <replaceable>$PGDATA</replaceable>/server.key
28802881
cp cert.cert <replaceable>$PGDATA</replaceable>/server.crt
28812882
</programlisting>

‎src/backend/libpq/be-secure.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $Header: /cvsroot/pgsql/src/backend/libpq/be-secure.c,v 1.14 2002/09/04 23:31:34 tgl Exp $
14+
* $Header: /cvsroot/pgsql/src/backend/libpq/be-secure.c,v 1.15 2002/09/26 04:41:54 momjian Exp $
1515
*
1616
* Since the server static private key ($DataDir/server.key)
1717
* will normally be stored unencrypted so that the database
@@ -642,9 +642,13 @@ initialize_SSL(void)
642642
snprintf(fnbuf,sizeoffnbuf,"%s/root.crt",DataDir);
643643
if (!SSL_CTX_load_verify_locations(SSL_context,fnbuf,CA_PATH))
644644
{
645+
return0;
646+
#ifdefNOT_USED
647+
/* CLIENT CERTIFICATES NOT REQUIRED bjm 2002-09-26 */
645648
postmaster_error("could not read root cert file (%s): %s",
646649
fnbuf,SSLerrmessage());
647650
ExitPostmaster(1);
651+
#endif
648652
}
649653
SSL_CTX_set_verify(SSL_context,
650654
SSL_VERIFY_PEER |SSL_VERIFY_CLIENT_ONCE,verify_cb);

‎src/interfaces/libpq/fe-secure.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-secure.c,v 1.13 2002/09/22 20:57:21 petere Exp $
14+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-secure.c,v 1.14 2002/09/26 04:41:55 momjian Exp $
1515
*
1616
* NOTES
1717
* The client *requires* a valid server certificate. Since
@@ -726,10 +726,14 @@ initialize_SSL(PGconn *conn)
726726
pwd->pw_dir);
727727
if (stat(fnbuf,&buf)==-1)
728728
{
729+
return0;
730+
#ifdefNOT_USED
731+
/* CLIENT CERTIFICATES NOT REQUIRED bjm 2002-09-26 */
729732
printfPQExpBuffer(&conn->errorMessage,
730733
libpq_gettext("could not read root certificate list (%s): %s\n"),
731734
fnbuf,strerror(errno));
732735
return-1;
736+
#endif
733737
}
734738
if (!SSL_CTX_load_verify_locations(SSL_context,fnbuf,0))
735739
{
@@ -789,6 +793,8 @@ open_client_SSL(PGconn *conn)
789793

790794
/* check the certificate chain of the server */
791795

796+
#ifdefNOT_USED
797+
/* CLIENT CERTIFICATES NOT REQUIRED bjm 2002-09-26 */
792798
/*
793799
* this eliminates simple man-in-the-middle attacks and simple
794800
* impersonations
@@ -802,6 +808,7 @@ open_client_SSL(PGconn *conn)
802808
close_SSL(conn);
803809
return-1;
804810
}
811+
#endif
805812

806813
/* pull out server distinguished and common names */
807814
conn->peer=SSL_get_peer_certificate(conn->ssl);
@@ -824,6 +831,8 @@ open_client_SSL(PGconn *conn)
824831

825832
/* verify that the common name resolves to peer */
826833

834+
#ifdefNOT_USED
835+
/* CLIENT CERTIFICATES NOT REQUIRED bjm 2002-09-26 */
827836
/*
828837
* this is necessary to eliminate man-in-the-middle attacks and
829838
* impersonations where the attacker somehow learned the server's
@@ -834,6 +843,7 @@ open_client_SSL(PGconn *conn)
834843
close_SSL(conn);
835844
return-1;
836845
}
846+
#endif
837847

838848
return0;
839849
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp