Commit Graph

2951 Commits

Author SHA1 Message Date
e9bcb3c7e0 Remove deprecated logging functionality 2017-02-14 11:19:30 +02:00
9a03ba4566 Use on-disk database for MySQLAuth users
The SQLite database is now always created on disk. This will remove the
need to dump the database users from the in-memory database to the
persisted on-disk database.

This change will also make the authentication compatible with older SQLite
implementations which lack the URI-based database strings found in newer
versions.
2017-02-13 17:42:19 +02:00
825782799f Zendesk's Maxwell Compatibility (#119)
* Binlog router: Introduce maxwell_compatibility flag

* Binlog router: Handle 'server vars' query

This is a step towards using MaxScale with Zendesk's Maxwell.

* Binlog router: Handle results charset query

* Binlog router: Handle sql_mode query

* Binlog router: Handle server_id query

* Binlog router: Handle 'binlog vars' queries

* Binlog router: Handle @@lower_case_table_names query

* Binlog router: Handle @@global.binlog_checksum query

* Binlog router: DRY Maxwell SQL queries
2017-02-13 16:40:01 +01:00
5eed48942f Fix empty password detection
If a user was defined without a password, the authentication would fail.
2017-02-13 13:00:59 +02:00
d25d0e9c4e Don't request and set UUID if the master server is MariaDB 10
SHOW VARIABLES LIKE 'SERVER_UUID' and SET @slave_uuid are meant only
for MySQL 5.6/7 master registration.

If MariaDB 10 compatibility is set then skip these useless requests.
2017-02-10 10:33:40 +01:00
54d4a562ce Merge branch '2.1' into develop 2017-02-09 15:07:13 +02:00
b46bc47c87 Add NullFilter filter module
NullFilter is a filter module that does nothing, except reports
capabilities as defined in the configuration file. It's purpose
is only to make it simple to benchmark the performance impact
various routing capabilities have.

Note that since getCapabilities() currently does *not* take an
instance pointer as parameter, all NullFilter instances will
report the same capabilities, the ones specified for the last
filter to have been loaded.
2017-02-09 15:02:34 +02:00
ce5cd69eb3 Remove unused locks and variables
Removed unused spinlocks from DCBs, sessions and the MySQL protocol
structs. They were used in a context where only one thread has access to
the structure.

Removed unused member variables from DCBs.
2017-02-08 15:31:17 +02:00
5cd29c4220 Merge branch '2.1' into develop 2017-02-08 09:32:18 +02:00
a6698c6f07 Merge branch '2.1.0' into 2.1 2017-02-08 09:30:34 +02:00
c82831cc10 Fix merge conflict
An old define name caused the build to fail.
2017-02-08 09:29:26 +02:00
67888f3596 Merge branch '2.0' into 2.1.0 2017-02-08 09:27:00 +02:00
7149775163 Use correct enum values in avrorouter
The file flushing enums weren't used.
2017-02-07 10:21:58 +02:00
d61f0d0afd Remove useless debug assertion
The debug assertion assumes that the table definition is always in the
binlogs. If a binlog row event without a table definition is read, debug
versions would crash even though the situation is acceptable and expected.
2017-02-07 10:21:58 +02:00
b074e7e8c8 Fix user cache directory permissions
The user cache directory is only used by the maxscale user so only the
maxscale user should have access to it.
2017-02-07 10:03:58 +02:00
c6e1705f8d 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-02-07 10:03:58 +02:00
a909fd0208 Fix injection of service user
The parameters that were given to the user creation function were in the
wrong order.
2017-02-07 10:03:58 +02:00
62fdd68ac0 Make sure user cache directory exists
The cache directory needs to be created by the authenticator itself.
2017-02-07 10:03:58 +02:00
70061e6323 Return correct value for failed db authentication
The unknown database error was never triggered as all authentication
errors returned MXS_AUTH_FAILED.
2017-02-07 10:03:58 +02:00
11c3e6ac91 Don't users with a pre-4.1 password
The old error message and behavior was lost with the new implementation.
2017-02-07 10:03:58 +02:00
9a80e1cd5b Reorder SQL statements when persisting users
The statements are now executed in a more controlled order and a failure
of one will skip the others. The transaction is also rolled back if it
fails.
2017-02-07 10:03:58 +02:00
7ad7536b57 Fix enable_root_user
The option was inverted.
2017-02-07 10:03:58 +02:00
7dce744e0b Remove unused code from MySQLAuth
Removed the old implementation of MySQL authentication. The user printing
functionality still expects a hashtable which should be fixed.
2017-02-07 10:03:58 +02:00
4d5d988bf0 Exact hostnames grants take precedence over wildcard grants
MariaDB and others match grants first by exact hostname/IP and then by
wildcard. If there are no exact matches, the wildcard grant should be
picked. This can be tested by having different passwords for localhost and
remote address.

