TMAegis
websphere のその他のルール

TMA-WEBSPHERE-10.2

Ensure Passwords are Encrypted

高レベル 1自動websphere

説明

Sensitive information is stored in the Liberty configuration and can be in clear text unless encrypted or hashed. Audit: reads server.xml, configDropins/defaults/*.xml, configDropins/overrides/*.xml and files pulled in with <include> for every Liberty server found under WLP_USER_DIR, /opt/ibm/wlp/usr, /opt/IBM/WebSphere/Liberty/usr, /opt/ol/wlp/usr, /usr/local/wlp/usr or /config; it ignores XML comments and fails if no server.xml is readable. Fails when any attribute whose name ends in Password or Secret holds a value that is not {aes} or {hash} encoded (plain text and {xor} are rejected; ${variable} references are accepted). Whether wlp.password.encryption.key is customised must be checked manually.

チェック方法

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

shell
bad=0; n=0; nl='
'
r=""
for b in "${WLP_USER_DIR:-}" /opt/ibm/wlp/usr /opt/IBM/WebSphere/Liberty/usr /opt/ol/wlp/usr /usr/local/wlp/usr; do
  [ -n "$b" ] && [ -d "$b/servers" ] || continue
  for s in "$b"/servers/*/; do [ -f "${s}server.xml" ] && r="$r$s$nl"; done
done
[ -f /config/server.xml ] && r="$r/config/$nl"
strip(){ awk 'BEGIN{RS="<!--"} NR==1{printf "%s",$0; next} {i=index($0,"-->"); if(i) printf "%s",substr($0,i+3)}'; }
gather(){ s=$1; { cat "${s}server.xml" "${s}"configDropins/defaults/*.xml "${s}"configDropins/overrides/*.xml; } 2>/dev/null | strip
  for loc in $(cat "${s}server.xml" "${s}"configDropins/defaults/*.xml "${s}"configDropins/overrides/*.xml 2>/dev/null | strip | tr '\r\n\t' '   ' | grep -oE '<include[[:space:]][^>]*>' | sed -n 's/.*location[[:space:]]*=[[:space:]]*"\([^"]*\)".*/\1/p'); do
    case $loc in http*) continue;; esac; loc=$(printf '%s' "$loc" | sed "s#\${server.config.dir}/*##"); case $loc in /*) f=$loc;; *) f=$s$loc;; esac
    [ -f "$f" ] && strip < "$f"; done; }
tag(){ printf '%s\n' "$X" | grep -oE "<$1([[:space:]][^>]*)?>"; }
chk(){ t=$(tag "$1"); if [ -z "$t" ]; then [ "$5" = na ] && return 0; [ "$4" = y ] && return 0; return 1; fi
  tot=$(printf '%s\n' "$t" | grep -c ''); v=$(printf '%s\n' "$t" | sed -n "s/.*[[:space:]]$2[[:space:]]*=[[:space:]]*[\"']\([^\"']*\)[\"'].*/\1/p"); st=0
  [ -n "$v" ] && st=$(printf '%s\n' "$v" | grep -c ''); case " config httpSession webAppSecurity jwtSso webContainer httpDispatcher applicationMonitor sslDefault httpOptions ltpa mpMetrics samesite transportLayer authenticationLayer attributeLayer " in *" $1 "*) [ "$st" -gt 0 ] && tot=$st;; esac; ok=$3; neg=n; case $ok in '!'*) neg=y; ok=${ok#!};; esac
  if [ "$st" -gt 0 ]; then m=$(printf '%s\n' "$v" | grep -ciE "^($ok)\$"); if [ "$neg" = n ]; then [ "$m" -eq "$st" ] || return 1; else [ "$m" -eq 0 ] || return 1; fi; fi
  [ "$st" -lt "$tot" ] && [ "$4" != y ] && return 1; return 0; }
IFS="$nl"; for s in $r; do n=$((n+1)); X=$(gather "$s" | tr '\r\n\t' '   ' | tr -s ' ')
printf "%s\n" "$X" | grep -oE "[[:space:]]([A-Za-z]*(Password|Secret)|password|secret)[[:space:]]*=[[:space:]]*\"[^\"]*\"" | sed "s/^[^=]*=[[:space:]]*\"//; s/\"\$//" | grep -vE "^(\{aes\}|\{hash\}|\\$\{)" | grep -q . && bad=1
done; unset IFS; [ "$n" -gt 0 ] || exit 1; [ "$bad" -eq 0 ] && echo compliant || echo noncompliant
期待される出力
compliant

修正方法

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

Use the Liberty provided securityUtility tool to encrypt the password. To encrypt a password with Advanced Encryption Standard (AES) encryption: securityUtility encode --encoding=aes --key=myKey passW0rd returns: {aes}AE/PrLc9wshAKURioFvxb41SrVbsWjZTZ8lv72ioH3yMlJN4RQj3A9aT3ev396oYRw== Replace the clear text password in the Liberty configuration with the encrypted password created by the securityUtility tool. In this example, the encrypted password {aes}AE/PrLc9wshAKURioFvxb41SrVbsWjZTZ8lv72ioH3yMlJN4RQj3A9aT3ev396oYRw== was returned by the securityUtility and used to update the bindPassword attribute in the ldapRegistry element. <ldapRegistry ... ...

プロパティ

オペレーティングシステム
すべて
タグ
webspheresecretspasswords
参照
CIS IBM WebSphere Liberty Benchmark v1.0.0 - 10.2 Ensure Passwords are Encrypted

このホストをチェック

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

shell
tmaegis scan --target websphere