# 查出目前封鎖清單
fail2ban-client status
# 查目前封鎖項目裡的IP
fail2ban-client status sshd
# 解除項目中的IP
fail2ban-client set sshd 192.168.1.120
# 查出目前封鎖清單
fail2ban-client status
# 查目前封鎖項目裡的IP
fail2ban-client status sshd
# 解除項目中的IP
fail2ban-client set sshd 192.168.1.120
1. make keys file
# sudo su
# mkdir -p /etc/mysql/encryption
# cd /etc/mysql/encryption
# echo "1;"$(openssl rand -hex 32) > keys
# echo "2;"$(openssl rand -hex 32) >> keys
# echo "3;"$(openssl rand -hex 32) >> keys
# echo "4;"$(openssl rand -hex 32) >> keys
2. make password file
# openssl rand -hex 128 > password_file
3. make key enc
# openssl enc -aes-256-cbc -md sha1 -pass file:password_file -in keys -out keys.enc
create config file
# sudo vim /etc/mysql/mariadb.conf.d/encryption.cnf
Pass content
[mariadb]
## File Key Management
plugin_load_add = file_key_management
file_key_management_filename = /etc/mysql/encryption/keys.enc
file_key_management_filekey = FILE:/etc/mysql/encryption/password_file
file_key_management_encryption_algorithm = aes_cbc
## InnoDB/XtraDB Encryption Setup
innodb_default_encryption_key_id = 1
innodb_encrypt_tables = FORCE ( or ON )
innodb_encrypt_log = ON
innodb_encryption_threads = 4
## Aria Encryption Setup
aria_encrypt_tables = ON
## Temp & Log Encryption
encrypt-tmp-disk-tables = 1
encrypt-tmp-files = 1
encrypt_binlog = ON
Change Permissions
# cd /etc/mysql/
# sudo chown -R mysql:root ./encryption
# sudo chmod 500 /etc/mysql/encryption/
# cd ./encryption
# chmod 400 keys.enc password_file
# chmod 644 /etc/mysql/mariadb.conf.d/encryption.cnf
Restart MariaDB
# sudo service mariadb restart
Check Result
https://webdock.io/en/docs/how-guides/security-guides/how-to-enable-encryption-mariadb
Get the private .key from the .pfx certificate
openssl pkcs12 -in my_certificate.pfx -nocerts -out my_certificate-encrypted.key
Get the decrypted .key file from the encrypted private .key file
openssl rsa -in my_certificate-encrypted.key -out my_certificate.key
Get the .crt file from the .pfx file
openssl pkcs12 -in my_certificate.pfx -clcerts -nokeys -out my_certificate.crt
REF:
https://blog.christian-schou.dk/convert-pfx-to-crt-and-key-file-with-openssl/
Changed limits: max_open_files: 1024 max_connections: 214 table_cache: 400
open_files_limit=12000 max_connections=10000
mysql soft nofile 4096 mysql hard nofile 10240
mkdir -p /etc/systemd/system/mariadb.service.d vi /etc/systemd/system/mariadb.service.d/limits.conf
[Service] LimitNOFILE=infinity
systemctl daemon-reload
systemctl restart mariadb
mysql MariaDB [(none)]> select @@max_connections; +-------------------+ | @@max_connections | +-------------------+ | 10000 | +-------------------+ MariaDB [(none)]> SHOW VARIABLES LIKE 'open%'; +------------------+-------+ | Variable_name | Value | +------------------+-------+ | open_files_limit | 65536 | +------------------+-------+