TMAegis
bind のその他のルール

BIND DNS

TMA-BIND-4.1

Use TSIG Keys 256 Bits in Length

中レベル 1自動bind

説明

The TSIG secret keys used by the name server should be generated from a good source of entropy and should be at least 256 bits in length. The audit extracts every key secret from the effective configuration and requires a base64 length of at least 44 characters (256-bit key). The audit parses the effective configuration printed by named-checkconf -p (all include files resolved) from /etc/named.conf (RHEL; chroot /var/named/chroot is detected) or /etc/bind/named.conf (Debian/Ubuntu).

チェック方法

監査方法: シェルコマンド

shell
if [ -f /var/named/chroot/etc/named.conf ]; then out=$(named-checkconf -t /var/named/chroot -p /etc/named.conf 2>/dev/null) || exit 1
else conf=/etc/named.conf; [ -f "$conf" ] || conf=/etc/bind/named.conf
  out=$(named-checkconf -p "$conf" 2>/dev/null) || exit 1; fi
flat=$(printf '%s\n' "$out" | tr '\t\n' '  ' | tr -s ' ')
opts=$(printf '%s\n' "$out" | awk '/^options[ \t]*\{/{f=1} f{print} f&&/^\};/{exit}' | tr '\t\n' '  ' | tr -s ' ')
sec=$(printf '%s\n' "$flat" | grep -Eo 'secret "[^"]*"' | sed 's/^secret "//; s/"$//')
bad=$(printf '%s\n' "$sec" | awk 'length($0) > 0 && length($0) < 44 {n++} END {print n + 0}')
[ "$bad" -eq 0 ] && echo compliant || echo "$bad TSIG secret(s) shorter than 256 bits (44 base64 characters)"
期待される出力
compliant

修正方法

修正方法: ガイダンスまたは IaC パッチ

For remediation, replace any keys which are too short with a securely generated key with a length of 256 or 512. The tsig-keygen command below can be used to generate a key. # tsig-keygen -a sha256 ns1-ns4.example.net > ns1-ns4.example.net.key # cat ns1-ns4.example.net.key key "ns1-ns4.example.net" { algorithm hmac-sha256; secret "ezoZopbE4Q73HShuFYlf3FRvLWjtNXI5fd0TeQAYOug="; }; Ensure the key file has the appropriate file permissions, and include the file in the named configuration file.

プロパティ

オペレーティングシステム
すべて
タグ
binddnstsig
参照
CIS ISC BIND DNS Server 9.11 Benchmark v1.0.0 - 4.1 Use TSIG Keys 256 Bits in Length

このホストをチェック

監査が許可されているマシンで実行してください。スキャンは読み取り専用です。

shell
tmaegis scan --target bind