TMAegis
More rules for tdsql

TMA-TDSQL-1.3

Ensure Interactive Login Is Disabled for TDSQL Service Accounts

MediumLevel 1Automatedtdsql

Description

The operating system accounts running TDSQL services should have interactive login disabled (shell set to /sbin/nologin or /bin/false). Passes when the tdsql account (and mysql, if present) has /sbin/nologin or /bin/false as its shell; FAILs when no tdsql account exists.

How it is checked

Audit method: Shell command

shell
u=$(getent passwd tdsql) || exit 1; bad=0; for a in tdsql mysql; do s=$(getent passwd "$a" | cut -d: -f7) || continue; case "$s" in /sbin/nologin|/usr/sbin/nologin|/bin/false|/usr/bin/false) ;; *) bad=1;; esac; done; [ $bad -eq 0 ] && echo compliant || echo 'interactive shell'
Expected output
compliant

How it is fixed

Fix method: Guidance or infrastructure patch

usermod -s /sbin/nologin tdsql; usermod -s /sbin/nologin mysql

Properties

Operating systems
Any
Tags
tdsqlservice-account
Reference
CIS Tencent TDSQL 10.3.22 Benchmark v1.0.0 - 1.3 Ensure Interactive Login Is Disabled for TDSQL Service Accounts

Check this host

Run this on a machine you are allowed to audit. The scan is read-only.

shell
tmaegis scan --target tdsql