@ -42,6 +42,7 @@ my $common_connstr;
# This changes to using keys stored in a temporary path for the rest of
# This changes to using keys stored in a temporary path for the rest of
# the tests. To get the full path for inclusion in connection strings, the
# the tests. To get the full path for inclusion in connection strings, the
# %key hash can be interrogated.
# %key hash can be interrogated.
my $ cert_tempdir = PostgreSQL::Test::Utils:: tempdir ( ) ;
my % key ;
my % key ;
my @ keys = (
my @ keys = (
"client.key" , "client-revoked.key" ,
"client.key" , "client-revoked.key" ,
@ -49,21 +50,23 @@ my @keys = (
"client-encrypted-der.key" , "client-dn.key" ) ;
"client-encrypted-der.key" , "client-dn.key" ) ;
foreach my $ keyfile ( @ keys )
foreach my $ keyfile ( @ keys )
{
{
copy ( "ssl/${ keyfile} " , "${PostgreSQL::Test::Utils::tmp_check}/${keyfile} " )
copy ( "ssl/$keyfile" , "$cert_tempdir/$keyfile " )
or die
or die
"couldn't copy ssl/${keyfile} to ${PostgreSQL::Test::Utils::tmp_check}/${keyfile} for permissions change: $!" ;
"couldn't copy ssl/$keyfile to $cert_tempdir/$keyfile for permissions change: $!" ;
chmod 0600 , "${PostgreSQL::Test::Utils::tmp_check}/${keyfile}"
chmod 0600 , "$cert_tempdir/$keyfile"
or die "failed to change permissions on ${PostgreSQL::Test::Utils::tmp_check}/${keyfile}: $!" ;
or die "failed to change permissions on $cert_tempdir/$keyfile: $!" ;
$ key { $ keyfile } = PostgreSQL::Test::Utils:: perl2host ( "$cert_tempdir/$keyfile" ) ;
$ key { $ keyfile } = "${PostgreSQL::Test::Utils::tmp_check}/$keyfile" ;
}
}
# Also make a copy of that explicitly world-readable. We can't
# Also make a copy of that explicitly world-readable. We can't
# necessarily rely on the file in the source tree having those
# necessarily rely on the file in the source tree having those
# permissions.
# permissions.
copy ( "ssl/client.key" , "${PostgreSQL::Test::Utils::tmp_check}/client_wrongperms.key" ) ;
copy ( "ssl/client.key" , "$cert_tempdir/client_wrongperms.key" )
chmod 0644 , "${PostgreSQL::Test::Utils::tmp_check}/client_wrongperms.key" ;
or die
$ key { 'client_wrongperms.key' } = "${PostgreSQL::Test::Utils::tmp_check}/client_wrongperms.key" ;
"couldn't copy ssl/client_key to $cert_tempdir/client_wrongperms.key for permission change: $!" ;
chmod 0644 , "$cert_tempdir/client_wrongperms.key"
or die "failed to change permissions on $cert_tempdir/client_wrongperms.key: $!" ;
$ key { 'client_wrongperms.key' } = PostgreSQL::Test::Utils:: perl2host ( "$cert_tempdir/client_wrongperms.key" ) ;
#### Set up the server.
#### Set up the server.