TMAegis
Weitere Regeln für mysql

TMA-MYSQL-1.3

Disable MySQL Command History

NiedrigStufe 2Automatisiertmysql

Beschreibung

On Linux/UNIX, the MySQL client and MySQL Shell log statements executed interactively to a history file. The default MySQL Client file is named .mysql_history in the user's home directory. The files are split by language and named history.sql, history.js and history.py. Most interactive commands run in the MySQL client application are saved to a history file. Run as root; counts client history files under /home and /root that are not symlinks to /dev/null.

So wird geprüft

Prüfmethode: Shell-Befehl

shell
[ "$(id -u)" -eq 0 ] || exit 1; l=$(find /home /root -maxdepth 4 \( -name .mysql_history -o -path '*/.mysqlsh/history*' \) 2>/dev/null); n=0; for x in $l; do [ "$(readlink "$x")" = /dev/null ] || n=$((n+1)); done; echo "$n"
Erwartete Ausgabe
0

So wird behoben

Behebungsmethode: Anleitung oder Infrastruktur-Patch

For each user remove the history file and prevent re-creation: rm -f ~<user>/.mysql_history && ln -s /dev/null ~<user>/.mysql_history, or export MYSQL_HISTFILE=/dev/null in the shell startup script; for MySQL Shell remove ~/.mysqlsh/history.* and run \option --persist history.autoSave=0.

Eigenschaften

Betriebssysteme
Beliebig
Tags
mysqldatabasecredentialshistory
Referenz
CIS Oracle MySQL Community Server 8.4 Benchmark v1.1.0 - 1.3 Disable MySQL Command History

Diesen Host prüfen

Führen Sie dies auf einem Rechner aus, den Sie prüfen dürfen. Der Scan ist schreibgeschützt.

shell
tmaegis scan --target mysql --level 2