MXS-1220: Allow admin interface to be disabled
Allowing the admin interface to be disabled completely makes it possible to remove any security concerns that could arise from its use.
This commit is contained in:

committed by
Markus Mäkelä

parent
39da11763b
commit
ca7b24f6fa
@ -54,6 +54,7 @@ using std::string;
|
||||
|
||||
const char CN_ADDRESS[] = "address";
|
||||
const char CN_ADMIN_AUTH[] = "admin_auth";
|
||||
const char CN_ADMIN_ENABLED[] = "admin_enabled";
|
||||
const char CN_ADMIN_HOST[] = "admin_host";
|
||||
const char CN_ADMIN_PASSWORD[] = "admin_password";
|
||||
const char CN_ADMIN_PORT[] = "admin_port";
|
||||
@ -1552,6 +1553,10 @@ handle_global_item(const char *name, const char *value)
|
||||
{
|
||||
gateway.admin_auth = config_truth_value(value);
|
||||
}
|
||||
else if (strcmp(name, CN_ADMIN_ENABLED) == 0)
|
||||
{
|
||||
gateway.admin_enabled = config_truth_value(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; lognames[i].name; i++)
|
||||
@ -1774,6 +1779,7 @@ global_defaults()
|
||||
gateway.skip_permission_checks = false;
|
||||
gateway.admin_port = DEFAULT_ADMIN_HTTP_PORT;
|
||||
gateway.admin_auth = false;
|
||||
gateway.admin_enabled = true;
|
||||
strcpy(gateway.admin_host, DEFAULT_ADMIN_HOST);
|
||||
strcpy(gateway.admin_user, INET_DEFAULT_USERNAME);
|
||||
strcpy(gateway.admin_password, INET_DEFAULT_PASSWORD);
|
||||
|
@ -1982,16 +1982,19 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (mxs_admin_init())
|
||||
if (cnf->admin_enabled)
|
||||
{
|
||||
MXS_NOTICE("Started REST API on [%s]:%u", cnf->admin_host, cnf->admin_port);
|
||||
}
|
||||
else
|
||||
{
|
||||
const char* logerr = "Failed to initialize admin interface";
|
||||
print_log_n_stderr(true, true, logerr, logerr, 0);
|
||||
rc = MAXSCALE_INTERNALERROR;
|
||||
goto return_main;
|
||||
if (mxs_admin_init())
|
||||
{
|
||||
MXS_NOTICE("Started REST API on [%s]:%u", cnf->admin_host, cnf->admin_port);
|
||||
}
|
||||
else
|
||||
{
|
||||
const char* logerr = "Failed to initialize admin interface";
|
||||
print_log_n_stderr(true, true, logerr, logerr, 0);
|
||||
rc = MAXSCALE_INTERNALERROR;
|
||||
goto return_main;
|
||||
}
|
||||
}
|
||||
|
||||
MXS_NOTICE("MaxScale started with %d server threads.", config_threadcount());
|
||||
|
Reference in New Issue
Block a user