95 Commits

Author SHA1 Message Date
Markus Mäkelä
828649ba99 MXS-1354: Add user authorization to maxadmin
All commands that modify the internal state of MaxScale now require admin
level authorization.
2017-08-18 10:28:21 +03:00
Markus Mäkelä
9f81f0775f MXS-1354: Rename user account type enum
Renamed the enum and its values.
2017-08-18 10:28:21 +03:00
Markus Mäkelä
9d24a63c10 MXS-1354: Add user account types to REST API
The user accounts can now be created with a specific account type. This
allows read-only users to be created for the REST API.
2017-08-18 10:28:21 +03:00
Markus Mäkelä
ec045b7ab6 MXS-1354: Add creation of basic user via MaxAdmin
MaxAdmin can now create basic users for both network and UNIX domain
socket use. Currently the basic and admin types have the same permissions
in maxadmin but for the REST API, only admin accounts can modify MaxScale.
2017-08-18 10:28:21 +03:00
Markus Mäkelä
2708942762 MXS-1354: Store users in a new format
The users are now stored as an array of JSON objects. Legacy users are
automatically upgraded once they are loaded and a backup of the original
users file is created.

Removed the password parameter from the `remove user` maxadmin command as
well as all of the relevant functions. Requiring that an administrator
knows the password of the account to be deleted is not a sound requirement
now that, at least in theory, two types of accounts can be created.
2017-08-18 10:28:20 +03:00
Markus Mäkelä
d723201d22 Add missing list terminator in debugcmd.c
The pingoptions list of commands was not terminated by an EMPTY_OPTION
value.
2017-08-17 15:05:19 +03:00
Johan Wikman
de7004cb95 Merge branch '2.1' into develop 2017-08-15 10:31:30 +03:00
geaaru
3485a32731 Fix compilation errors/warning with gcc-5.4.0 (#137)
Warning are like this:
 error: ‘delimiter’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
2017-08-15 09:56:22 +03:00
Markus Mäkelä
512c3c018d Add recycling of destroyed monitors
If a destroyed monitor is created again, it will be reused. This should
prevent excessive memory growth when the same monitor is created and
destroyed again.
2017-08-09 11:39:24 +03:00
Markus Mäkelä
61241f9e07 Remove old feedback system
The feedback system wasn't used and was starting to cause problems on
Debian 9 where the libcurl required different version of OpenSSL than what
MaxScale was linked against.
2017-07-10 16:03:50 +03:00
Markus Mäkelä
9a42709da4 Properly terminate 'ping' subcommand list
The 'ping' subcommand list was missing the terminating value of
`{EMPTY_OPTION}`.
2017-06-30 11:07:18 +03:00
Markus Mäkelä
45afbda100 Add descriptions to module commands
Each module command has to describe what it does. This should make module
commands self-documenting to some degree.
2017-06-12 10:08:25 +03:00
Markus Mäkelä
06995837cf MXS-1220: Use JSON output in dbfwfilter module commands
Added a new module command to the dbfwfilter to allow printing of rules
via the REST API. The old module command, `rules`, is now deprecated.
2017-06-12 10:08:25 +03:00
Markus Mäkelä
b3c1e15f22 MXS-1220: Add output for module commands
The module commands can now produce JSON formatted output which is passed
to the caller. The output should conform to the JSON API as closely as
possible.

Currently, the REST API wraps all JSON produced by module commands inside
a meta-object of the following type:

  {
    "meta": <output of module command>
  }

This allows the output to be JSON API conformant without modifying the
modules and allows incremental updates to code.
2017-06-12 10:08:25 +03:00
Markus Mäkelä
457fc80647 Merge branch '2.1' into develop 2017-06-05 13:25:27 +03:00
Markus Mäkelä
09a445f1b7 Fix monitor credentials parameter names
The `monitoruser` and `monitorpw` parameters were mislabeled as `monuser`
and `monpw`. To allow backwards compatibility, the `monuser` and `monpw`
still work as aliases for the correct commands.
2017-06-05 13:20:16 +03:00
Johan Wikman
f546a17e77 Update change date of 2.2 2017-06-01 10:24:20 +03:00
Markus Mäkelä
7baa52b763 Make modulecmd_argtype_to_str return values constant
The function needlessly allocated memory for the type strings.
2017-05-29 19:27:45 +03:00
Markus Mäkelä
3fd82ebae6 MXS-1220: Add alter maxscale MaxAdmin command
A set of the core MaxScale parameters can now be altered at runtime. This
set consists of the authentication timeouts and the admin interface
authentication. Other parameters either can't be modified due to internal
limitations or aren't sensible to modify at runtime.
2017-05-24 15:05:11 +03:00
Markus Mäkelä
d282b14b36 Allow runtime changes to service parameters
General service parameters can now be altered at runtime.
2017-05-04 09:17:49 +03:00
Esa Korhonen
bfd94c2b31 KILL [CONNECTION | QUERY] support, part1
Preparation for adding KILL syntax support.
Session id changed to uint32 everywhere. Added atomic op.
Session id can be acquired before session_alloc().
Added session_alloc_with_id(), which is given a session id number.
Worker object has a session_id->SESSION* mapping, not used yet.
2017-05-02 10:29:55 +03:00
Johan Wikman
7844680c7d Add possibilty to execute function in thread
Now possible to send a function and arguments to a specific worker
thread for execution.

In particular, this will be used for transferring the injection of
fake hangup events into DCBs, related to a particular server, from
the monitor thread to the worker threads, thus removing the need
for locks.
2017-04-20 13:51:16 +03:00
Johan Wikman
bb6e0767cc Add first version of MXS_WORKER
MXS_WORKER is an abstraction of a worker aka worker thread.
It has a pipe whose read descriptor is added to the worker/thread
specific poll set and a write descriptor used for sending messages
to the worker.

The worker exposes a function mxs_worker_post_message using which
messages can be sent to the worker. These messages can be sent from
any thread but will be delivered on the thread dedicated for the
worker.

To illustrate how it works, maxadmin has been provided with a new
command "ping workers" that sends a message to every worker, which
then logs a message to the log.

Additional refactoring are needed, since there currently are overlaps
and undesirable interactions between the poll mechanism, the thread
mechanism and the worker mechanism.

This is visible currently, for instance, by it not being possible to
shut down MaxScale. The reason is that the workers should be shut down
first, then the poll mechanism and finally the threads. The shutdown
need to be arranged so that a shutdown message is sent to the workers
who then cause the polling loop to exit, which will cause the threads
to exit.

That can be arranged cleanly by making poll_waitevents() a "method"
of the worker, which implies that the poll set becomes a "member
variable" of the worker.

To be continued.
2017-04-20 13:51:16 +03:00
Markus Mäkelä
0f2f9d48b7 Improve maxadmin help messages
The help messages are now more descriptive and have usage information in
them. This should help users use the commands without relying on the
online documentation.
2017-04-03 12:09:59 +03:00
Markus Mäkelä
b458b63756 Use IPv6 for created listeners
When listeners are created, use the default values of [::]:3306.
2017-03-29 17:14:39 +03:00
Markus Mäkelä
b796967df8 Add diagnostic entry point to authenticators
The authenticators should have a similar way to print diagnostic
information as filter and routers do. This allows the authenticators to
print the users in their own format.

In the future, all the diagnostic entry points should be changed so that
they return a structure that contains the information in a standard
form. This information can then be formatted in different ways by other
modules.
2017-03-13 10:45:54 +02:00
Johan Wikman
cb380d09f8 Deprecate session specific log priorities
They are not particularly useful, they surely are not used
and impose a small cost for every event extracted from the
poll sets.

This commit only removes the maxadmin commands, subsequent
commits will remove the actual code.
2017-02-27 14:40:11 +02:00
Johan Wikman
d44e38b15b Remove deprecated logging functionality 2017-02-27 14:40:00 +02:00
Johan Wikman
5648f708af Update license to BSL 1.1 2017-02-14 21:42:28 +02:00
Markus Mäkelä
869e6ac950 Remove useless maxadmin commands
The commands did nothing.
2017-02-06 10:29:10 +02:00
Markus Mäkelä
7dc5698c90 Rename domain to module
The module commands now use the module name as the replacement for
domain. The domain itself wasn't any better when compared to the module
name.
2017-01-28 10:09:34 +02:00
Esa Korhonen
8d07604436 Split maxscale.h to public and private parts
This header defines some general functions and maxscale main() return
values. Most of it is still public, but there were some functions
which were moved to a core header.
2017-01-26 11:17:25 +02:00
Esa Korhonen
aa8851fbe1 Remove listmanager
The file wasn't used, so any traces of listmanager.h or .c have been
erased.
2017-01-25 16:11:12 +02:00
Esa Korhonen
b187afdcf4 Move config_runtime.h and externcmd.h to core
+ some cleanup
2017-01-24 13:05:21 +02:00
Esa Korhonen
8cffa4ad58 Divide poll.h to core and public headers
Also some cleanup of other headers.
2017-01-20 17:15:27 +02:00
Esa Korhonen
eff34b91fb Move modules.h to core/maxscale
Also remove some unnecessary includes + cleanup
2017-01-19 15:53:25 +02:00
Esa Korhonen
53c5b475ad More cleanup of monitor.h
Move some more functions into core header + miscellaneous cleanup
2017-01-19 15:32:40 +02:00
Esa Korhonen
02a8f7492e Divide session.h to internal and interface headers
Definitions and function used by core are in
server/core/maxscale/session.h
Definitions and function used by plugins are in
include/maxscale/session.h
2017-01-19 15:19:40 +02:00
Esa Korhonen
fb771c8a2e Rename public types and constants in session.h
Preparing to split session.h into module and core sections.
2017-01-17 16:30:14 +02:00
Esa Korhonen
680401cf8e Rename public types and constants in monitor.h
Preparing to split monitor.h into module and core sections. Also
changed a few comments in monitor.h.
2017-01-17 15:47:13 +02:00
Markus Mäkelä
a48be9badf Format router modules
Formatted router modules with Astyle.
2017-01-17 14:48:43 +02:00
Markus Mäkelä
d054bc9b04 Split config.h into external and internal parts
The external config.h header defined functions and structures that are
intended to be used by modules. The internal header contains functions
that are used only by the MaxScale core.
2017-01-16 11:02:34 +02:00
Johan Wikman
265e5c0593 Rename FILTER_DEF to MXS_FILTER_DEF
Provide functions that allows the actual definition of MXS_FILTER_DEF
to be made private.
2017-01-13 14:30:11 +02:00
Markus Mäkelä
56ecdc219b Refactor config.c functions for testing
To test the configuration validation and default value generation, the
functions needed to be refactored to allow parameters to be passed
directly to the function.
2017-01-09 14:17:33 +02:00
Markus Mäkelä
72ea3ad453 Fix improper use of monitorStart
Some uses of monitorStart didn't pass the monitor parameters to the
function call. This caused runtime configuration of monitors to not have
any parameters as they never got their parameters.
2017-01-09 14:17:33 +02:00
Markus Mäkelä
47ac20adea Refer to sessions by ID instead of memory address
Using the unique ID for the session is easier to use than an address. This
also allows the removal of all pointer values from the maxadmin output
which is never useful to the end user.
2016-12-22 17:55:05 +02:00
Markus Mäkelä
2bdda586f7 Remove CLI service modes
The modes weren't used and provided access to raw memory which is not
safe.
2016-12-22 17:55:05 +02:00
Markus Mäkelä
7cbd62db52 Fix show dbusers
The functionality was broken by the change where the users were moved from
the service to the listener.
2016-12-22 17:55:05 +02:00
Markus Mäkelä
aae84144ea Add show version command to maxadmin
After upgrades, it is usually useful to see which version of MaxScale is
running. By adding a command, we can see the actual version of the running
daemon process instead of the version of the current binary.
2016-12-19 18:40:14 +02:00
Markus Makela
916320cf67 Clean up maxadmin help output
The detailed output of the new help command was a bit too densely packed
for some commands.

Added missing values for the `alter server` command help output.
2016-12-14 11:23:17 +02:00