The SQLite based authentication should first check for an exact match and
then only after that should it try to match the hostname to a wildcard
grant.
2017-02-07 10:03:57 +02:00
2b59d5031e Fix memory leak in dbusers.c
The MySQL connection was created twice.
2017-02-07 10:03:57 +02:00
fe1a49f4e9 Use new authentication for reauthentication
This fixes the reauthentication of users that was missing from the new
implementation. Now COM_CHANGE_USER should work properly.
2017-02-07 10:03:57 +02:00
acdde499ed Replace get_users implementation with new version
The get_users function now combines the functionality of the old get_users
and get_all_users. This removes large parts of similar code.

Removed the listener resources as MySQLAuth was the only one that used it.
2017-02-07 10:03:57 +02:00
3d2fc2ccb2 Store SQLite tables on disk
The SQLite database users are cached on disk. This allows the binlogrouter
to authenticate users without a connection to the master server.
2017-02-07 10:03:57 +02:00
54d8eb9595 Store databases in the SQLite database
The databases are now also stored in the sqlite database. This allows the
`resource` member of the USERS struct to be removed in the future.
2017-02-07 10:03:57 +02:00
2b4ff82999 Use SQLite3 based authentication
The user data is now stored inside a SQLite3 database. By storing the data
inside a database, we remove the restriction that the previous hashtable
based implementation had.
2017-02-07 10:03:57 +02:00
ce5e429ad3 Move reauthentication to authenticators
Currently the only situation where a user needs to be authenticated after
the initial authentication is when a COM_CHANGE_USER is being
executed. This was previously handled by directly calling a function in
the MySQLAuth authenticator.

The new entry in the API of the authenticators is very specific to MySQL
and should be reviewed once other protocols are added.
2017-02-07 10:03:57 +02:00
c0f5124f6f Fix field name parsing in avrorouter
The backtick was copied to the field name and converted to an underscore
when the name was transformed into a valid Avro identifier. This caused
one extra character to appear in the field name in the Avro schema files.
2017-02-06 16:35:40 +02:00
c849b57fff Merge branch 'develop' into MXS-109 2017-02-06 11:25:20 +01:00
869e6ac950 Remove useless maxadmin commands
The commands did nothing.
2017-02-06 10:29:10 +02:00
9f88ee3eec Errors must not be cached
For instance, if bob is returned an error because he does not have
the required grants, then if the error were cached, alice would
receive bob's error reply even if she has the required grants.
2017-02-06 09:41:37 +02:00
a5a579ffce Rename BUILD_AVRO to BUILD_CDC
Using the broader CDC name instead of AVRO for the CMake variable name
makes more sense as there are modules other than the avrorouter.
2017-02-03 14:39:56 +02:00
2bb62a28cb MXS-109: added comments and minor improvements
Some minor improvements and freeing of info.cluster_uuid after
hashtable_add
2017-02-03 12:43:32 +01:00
6ee257dc5f Only log an error if the binlog file exists
The avrorouter logged an error every time it tried to open a file even if
the file doesn't exist.
2017-02-03 08:16:12 +02:00
f3cb0830e6 MXS-109: membership based on cluster_size
Monitored nodes could be part of different cluster UUIDs: select only
the ones belonging to UUID with more joined nodes.

In case of different UUIDs if the joined numbers is less than (n_nodes
/ 2 ) + 1 don’t consider any node part of the cluster
2017-02-02 14:53:36 +01:00
4ccfc35b00 Fix regression of MXS-1111
The function that was added to detect the commands that should always be
allowed wasn't used.
2017-02-02 13:50:44 +02:00
13997fc5b9 Fix prepared statements being rejected by dbfwfilter
The merge with 2.0 caused the dbfwfilter to reject all prepared statements
when they are supported in 2.1.
2017-02-02 13:34:57 +02:00
a2ffb0476f Fix insertstream value implicit insert detection
The pointer being at the end of the buffer was not checked.
2017-02-02 12:58:30 +02:00
3a447607a7 Move inserstream into the core
The filter is a part of 2.1 so it should be in the core.

Added a note into the documentation about the experimental status.
2017-02-01 21:08:25 +02:00
eeb3cc436e Remove wildcard domain name matching
This was buggy with the current user database implementation. Need
to think of some other way to implement this feature.
2017-02-01 19:30:42 +02:00
4ef4cb490b Cache: Use consistent naming
- snake_case
- member variables prefixed with m_
- static member variables prefixed with s_
- where prefixes are used (z,p,s), the following character
  is capitalized
2017-02-01 10:43:41 +02:00
f2da434b56 Fix merge problem with dbfwfilter
Code was duplicated in the merge and the old function names were used.
2017-02-01 09:58:38 +02:00
e64a641bcd Merge branch '2.0' into develop 2017-02-01 09:35:13 +02:00
2b950e60fd Monitor connect error is now logged
Monitor connect error is now logged
2017-01-31 15:42:05 +01:00
00f16e1fa5 Make parameters for command_is_mandatory const
The parameters can be const as they aren't modified.
2017-01-31 10:16:33 +02:00
b23649409f Add comment to GSSAPI insert string
The comment explain why the last two values have no quotes.
2017-01-30 22:41:37 +02:00