From 7643dd1445115526a193b8b64cbe2ac869e4262a Mon Sep 17 00:00:00 2001 From: Esa Korhonen Date: Tue, 23 Mar 2021 18:02:53 +0200 Subject: [PATCH] MXS-3417 Move mxs1662_pam_admin-test inside pam_authentication The test failed because the linux user it used was not available on buildbot. Now the test is part of the larger pam_authentication- test, which sets up the users. --- system-test/CMakeLists.txt | 6 ++---- .../cnf/maxscale.cnf.template.mxs1662_pam_admin | 3 --- .../cnf/maxscale.cnf.template.pam_authentication | 1 + system-test/mxs1662_pam_admin.cpp | 15 --------------- system-test/pam_authentication.cpp | 13 +++++++++++++ 5 files changed, 16 insertions(+), 22 deletions(-) delete mode 100755 system-test/cnf/maxscale.cnf.template.mxs1662_pam_admin delete mode 100644 system-test/mxs1662_pam_admin.cpp diff --git a/system-test/CMakeLists.txt b/system-test/CMakeLists.txt index 82f156d5c..21291625f 100644 --- a/system-test/CMakeLists.txt +++ b/system-test/CMakeLists.txt @@ -802,13 +802,11 @@ add_test_executable(mxs2417_ignore_persisted_cnf.cpp mxs2417_ignore_persisted_cn # MXS-2450: Crash on COM_CHANGE_USER with disable_sescmd_history=true add_test_executable(mxs2450_change_user_crash.cpp mxs2450_change_user_crash mxs2450_change_user_crash LABELS REPL_BACKEND readwritesplit) -# MXS-1662: PAM admin authentication -add_test_executable(mxs1662_pam_admin.cpp mxs1662_pam_admin mxs1662_pam_admin LABELS REPL_BACKEND) - # MXS-2414: Block host after repeated authentication failures add_test_executable(mxs2414_host_blocking.cpp mxs2414_host_blocking replication LABELS REPL_BACKEND) -# PAM authentication +# PAM authentication. +# Also tests MXS-1662: PAM admin authentication add_test_executable(pam_authentication.cpp pam_authentication pam_authentication LABELS REPL_BACKEND) # MXS-2350: On-demand connection creation diff --git a/system-test/cnf/maxscale.cnf.template.mxs1662_pam_admin b/system-test/cnf/maxscale.cnf.template.mxs1662_pam_admin deleted file mode 100755 index 6d016e412..000000000 --- a/system-test/cnf/maxscale.cnf.template.mxs1662_pam_admin +++ /dev/null @@ -1,3 +0,0 @@ -[maxscale] -threads=###threads### -admin_pam_readwrite_service=passwd diff --git a/system-test/cnf/maxscale.cnf.template.pam_authentication b/system-test/cnf/maxscale.cnf.template.pam_authentication index d96073326..05f9caf4f 100644 --- a/system-test/cnf/maxscale.cnf.template.pam_authentication +++ b/system-test/cnf/maxscale.cnf.template.pam_authentication @@ -1,5 +1,6 @@ [maxscale] threads=###threads### +admin_pam_readwrite_service=duckburg log_info=1 [MySQL-Monitor] diff --git a/system-test/mxs1662_pam_admin.cpp b/system-test/mxs1662_pam_admin.cpp deleted file mode 100644 index c6f9f8101..000000000 --- a/system-test/mxs1662_pam_admin.cpp +++ /dev/null @@ -1,15 +0,0 @@ -/** - * MXS-1662: PAM authenticator for admin users - */ - -#include - -int main(int argc, char** argv) -{ - TestConnections test(argc, argv); - - // TODO: Store login information - test.check_maxctrl("-u vagrant -p vagrant show maxscale"); - - return test.global_result; -} diff --git a/system-test/pam_authentication.cpp b/system-test/pam_authentication.cpp index 0678d3a00..d15768827 100644 --- a/system-test/pam_authentication.cpp +++ b/system-test/pam_authentication.cpp @@ -15,6 +15,7 @@ #include "mariadbmonitor/fail_switch_rejoin_common.cpp" #include #include +#include using std::string; using std::cout; @@ -82,6 +83,7 @@ int main(int argc, char** argv) if (test.ok()) { cout << "PAM-plugin installed and users created on all servers. Starting MaxScale.\n"; + test.maxscales->restart(0); } else { @@ -176,6 +178,17 @@ int main(int argc, char** argv) test.maxscales->execute_maxadmin_command(0, "reload dbusers RWSplit-Router"); }; + if (test.ok()) + { + // First, test that MaxCtrl login with the pam user works. + string cmd = string_printf("-u %s -p %s show maxscale", pam_user, pam_pw); + test.check_maxctrl(cmd); + if (test.ok()) + { + cout << "'maxctrl " << cmd << "' works.\n"; + } + } + const char create_pam_user_fmt[] = "CREATE OR REPLACE USER '%s'@'%%' IDENTIFIED VIA pam USING '%s';"; if (test.ok()) {