timescaledb/tsl/test/ssl/CMakeLists.txt
Mats Kindahl 7a93a2f805 Change location of user certificates and keys
User certificates and keys for logging into data nodes are stored at
the top level of the `ssl_dir` or in the data directory. This can cause
some confusion since a lot of files with user names resembling existing
configuration files will be created as users are added, so this commit
change the location of the user certificates and keys to be in the
`timescaledb/certs` subdirectory of either the `ssl_dir` or data
directory.

In addition, since user names can contain strange characters (quoted
names are allowed as role names, which can contain anything) the commit
changes the names for certificates and keys to use the MD5 sum as hex
string as base name for the files. This will prevent strange user names
from accessing files outside the certificate directory.

The subdirectory is currently hardcoded.
2020-05-27 17:31:09 +02:00

55 lines
1.5 KiB
CMake

# Copy certificates and keys used for testing
#
#
# We need to ensure, that private key files have user only
# access permissions in order to work.
#
# Certificates for users uses the MD5 sum in hex for the base file
# name. To generate a base filename, pass the role name *without
# terminating newline or null* into md5sum, for example:
#
# echo -n cluster_super_user | md5sum
#
set(TEST_USERS_DIR "${TEST_OUTPUT_DIR}/timescaledb/certs")
# CA cert
file(COPY ts_root.crt
DESTINATION ${TEST_OUTPUT_DIR})
# Data node cert and private key
file(COPY ts_data_node.crt
DESTINATION ${TEST_OUTPUT_DIR})
file(COPY ts_data_node.key
DESTINATION ${TEST_OUTPUT_DIR}
NO_SOURCE_PERMISSIONS
FILE_PERMISSIONS OWNER_READ OWNER_WRITE)
# User cluster_super_user
file(COPY f458066b3557e1db0a54e19f4ab201d9.crt
DESTINATION ${TEST_USERS_DIR})
file(COPY f458066b3557e1db0a54e19f4ab201d9.key
DESTINATION ${TEST_USERS_DIR}
NO_SOURCE_PERMISSIONS
FILE_PERMISSIONS OWNER_READ OWNER_WRITE)
# User test_role_1
file(COPY 83d86aa56283c8f681d9fc710e8240ad.crt
DESTINATION ${TEST_USERS_DIR})
file(COPY 83d86aa56283c8f681d9fc710e8240ad.key
DESTINATION ${TEST_USERS_DIR}
NO_SOURCE_PERMISSIONS
FILE_PERMISSIONS OWNER_READ OWNER_WRITE)
file(COPY 2beea6688fa571d4ebacdaf472fb9eb3.crt
DESTINATION ${TEST_USERS_DIR})
file(COPY 2beea6688fa571d4ebacdaf472fb9eb3.key
DESTINATION ${TEST_USERS_DIR}
NO_SOURCE_PERMISSIONS
FILE_PERMISSIONS OWNER_READ OWNER_WRITE)