From 903cb91c568705ef4a3142e62b09b7a9cdd85e20 Mon Sep 17 00:00:00 2001 From: Peifeng Qiu Date: Thu, 4 Jul 2019 12:06:22 +0900 Subject: [PATCH] Windows: change kerberos service name to postgres (#8060) The kerberos service name of gpdb and psql must match to allow proper kerberos authentication. For linux platform this is controlled by --with-krb-srvnam. For Windows platform it's hardcoded in template pg_config.h.win32. We currently build gpdb server without specifying --with-krb-srvnam, and the default value is "postgres". Change the correspond value that hardcoded Windows config template to "postgres" also. - Package necessary kerberos utility with windows installer - Add Kerberos auth test for Windows client --- concourse/scripts/ic_gpdb_remote_windows.bash | 72 +++++++++++++++++-- concourse/scripts/ic_gpdb_remote_windows.bat | 8 +++ concourse/scripts/windows_remote_test.ps1 | 1 + .../install/src/windows/CopyDependencies.bat | 4 ++ .../install/src/windows/greenplum-clients.wxs | 4 ++ src/include/pg_config.h.win32 | 2 +- 6 files changed, 83 insertions(+), 8 deletions(-) diff --git a/concourse/scripts/ic_gpdb_remote_windows.bash b/concourse/scripts/ic_gpdb_remote_windows.bash index 91f4c778e3..0d750cc139 100755 --- a/concourse/scripts/ic_gpdb_remote_windows.bash +++ b/concourse/scripts/ic_gpdb_remote_windows.bash @@ -6,11 +6,13 @@ set -eo pipefail CWDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" source "${CWDIR}/common.bash" +export DEFAULT_REALM=GPDB.KRB + function setup_gpadmin_user() { ./gpdb_src/concourse/scripts/setup_gpadmin_user.bash "${TEST_OS}" } -function configure_gpdb_ssl() { +function configure_gpdb_ssl_kerberos() { cp ./gpdb_src/src/test/ssl/ssl/server.crt "${MASTER_DATA_DIRECTORY}" cp ./gpdb_src/src/test/ssl/ssl/server.key "${MASTER_DATA_DIRECTORY}" cp ./gpdb_src/src/test/ssl/ssl/root+server_ca.crt "${MASTER_DATA_DIRECTORY}" @@ -22,9 +24,58 @@ function configure_gpdb_ssl() { echo "ssl_cert_file='server.crt'">> "${PG_CONF}" echo "ssl_key_file='server.key'">> "${PG_CONF}" + gpconfig -c krb_server_keyfile -v '/home/gpadmin/gpdb-server-krb5.keytab' + PG_HBA="${MASTER_DATA_DIRECTORY}/pg_hba.conf" echo "hostssl all gpadmin 0.0.0.0/0 trust">> "${PG_HBA}" + echo "host all all 0.0.0.0/0 gss include_realm=0 krb_realm=${DEFAULT_REALM}" >> "${PG_HBA}" gpstop -ar + + psql postgres -c 'create role "user1/127.0.0.1" superuser login' +} + +function setup_kerberos() { + +# Setup krb5.conf +cat > /etc/krb5.conf < + + + + diff --git a/src/include/pg_config.h.win32 b/src/include/pg_config.h.win32 index 5ba9bef5a3..b30cff42d4 100755 --- a/src/include/pg_config.h.win32 +++ b/src/include/pg_config.h.win32 @@ -647,7 +647,7 @@ /* Define to the name of the default PostgreSQL service principal in Kerberos. (--with-krb-srvnam=NAME) */ -#define PG_KRB_SRVNAM "greenplum" +#define PG_KRB_SRVNAM "postgres" /* A string containing the version number, platform, and C compiler */ #define PG_VERSION_STR "Uninitialized version string (win32)" -- GitLab