Commit Graph

13413 Commits

Author SHA1 Message Date
f09d46c8e6 MXS-2457 Allow string arguments to be treated as fields
Before this change, the masking could be bypassed simply by

    > set @@sql_mode='ANSI_QUOTES';
    > select concat("ssn") from person;

The reason is that as the query classifier is not aware of whether
'ANSI_QUOTES' is on or not, it will not know that what above appears
to be the string "ssn", actually is the field name `ssn`. Consequently,
the select will not be blocked and the result returned in cleartext.

It's now possible to instruct the query classifier to report all string
arguments of functions as fields, which will prevent the above. However,
it will also mean that there may be false positives.
2019-05-03 13:38:12 +03:00
20afbfca76 Merge branch '2.3' into develop 2019-05-02 20:24:04 +03:00
09d04a09d4 Merge branch '2.2' into 2.3 2019-05-02 20:11:51 +03:00
3dd9298b18 MXS-2456: Test transaction replay cap
Added a test that makes sure the transaction replay cap is respected. Also
improved the logging to show how many transaction replay attemps have been
done and to log if a replay is not done due to too many attempts.
2019-05-02 16:59:36 +03:00
26b2897280 MXS-2456: Cap transaction replay attempts
In most cases it is reasonable to stop attempting transaction replays
after a certain number of failed attempts. This prevents transactions from
being repeatedly replayed on the same server over and over again if, for
example, it keeps crashing.
2019-05-02 16:59:36 +03:00
bc654849e8 Fix duration JSON representation
Duration values converted to JSON are now again returned as integers. This
keeps the REST API backwards compatible until suffixed durations are no
longer supported at which point all duration values can be represented in
milliseconds.
2019-05-02 16:54:19 +03:00
0d61522586 Fix test_adminusers
The test did not remove old inet user password files.
2019-05-02 12:53:42 +03:00
33ef183a7f Update maxctrl dependencies
This fixes some vulnerabilities reported by npm.
2019-05-02 12:31:35 +03:00
864c38aa96 Add missing enum value
The string form of MXS_MODULE_PARAM_DURATION was not present which
triggered a debug assertion.
2019-04-30 14:49:36 +03:00
0c5a45cb85 MXS-2414: Remove unused variable 2019-04-30 14:49:36 +03:00
9e85389b80 MXS-2414: Add test case
Added a test that checks the host blocking is triggered and it blocks even
successful authentication attemps.
2019-04-30 14:49:36 +03:00
59be841939 MXS-2414: Rename max_auth_failures to max_auth_errors_until_block 2019-04-30 14:49:36 +03:00
6418bf017c MXS-2414: Document max_auth_failures 2019-04-30 14:49:35 +03:00
6caa8e55b0 MXS-2414: Send error when host is blocked
If a connection attempt is not accepted due to the host being blocked, the
protocol can now return an error message that is sent to the client. Only
mariadb_client implements this as it is the only one who calls the auth
failure methods in the first place.
2019-04-30 14:49:35 +03:00
db0e491ace MXS-2414: Add max_auth_failures parameter
The parameter controls how many authentication failures are allowed until
the host is blocked. The default is 10 failures per thread.
2019-04-30 14:49:35 +03:00
cf86b0cb7e MXS-2414: Prototype connection attempt throttling
The RateLimit class stores authentication failure data mapped by the
client IP addresses. The authentication failures are limited
per thread. The limits are still hard-coded and at least the number of
failures should be made configurable.

The simplest, most maintainable and acceptably efficient implementation
for DDoS protection is a thread-local unordered_map. The unwanted
side-effect of "scaling" of the number of allowed authentication failures
is unlikely to be problematic in most use-cases.

As the blocking of a host is only temporary, the behavior differs from the
one in the MariaDB server. This allows the number of failures to be set to
a much lower value negating some of the problems caused by the relatively
simple implementation.
2019-04-30 14:49:35 +03:00
d1ab4fcb89 MXS-2329 Fix missing duration type 2019-04-30 14:31:47 +03:00
753fa0552a MXS-2366: Fix RPATH setting for tarball
All RPATH setting have to be set before generation of any binary.
Defining of CMAKE_INSTALL_RPATH is moved to separate file which is called from main CMakeLists.txt in the beginning, just after install_layout.cmake
2019-04-30 14:18:33 +03:00
82b4338eca Remove MonitorManager calls from Monitor functions
Also adds admin thread checks to MonitorManager functions and combines
anonymous namespaces.
2019-04-30 13:45:48 +03:00
c4b27cdefc Store server->monitor relation in a map
Removes the need to iterate through monitor serverlists. Also adds asserts to verify
that monitor modifications are done only from an admin thread.
2019-04-30 13:45:48 +03:00
2115322737 MXS-2329 Change warning into info
Currently it's too laborious to use duration suffixes when saving
generated configs and also to handle suffixes when changes are made
dynamically using maxctrl.

