Files
attack-defense-platform/panel/audit_ssh_users.sh
T

16 lines
782 B
Bash
Raw Normal View History

#!/usr/bin/env bash
# Which SSH user does each challenge's image actually provision?
# The imported XVI/XVII challenges do NOT all use `ctfuser`: art uses `root`,
# anti-alchemy uses `ctf`. set_ssh_passwords() only does
# `echo 'ctfuser:<pw>' | chpasswd`, so for those images it either fails or sets
# a password on an account nobody logs in as -> "Permission denied" for every
# team, while state.json looks perfectly correct.
set -uo pipefail
cd /opt/gemastik18-final
printf "%-18s %s\n" CHALLENGE "Dockerfile user provisioning"
for d in services/*/; do
name=$(basename "$d")
[ -f "$d/Dockerfile" ] || continue
line=$(grep -hE 'chpasswd|useradd|adduser' "$d/Dockerfile" 2>/dev/null | head -2 | tr '\n' ';' | cut -c1-110)
printf "%-18s %s\n" "$name" "${line:-<none>}"
done