This authentication method uses SSL client certificates to perform authentication. It is therefore only available for SSL connections. When using this authentication method, the server will require that the client provide a valid, trusted certificate. No password prompt will be sent to the client.
Strategy currently supports PostgreSQL certificate based authentication using the PostgreSQL native driver. This articles demonstrate how to connect to the PostgreSQL database using certificate based authentication in Strategy.
$ mkdir /opt/TLS/ $ cd /opt/TLS/ $ mkdir keys certs pgconf $ chmod og-rwx keys certs pgconf
$ openssl req -new -x509 -days 365 -nodes -out certs/ca.crt \ -keyout keys/ca.key -subj "/CN=root-ca" $ cp certs/ca.crt pgconf/ca.crt
$ openssl req -new -nodes -out server.csr \ -keyout pgconf/server.key -subj "/CN=tec-l-012363" $ openssl x509 -req -in server.csr -days 365 \ -CA certs/ca.crt -CAkey keys/ca.key -CAcreateserial \ -out pgconf/server.crt
postgresql.conf(
/var/lib/pgsql/12/data/postgresql.conf):
# Default listen addresses is localhost,change based on your needs. listen_addresses = '*' # here are the SSL specific settings ssl = on # this enables SSL ssl_cert_file = '/opt/TLS/pgconf/server.crt' # this specifies the server certificacte ssl_key_file = '/opt/TLS/pgconf/server.key' # this specifies the server private key ssl_ca_file = '/opt/TLS/pgconf/ca.crt' # this specific which CA certificate to trust
pg_hba.conf(
/var/lib/pgsql/12/data/pg_hba.conf). We only configure certificate based authentication for remote connections.
# TYPE DATABASE USER ADDRESS METHOD local all postgres peer # do not let the "postgres" superuser login via a certificate hostssl all postgres ::/0 reject hostssl all postgres 0.0.0.0/0 reject # hostssl all all ::/0 cert hostssl all all 0.0.0.0/0 cert
~/.postgresqldirectory. Copy the certificate to the machine if you are connecting from a remote client.
$ openssl req -new -nodes -out client.csr \ -keyout keys/client.key -subj "/CN=tpch" $ openssl x509 -req -in client.csr -days 365 \ -CA certs/ca.crt -CAkey keys/ca.key -CAcreateserial \ -out certs/client.crt
$ export PGSSLMODE="verify-full" $ export PGSSLCERT="`pwd`/certs/client.crt" $ export PGSSLKEY="`pwd`/keys/client.key" $ export PGSSLROOTCERT="`pwd`/certs/ca.crt"
$ psql -h tec-l-012363 -p 5432 -U tpch -d tpch psql (10.13, server 12.3) WARNING: psql major version 10, server major version 12. Some psql features might not work. SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256, compression: off) Type "help" for help. tpch=> \q
We will demonstrate using the PostgreSQL native driver how to connect to the PostgreSQL database using certificate based authentication in Strategy.
[PGN] Driver=/usr/pgsql-11/lib/psqlodbcw.so Description=PostgreSQL Unicode(x64) Database=tpch Servername=tec-l-012363 Port=5432 Protocol=9.3 ReadOnly=No RowVersioning=No ShowSystemTables=No ConnSettings= DriverUnicodeType=1 SSLmode=verify-full Pqopt=sslrootcert=/home/ec2-user/TLS/certs/ca.crt sslcert=/home/ec2- user/TLS/certs/client.crt sslkey=/home/ec2-user/TLS/keys/client.key
[ec2-user@CentOS-RELEASE-10-244-20-230 Linux]$ ./bin/mstrtodbcx Strategy ODBC Test Tool Version 11.3.0000.3619 Type .help (including the period) for help. - > .cn -d PGN -u tpch # Data Source Name: PGN # Login: tpch # Connection type : Strategy DB Classes PGN > .quit
Since Strategy 2021 Update 4, certificate based authentication with Strategy ODBC Driver for PostgreSQL Wire Protocol is also supported.
Create a data source name (DSN).
[Postgres] ApplicationUsingThreads=1 AlternateServers= AuthenticationMethod=18 Description=Strategy ODBC Driver for PostgreSQL Wire Protocol FailoverPreconnect=0 FetchTWFSasTime=1 Driver=/opt/mstr/MicroStrategy/install/lib/MYpsqlXX.so ConnectionRetryDelay=3 ClientSSLCertificate=/tmp/abc/client.crt ClientSSLKey=/tmp/abc/client.key EnableDescribeParam=1 InitializationString= FetchRefCursors=1 Database=postgres QueryTimeout=0 HostName=tec-l-1034973 FetchTSWTZasTimestamp=1 ReportCodePageConversionErrors=0 FailoverMode=0 LoadBalancing=0 ConnectionRetryCount=0 ExtendedColumnMetaData=0 XMLDescribeType=-10 LoginTimeout=15 TransactionErrorBehavior=0 FailoverGranularity=0 PortNumber=5432 LogonID=tpch TrustStore=/tmp/abc/ca.crt