MySQL
TMA-MYSQL-6.2
Ensure Log Files are Stored on a Non-System Partition
Mô tả
MySQL log files can be set in the MySQL configuration to exist anywhere on the filesystem. It is common practice to ensure that the system filesystem is left uncluttered by application logs. System filesystems include the root (/), /var, or /usr. Fails when log_bin_basename is under /var or /usr or on the root filesystem; passes when binary logging is off. Run on the database host. Runs mysql -NBe with the client defaults: put an administrative account in ~/.my.cnf (mode 0600) or a mysql_config_editor login path, not MYSQL_PWD (see 1.4/1.6).
Cách kiểm tra
Phương pháp kiểm tra: Lệnh shell
d=$(mysql -NBe "SELECT @@global.datadir" 2>/dev/null) || exit 1; b=$(mysql -NBe "SELECT IFNULL(@@global.log_bin_basename, '')" 2>/dev/null) || exit 1; [ -n "$b" ] || { echo compliant; exit 0; }; case "$b" in /*) ;; *) b="$d/${b#./}" ;; esac; case "$b" in /var/*|/usr/*) echo "under /var or /usr: $b"; exit 0 ;; esac; m=$(df -P "$(dirname "$b")" 2>/dev/null | awk 'NR==2{print $6}'); [ -n "$m" ] || exit 1; [ "$m" = / ] && echo "on the root filesystem: $b" || echo compliant- Đầ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
Set log_bin=<path on a dedicated, non-system partition> under [mysqld] in /etc/my.cnf (or /etc/mysql/mysql.conf.d/mysqld.cnf), then restart MySQL.
Thuộc tính
- Hệ điều hành
- Bất kỳ
- Thẻ
- mysqldatabaseloggingfilesystem
- Tham chiếu
- CIS Oracle MySQL Community Server 8.4 Benchmark v1.1.0 - 6.2 Ensure Log Files are Stored on a Non-System Partition
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.
tmaegis scan --target mysql