TMAegisBeta
Thêm quy tắc cho mariadb

MariaDB

TMA-MARIADB-3.7

Ensure SSL Key Files Have Appropriate Permissions

CaoCấp 1Tự độngmariadb

Mô tả

When configured to use SSL/TLS, MariaDB relies on Secure Sockets Layer (SSL) key files, which are stored on the host's filesystem. These SSL key files are subject to the host's permissions and ownership structure. Every file named by an ssl_ca/ssl_cert/ssl_key/ssl_crl variable must be -r-------- mysql:mysql (directories in ssl_capath/ssl_crlpath are skipped). Runs mariadb -NBe with the client defaults: as root on the server the unix_socket plugin usually authenticates; otherwise put an administrative account in ~/.my.cnf (mode 0600), not MYSQL_PWD (see 1.4/1.6).

Cách kiểm tra

Phương pháp kiểm tra: Lệnh shell

shell
[ "$(id -u)" -eq 0 ] || exit 1; d=$(mariadb -NBe "SELECT @@global.datadir" 2>/dev/null) || exit 1; l=$(mariadb -NBe "SELECT VARIABLE_VALUE FROM information_schema.GLOBAL_VARIABLES WHERE LOWER(VARIABLE_NAME) REGEXP '^.*ssl_(ca|capath|cert|crl|crlpath|key)\$' AND VARIABLE_VALUE <> ''" 2>/dev/null) || exit 1; n=0; for f in $l; do case "$f" in /*) ;; *) f="$d/${f#./}" ;; esac; [ -f "$f" ] || continue; [ "$(stat -c '%a %U %G' "$f")" = "400 mysql mysql" ] || n=$((n+1)); done; [ "$n" -eq 0 ] && echo compliant || echo "$n noncompliant files"
Đầu ra mong đợi
compliant

Cách khắc phục

Phương pháp khắc phục: Hướng dẫn hoặc bản vá hạ tầng

chown mysql:mysql <ssl_file> && chmod 400 <ssl_file> for every ssl_ca/ssl_cert/ssl_key/ssl_crl file in use.

Thuộc tính

Hệ điều hành
Bất kỳ
Thẻ
mariadbdatabasefilesystempermissionstls
Tham chiếu
CIS MariaDB 10.11 Benchmark v1.0.0 - 3.7 Ensure SSL Key Files Have Appropriate Permissions

Kiểm tra máy này

Chạy lệnh này trên máy bạn được phép kiểm tra. Lần quét chỉ ở chế độ đọc.

shell
tmaegis scan --target mariadb