1. Introduction to the connection control (connection_control) plugin The
The base name of the connection control plugin file is 1.1 Dynamically install the connection_control pluginmysql> INSTALL PLUGIN CONNECTION_CONTROL SONAME 'connection_control.so'; Query OK, 0 rows affected (0.04 sec) mysql> INSTALL PLUGIN CONNECTION_CONTROL_FAILED_LOGIN_ATTEMPTS SONAME 'connection_control.so'; Query OK, 0 rows affected (0.01 sec) 1.2 Verify plugin statusmysql> SELECT -> PLUGIN_NAME, PLUGIN_STATUS -> FROM -> INFORMATION_SCHEMA.PLUGINS -> WHERE -> PLUGIN_NAME LIKE 'connection%'; +------------------------------------------+---------------+ | PLUGIN_NAME | PLUGIN_STATUS | +------------------------------------------+---------------+ | CONNECTION_CONTROL | ACTIVE | | CONNECTION_CONTROL_FAILED_LOGIN_ATTEMPTS | ACTIVE | +------------------------------------------+---------------+ 1.3 After the installation is complete, you can see the relevant system variablesmysql> show variables like 'connection_control%'; +-------------------------------------------------+------------+ | Variable_name | Value | +-------------------------------------------------+------------+ | connection_control_failed_connections_threshold | 3 | | connection_control_max_connection_delay | 2147483647 | | connection_control_min_connection_delay | 1000 | +-------------------------------------------------+------------+ It can be seen that the installation of the plug-in is very simple, but what specific function does this plug-in have? Let's first explain the relevant system variables:
At this point, you may understand the role of the 2. Connection Control ExperimentLet's do a specific experiment. For the sake of experimental effect, the failure threshold is set to 10 and the minimum delay time is set to 1 minute. That is, after ten consecutive connection failures, the minimum delay response time is 1 minute. Let's try it by deliberately entering the wrong password: 2.1 Initial Statemysql> show variables like 'connection_control%'; +-------------------------------------------------+------------+ | Variable_name | Value | +-------------------------------------------------+------------+ | connection_control_failed_connections_threshold | 10 | | connection_control_max_connection_delay | 2147483647 | | connection_control_min_connection_delay | 60000 | +-------------------------------------------------+------------+ 3 rows in set (0.01 sec) mysql> SELECT * FROM information_schema.CONNECTION_CONTROL_FAILED_LOGIN_ATTEMPTS; Empty set (0.00 sec) 2.2 Deliberately entering the wrong password[root@localhost ~]# mysql -utestuser -p123 mysql: [Warning] Using a password on the command line interface can be insecure. ERROR 1045 (28000): Access denied for user 'testuser'@'localhost' (using password: YES) 2.3 View failure recordsmysql> SELECT * FROM information_schema.CONNECTION_CONTROL_FAILED_LOGIN_ATTEMPTS; +----------------+-----------------+ | USERHOST | FAILED_ATTEMPTS | +----------------+-----------------+ | 'testuser'@'%' | 1 | +----------------+-----------------+ 1 row in set (0.00 sec) # When the number of consecutive failures exceeds the threshold, there will be a delay when connecting again, that is, it will take a certain period of time to return whether the password is correct.mysql> SELECT * FROM information_schema.CONNECTION_CONTROL_FAILED_LOGIN_ATTEMPTS; +----------------+-----------------+ | USERHOST | FAILED_ATTEMPTS | +----------------+-----------------+ | 'testuser'@'%' | 10 | +----------------+-----------------+ mysql> show processlist; +---------+----------+--------------------+--------------------+---------+-------+--------------------------------------+------------------+ | Id | User | Host | db | Command | Time | State | Info | +---------+----------+--------------------+--------------------+---------+-------+--------------------------------------+------------------+ | 1817003 | root | localhost | NULL | Query | 0 | starting | show processlist | | 1817091 | testuser | localhost | NULL | Connect | 16 | Waiting in connection_control plugin | NULL | +---------+----------+--------------------+--------------------+---------+-------+--------------------------------------+------------------+ Under normal circumstances, if you enter the wrong password, an error message will be returned immediately. When the number of consecutive failures reaches the threshold, the next connection attempt will be delayed. The specific manifestation is that it will be stuck and the error message will not be returned until the delay is over. The tables in the Therefore, you should understand why this plug-in can prevent client-side brute force cracking. Assuming that brute force cracking attempts 120 times per minute, after enabling this plug-in, the response will be delayed after a certain number of consecutive failures, and the delay time will increase with the increase in the number of failures. The next cracking can be started immediately before, but now the next attempt can only be initiated after the delay time, so the risk of brute force cracking can be greatly reduced. However, after enabling the connection control plug-in, you should pay attention to whether there are delayed connections, because delayed connections also occupy the number of connections, which may cause connection backlogs and lead to insufficient connections. Therefore, when a delayed connection occurs, you should quickly check where the connection is going and ensure that the password is entered correctly. To enable this plugin, be sure to configure the appropriate threshold and delay time, and remember to write these parameters to the configuration file. Generally, there may be this requirement in the security assessment, and the connection control plug-in will be useful at this time. This is the end of this article about the You may also be interested in:
|
<<: RGBA alpha transparency conversion calculation table
>>: Commonly used HTML meta tag attributes (needed for website compatibility and optimization)
When implementing this function, the method I bor...
Table of contents 1. Install Node Exporter 2. Ins...
Install PostgreSQL 11 on CentOS 7 PostgreSQL: The...
How to recursively select all child elements usin...
Summarize This article ends here. I hope it can b...
In Nginx, there are some advanced scenarios where...
Table of contents Vite project build optimization...
Table of contents 1. Overview 2. Routing Navigati...
This article uses examples to illustrate the use ...
Preface This control will have a watermark at the...
Table of contents 1. Signal List 1.1. Real-time s...
1. Download the RPM package corresponding to Linu...
Table of contents 1. Introduction to grub.cfg fil...
1 Introduction Kong is not a simple product. The ...
Log in docker login Complete the registration and...