Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
15b95cf8
Commit
15b95cf8
authored
22 years ago
by
Bruce Momjian
Browse files
Options
Downloads
Patches
Plain Diff
Allow SSL to work withouth client-side certificate infrastructure.
parent
c889c9c9
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
doc/src/sgml/runtime.sgml
+2
-1
2 additions, 1 deletion
doc/src/sgml/runtime.sgml
src/backend/libpq/be-secure.c
+5
-1
5 additions, 1 deletion
src/backend/libpq/be-secure.c
src/interfaces/libpq/fe-secure.c
+11
-1
11 additions, 1 deletion
src/interfaces/libpq/fe-secure.c
with
18 additions
and
3 deletions
doc/src/sgml/runtime.sgml
+
2
−
1
View file @
15b95cf8
<!--
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.1
39
2002/09/2
5 21:16:10 petere
Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.1
40
2002/09/2
6 04:41:54 momjian
Exp $
-->
-->
<Chapter Id="runtime">
<Chapter Id="runtime">
...
@@ -2876,6 +2876,7 @@ openssl rsa -in privkey.pem -out cert.pem
...
@@ -2876,6 +2876,7 @@ openssl rsa -in privkey.pem -out cert.pem
Enter the old passphrase to unlock the existing key. Now do
Enter the old passphrase to unlock the existing key. Now do
<programlisting>
<programlisting>
openssl req -x509 -in cert.req -text -key cert.pem -out cert.cert
openssl req -x509 -in cert.req -text -key cert.pem -out cert.cert
chmod og-rwx cert.pem
cp cert.pem <replaceable>$PGDATA</replaceable>/server.key
cp cert.pem <replaceable>$PGDATA</replaceable>/server.key
cp cert.cert <replaceable>$PGDATA</replaceable>/server.crt
cp cert.cert <replaceable>$PGDATA</replaceable>/server.crt
</programlisting>
</programlisting>
...
...
This diff is collapsed.
Click to expand it.
src/backend/libpq/be-secure.c
+
5
−
1
View file @
15b95cf8
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/be-secure.c,v 1.1
4
2002/09/
04 23:3
1:
3
4
tgl
Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/be-secure.c,v 1.1
5
2002/09/
26 04:4
1:
5
4
momjian
Exp $
*
*
* Since the server static private key ($DataDir/server.key)
* Since the server static private key ($DataDir/server.key)
* will normally be stored unencrypted so that the database
* will normally be stored unencrypted so that the database
...
@@ -642,9 +642,13 @@ initialize_SSL(void)
...
@@ -642,9 +642,13 @@ initialize_SSL(void)
snprintf
(
fnbuf
,
sizeof
fnbuf
,
"%s/root.crt"
,
DataDir
);
snprintf
(
fnbuf
,
sizeof
fnbuf
,
"%s/root.crt"
,
DataDir
);
if
(
!
SSL_CTX_load_verify_locations
(
SSL_context
,
fnbuf
,
CA_PATH
))
if
(
!
SSL_CTX_load_verify_locations
(
SSL_context
,
fnbuf
,
CA_PATH
))
{
{
return
0
;
#ifdef NOT_USED
/* CLIENT CERTIFICATES NOT REQUIRED bjm 2002-09-26 */
postmaster_error
(
"could not read root cert file (%s): %s"
,
postmaster_error
(
"could not read root cert file (%s): %s"
,
fnbuf
,
SSLerrmessage
());
fnbuf
,
SSLerrmessage
());
ExitPostmaster
(
1
);
ExitPostmaster
(
1
);
#endif
}
}
SSL_CTX_set_verify
(
SSL_context
,
SSL_CTX_set_verify
(
SSL_context
,
SSL_VERIFY_PEER
|
SSL_VERIFY_CLIENT_ONCE
,
verify_cb
);
SSL_VERIFY_PEER
|
SSL_VERIFY_CLIENT_ONCE
,
verify_cb
);
...
...
This diff is collapsed.
Click to expand it.
src/interfaces/libpq/fe-secure.c
+
11
−
1
View file @
15b95cf8
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-secure.c,v 1.1
3
2002/09/2
2 20:57:21 petere
Exp $
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-secure.c,v 1.1
4
2002/09/2
6 04:41:55 momjian
Exp $
*
*
* NOTES
* NOTES
* The client *requires* a valid server certificate. Since
* The client *requires* a valid server certificate. Since
...
@@ -726,10 +726,14 @@ initialize_SSL(PGconn *conn)
...
@@ -726,10 +726,14 @@ initialize_SSL(PGconn *conn)
pwd
->
pw_dir
);
pwd
->
pw_dir
);
if
(
stat
(
fnbuf
,
&
buf
)
==
-
1
)
if
(
stat
(
fnbuf
,
&
buf
)
==
-
1
)
{
{
return
0
;
#ifdef NOT_USED
/* CLIENT CERTIFICATES NOT REQUIRED bjm 2002-09-26 */
printfPQExpBuffer
(
&
conn
->
errorMessage
,
printfPQExpBuffer
(
&
conn
->
errorMessage
,
libpq_gettext
(
"could not read root certificate list (%s): %s
\n
"
),
libpq_gettext
(
"could not read root certificate list (%s): %s
\n
"
),
fnbuf
,
strerror
(
errno
));
fnbuf
,
strerror
(
errno
));
return
-
1
;
return
-
1
;
#endif
}
}
if
(
!
SSL_CTX_load_verify_locations
(
SSL_context
,
fnbuf
,
0
))
if
(
!
SSL_CTX_load_verify_locations
(
SSL_context
,
fnbuf
,
0
))
{
{
...
@@ -789,6 +793,8 @@ open_client_SSL(PGconn *conn)
...
@@ -789,6 +793,8 @@ open_client_SSL(PGconn *conn)
/* check the certificate chain of the server */
/* check the certificate chain of the server */
#ifdef NOT_USED
/* CLIENT CERTIFICATES NOT REQUIRED bjm 2002-09-26 */
/*
/*
* this eliminates simple man-in-the-middle attacks and simple
* this eliminates simple man-in-the-middle attacks and simple
* impersonations
* impersonations
...
@@ -802,6 +808,7 @@ open_client_SSL(PGconn *conn)
...
@@ -802,6 +808,7 @@ open_client_SSL(PGconn *conn)
close_SSL
(
conn
);
close_SSL
(
conn
);
return
-
1
;
return
-
1
;
}
}
#endif
/* pull out server distinguished and common names */
/* pull out server distinguished and common names */
conn
->
peer
=
SSL_get_peer_certificate
(
conn
->
ssl
);
conn
->
peer
=
SSL_get_peer_certificate
(
conn
->
ssl
);
...
@@ -824,6 +831,8 @@ open_client_SSL(PGconn *conn)
...
@@ -824,6 +831,8 @@ open_client_SSL(PGconn *conn)
/* verify that the common name resolves to peer */
/* verify that the common name resolves to peer */
#ifdef NOT_USED
/* CLIENT CERTIFICATES NOT REQUIRED bjm 2002-09-26 */
/*
/*
* this is necessary to eliminate man-in-the-middle attacks and
* this is necessary to eliminate man-in-the-middle attacks and
* impersonations where the attacker somehow learned the server's
* impersonations where the attacker somehow learned the server's
...
@@ -834,6 +843,7 @@ open_client_SSL(PGconn *conn)
...
@@ -834,6 +843,7 @@ open_client_SSL(PGconn *conn)
close_SSL
(
conn
);
close_SSL
(
conn
);
return
-
1
;
return
-
1
;
}
}
#endif
return
0
;
return
0
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment