mirror of
https://github.com/postgres/postgres.git
synced 2025-06-30 21:42:05 +03:00
Add new clientcert hba option verify-full
This allows a login to require both that the cn of the certificate matches (like authentication type cert) *and* that another authentication method (such as password or kerberos) succeeds as well. The old value of clientcert=1 maps to the new clientcert=verify-ca, clientcert=0 maps to the new clientcert=no-verify, and the new option erify-full will add the validation of the CN. Author: Julian Markwort, Marius Timmer Reviewed by: Magnus Hagander, Thomas Munro
This commit is contained in:
@ -103,8 +103,10 @@ sub configure_test_server_for_ssl
|
||||
# Create test users and databases
|
||||
$node->psql('postgres', "CREATE USER ssltestuser");
|
||||
$node->psql('postgres', "CREATE USER anotheruser");
|
||||
$node->psql('postgres', "CREATE USER yetanotheruser");
|
||||
$node->psql('postgres', "CREATE DATABASE trustdb");
|
||||
$node->psql('postgres', "CREATE DATABASE certdb");
|
||||
$node->psql('postgres', "CREATE DATABASE verifydb");
|
||||
|
||||
# Update password of each user as needed.
|
||||
if (defined($password))
|
||||
@ -183,11 +185,17 @@ sub configure_hba_for_ssl
|
||||
# When connecting to certdb, also check the client certificate.
|
||||
open my $hba, '>', "$pgdata/pg_hba.conf";
|
||||
print $hba
|
||||
"# TYPE DATABASE USER ADDRESS METHOD\n";
|
||||
"# TYPE DATABASE USER ADDRESS METHOD OPTIONS\n";
|
||||
print $hba
|
||||
"hostssl trustdb all $serverhost/32 $authmethod\n";
|
||||
print $hba
|
||||
"hostssl trustdb all ::1/128 $authmethod\n";
|
||||
print $hba
|
||||
"hostssl verifydb ssltestuser $serverhost/32 $authmethod clientcert=verify-full\n";
|
||||
print $hba
|
||||
"hostssl verifydb anotheruser $serverhost/32 $authmethod clientcert=verify-full\n";
|
||||
print $hba
|
||||
"hostssl verifydb yetanotheruser $serverhost/32 $authmethod clientcert=verify-ca\n";
|
||||
print $hba
|
||||
"hostssl certdb all $serverhost/32 cert\n";
|
||||
print $hba
|
||||
|
Reference in New Issue
Block a user