It will be trivial to do that when the new configuration mechanism
has been taken into use everywhere. That will not happen before
MaxScale 2.5.

So, in MaxScale 2.4 duration suffixes will be accepted in manually
created configuration files, but no warning will be logged if a
suffix is not used.
2019-04-30 13:02:53 +03:00
ccb3ea6157 MXS-2329 Update monitor tutorials 2019-04-30 13:02:53 +03:00
3d420dee6f MXS-2329 Use durations in MariaDB monitor 2019-04-30 13:02:53 +03:00
b4518afba1 MXS-2329 Fix Aurora monitor documentation 2019-04-30 13:02:53 +03:00
c60c5e4626 MXS-2329 Use durations in monitor (common parts) 2019-04-30 13:02:53 +03:00
aa3057695b MXS-2329 Use durations in schema router 2019-04-30 13:02:53 +03:00
ea243fd8ba MXS-2329 Use durations in readwritesplit 2019-04-30 13:02:53 +03:00
ca51316364 MXS-2329 0 is a valid duration, with or without a suffix 2019-04-30 13:02:53 +03:00
0f5972e010 MXS-2329 Use durations with BLR:[heartbeat|connect_retry] 2019-04-30 13:02:53 +03:00
b1a495b342 MXS-2329 Use durations with persistmaxtime 2019-04-30 13:02:53 +03:00
93e130bb48 MXS-2329 Use durations with max_retry_interval 2019-04-30 13:02:53 +03:00
75fbcc9393 MXS-2329 Use durations in log_throttling 2019-04-30 13:02:53 +03:00
9fb4116bf5 MXS-2329 Use durations with connection_timeout 2019-04-30 13:02:53 +03:00
638debcdc0 MXS-2329 Allow the restriction of duration units
It's now possible to specify in the config parameter declaration
that the smallest allowed unit is seconds. For parameters whose
granularity is seconds, allowing to specify a duration in
milliseconds would open up a possibility for hard to detect errors.
2019-04-30 13:02:53 +03:00
8a250a8b13 MXS-2329 Make duration misuse harder
Now the desired type must be specified when getting a duration.
The type also dictates how durations without suffixes should be
interpreted.

That removes the need for remembering that to convert a returned
millisecond duration to a second duration.
2019-04-30 13:02:53 +03:00
8bf0e00b1c MXS-2329 Use duration with users_refresh_time 2019-04-30 13:02:53 +03:00
3055e49f5a MXS-2329 Use durations with query_retry_timeout
Also change auth_[connect|read|write]_timeout to be time_t.
2019-04-30 13:02:53 +03:00
92cc31f0c0 MXS-2329 Use durations with auth_[connect|read|write]_timeout 2019-04-30 13:02:53 +03:00
284a5057fb Update version of develop to 2.4.0 2019-04-30 13:02:28 +03:00
643514bbe4 Merge branch '2.3' into develop 2019-04-30 12:46:07 +03:00
dd188962cd MXS-2427 Check all hints when routing
Now considers other routing hints if first one fails. The order is inverted compared
to e.g. namedserver filter settings because of how routing hints are stored. If all hints
are unsuccessful, route to any slave.
2019-04-29 16:49:32 +03:00
ded4050997 Add missing header to test_host_class 2019-04-29 15:59:41 +03:00
1f4ffd14e4 Always use a newer compiler on CentOS
For some reason the previous change was not commited in develop.
2019-04-29 12:46:00 +03:00
b13ffc73ef Alow [en|dis]abling of uncrustify
With

    // *uncrustify-off*

    ...

    // *uncrustify-on*

it is now possible to disable uncrustify for a particular code block.
Comes in handy at times.
2019-04-29 10:42:33 +03:00
3c8d6fc175 Fix Werror=format-overflow warning in bug471 2019-04-27 16:32:34 +03:00
08bd7c99be Add a possibility to run tests under callgrind
Flag 'use_callgrind' make all maxscale-system-test run Maxscale under Valgrind with --tool=callgrind option
2019-04-26 17:30:10 +03:00
ea14331d18 Move DCB owner selection into Listener
The code that selects which worker to assign the DCB to is now completely
in the Listener class. This removes the need to change the ownership of a
DCB after it has been allocated.
2019-04-26 13:18:37 +03:00
510cae2fe0 Allocate DCB on owning thread
The DCB is now fully allocated on the thread that owns it. This guarantees
that the owner is always correct when it is used.

The code in poll_add_dcb still manipulates which worker the DCB is
allocated. This needs to be removed and the detection of special needs
(maxadmin, maxinfo) must be moved into the listener.
2019-04-26 11:40:30 +03:00
dc244342f8 Prevent assignments in assertions
Using the else branch instead of explicitly negating the assertion makes
sure the compiler catches assignments in assertion expressions.
2019-04-26 11:40:30 +03:00
fd51048640 Don't align function parameters
The function parameters in declarations are not aligned.
2019-04-26 11:40:30 +03:00