MXS-1220: Add HTTP BA authentication

The admin interface now supports Basic Access authentication. This is not
a secure method of authentication and it should not be used without
unencrypted connections.

Made the admin interface port, authentication, username and password
configurable.
This commit is contained in:
Markus Mäkelä
2017-04-18 13:18:31 +03:00
committed by Markus Mäkelä
parent d242203279
commit 52e0cc8e16
7 changed files with 88 additions and 13 deletions

View File

@ -30,6 +30,9 @@ MXS_BEGIN_DECLS
/** Default user for the administrative interface */
#define DEFAULT_ADMIN_USER "@DEFAULT_ADMIN_USER@"
static const char INET_DEFAULT_USERNAME[] = "admin";
static const char INET_DEFAULT_PASSWORD[] = "mariadb";
/*
* MySQL session specific data
*

View File

@ -26,7 +26,12 @@
MXS_BEGIN_DECLS
/** Default port where the REST API listens */
#define DEFAULT_ADMIN_HTTP_PORT 8080
#define _RELEASE_STR_LENGTH 256 /**< release len */
#define MAX_ADMIN_USER_LEN 1024
#define MAX_ADMIN_PW_LEN 1024
/**
* The config parameter
@ -74,6 +79,10 @@ typedef struct
bool skip_permission_checks; /**< Skip service and monitor permission checks */
char qc_name[PATH_MAX]; /**< The name of the query classifier to load */
char* qc_args; /**< Arguments for the query classifier */
char admin_user[MAX_ADMIN_USER_LEN]; /**< Admin interface user */
char admin_password[MAX_ADMIN_PW_LEN]; /**< Admin interface password */
uint16_t admin_port; /**< Admin interface port */
bool admin_auth; /**< Admin interface authentication */
} MXS_CONFIG;
/**