MariaDB : SSL/TLS सेटिंग2024/11/11 |
MariaDB पर SSL/TLS सेटिंग कॉन्फ़िगर करें।
|
|
[1] |
SSL/TLS प्रमाणपत्र प्राप्त करें या स्वयं हस्ताक्षरित प्रमाणपत्र बनाएं।
इस उदाहरण में यह स्व-हस्ताक्षरित प्रमाणपत्र का उपयोग करता है। |
[2] | SSL/TLS के लिए MariaDB कॉन्फ़िगर करें। |
# प्रतिलिपि प्रमाणपत्र प्राप्त हुए [1] [root@www ~]# mkdir /var/lib/mysql/pki [root@www ~]# cp /etc/pki/tls/certs/{server.crt,server.key} /var/lib/mysql/pki/
[root@www ~]#
chown -R mysql:mysql /var/lib/mysql/pki
[root@www ~]#
vi /etc/my.cnf.d/mariadb-server.cnf # [mysqld] अनुभाग के अंतर्गत जोड़ें [mysqld]
ssl-cert=/var/lib/mysql/pki/server.crt
ssl-key=/var/lib/mysql/pki/server.key
[root@www ~]#
systemctl restart mariadb
# सेटिंग्स सत्यापित करें [root@www ~]# mysql Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 3 Server version: 10.11.9-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. # यदि स्थिति इस प्रकार है तो ठीक है MariaDB [(none)]> show variables like '%ssl%'; +---------------------+-------------------------------+ | Variable_name | Value | +---------------------+-------------------------------+ | have_openssl | YES | | have_ssl | YES | | ssl_ca | | | ssl_capath | | | ssl_cert | /var/lib/mysql/pki/server.crt | | ssl_cipher | | | ssl_crl | | | ssl_crlpath | | | ssl_key | /var/lib/mysql/pki/server.key | | version_ssl_library | OpenSSL 3.2.2 4 Jun 2024 | +---------------------+-------------------------------+ 10 rows in set (0.001 sec) |
[3] | ग्राहकों से SSL/TLS से जुड़ने के लिए, निर्दिष्ट [ssl] विकल्प से जुड़ें। |
[root@www ~]# mysql --ssl Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 4 Server version: 10.11.9-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. # स्थिति दिखाओ MariaDB [(none)]> show status like 'ssl_cipher'; +---------------+------------------------+ | Variable_name | Value | +---------------+------------------------+ | Ssl_cipher | TLS_AES_256_GCM_SHA384 | +---------------+------------------------+ 1 row in set (0.000 sec) MariaDB [(none)]> exit Bye # बिना SSL/TLS कनेक्शन के [root@www ~]# mysql --skip-ssl Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 5 Server version: 10.11.9-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. # मान खाली है MariaDB [(none)]> show status like 'ssl_cipher'; +---------------+-------+ | Variable_name | Value | +---------------+-------+ | Ssl_cipher | | +---------------+-------+ 1 row in set (0.000 sec) |
[4] | उपयोगकर्ताओं को SSL/TLS से जुड़ने के लिए बाध्य करने के लिए, निम्नानुसार सेट करें। |
[root@www ~]# mysql Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 6 Server version: 10.11.9-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. # एक उपयोगकर्ता बनाएं जिसके लिए SSL/TLS आवश्यक हो MariaDB [(none)]> create user redhat identified by 'password' require ssl; Query OK, 0 rows affected (0.00 sec) # SSL/TLS आवश्यक उपयोगकर्ता सेट हैं [ssl_type] = [ANY] MariaDB [(none)]> select user,host,ssl_type from mysql.user; +-------------+-----------+----------+ | User | Host | ssl_type | +-------------+-----------+----------+ | mariadb.sys | localhost | | | root | localhost | | | mysql | localhost | | | fedora | % | | | redhat | % | ANY | +-------------+-----------+----------+ 5 rows in set (0.001 sec) # मौजूदा उपयोगकर्ता के लिए आवश्यक SSL/TLS सेट करें MariaDB [(none)]> grant usage on *.* to 'fedora'@'%' require ssl; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> select user,host,ssl_type from mysql.user; +-------------+-----------+----------+ | User | Host | ssl_type | +-------------+-----------+----------+ | mariadb.sys | localhost | | | root | localhost | | | mysql | localhost | | | fedora | % | ANY | | redhat | % | ANY | +-------------+-----------+----------+ 5 rows in set (0.001 sec) |
Sponsored Link |
|