Repository navigation
feat: unattended config support and Docker UFW hardening - #127
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved critical defects risk SSH lockout, allow Docker traffic to bypass UFW protections, and enable spoofed packets to trigger bans against innocent users.
7 open issues
Reject root as the configured administrator · New Validate SSH permissions before disabling fallback authentication · New Use a distinct prefix for the 2FA SSH backup · New Do not ban IPs based only on spoofable SYN packets · New Block Docker forwarding by bridge interface, not private subnet · New Make the dtop installer accessible to the target user · New Run input validation before mutating dependency and system checks · New
What changed in this PR
Adds unattended provisioning to the Debian/Ubuntu hardening script and optional Docker firewall protection, alongside SSH safety and runtime reliability improvements.
Changes:
- Adds safe
DU_*configuration parsing, quiet-mode defaults, validation, and an example configuration. - Adds Docker
DOCKER-USERrules and updates SSH, 2FA, intrusion prevention, and credential handling. - Updates usage and recovery documentation, release metadata, and script checksums.
| File | Description |
|---|---|
| README.md | Documents unattended setup, Docker protection, and revised SSH recovery steps. |
| du_setup.sh.sha256 | Updates the published script checksum. |
| du_setup.sh | Implements configuration-driven provisioning, firewall hardening, and reliability fixes. |
| du_setup.env.example | Provides documented configuration options for unattended runs. |
Review effort: Balanced
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved Docker firewall flaws can expose published ports without UFW allowances through unsafe bridge rules or skipped hardening when the image pull fails.
9 open issues
Keep firewall rules synchronized with Docker bridge changes · New Restrict Docker bridge exemptions to verified interfaces · New Apply Docker firewall hardening before the smoke test · New Avoid printing secrets in configuration errors · New Accept authorized_keys entries with valid options · New Use the account’s actual primary group for SSH ownership · New Match Docker route allowances against container destination ports · New Run optional dtop setup when Docker is already installed · New Restore the UFW allowance when reverting the SSH port · New
7 resolved since last review
Block Docker forwarding by bridge interface, not private subnet Do not ban IPs based only on spoofable SYN packets Use a distinct prefix for the 2FA SSH backup Validate SSH permissions before disabling fallback authentication Reject root as the configured administrator Run input validation before mutating dependency and system checks Make the dtop installer accessible to the target user
Review effort: Balanced
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved critical SSH key installation flaws permit privileged file modification through user-controlled symlinks and can lock administrators out when other login methods are disabled.
5 open issues
9 resolved since last review
Apply Docker firewall hardening before the smoke test Restrict Docker bridge exemptions to verified interfaces Keep firewall rules synchronized with Docker bridge changes Run optional dtop setup when Docker is already installed Match Docker route allowances against container destination ports Use the account’s actual primary group for SSH ownership Accept authorized_keys entries with valid options Avoid printing secrets in configuration errors Restore the UFW allowance when reverting the SSH port
Review effort: Balanced
There was a problem hiding this comment.
🟡 Changes recommended
Critical SSH pre-flight gaps accept unusable keys and non-login accounts and miss client-specific restrictions, allowing quiet mode to disable existing access without ensuring a working administrator login.
6 open issues
Validate values for supported SSH key options · New Reject RSA keys with missing or malformed wire fields · New Validate SSH access using the intended client connection context · New Reject non-login shells during SSH pre-flight · New Preserve recovery sources outside the cleanup directory · New Apply Tailscale flags to already-connected nodes · New
5 resolved since last review
Review effort: Balanced
| local opts="$1" | ||
| [[ -n "$opts" ]] || return 1 | ||
| local flag_re='^(restrict|cert-authority|no-touch-required|verify-required|(no-)?(port-forwarding|agent-forwarding|x11-forwarding|pty|user-rc))(,(.*))?$' | ||
| local val_re='^(command|principals|from|expiry-time|environment|permitopen|permitlisten|tunnel)="(([^"\\]|\\.)*)"(,(.*))?$' |
| # Enforce >= 1024-bit RSA modulus minimum matching sshd | ||
| (( blob_len >= 143 )) || rc=1 |
|
|
||
| local host_val sshd_dump | ||
| host_val=$(hostname 2>/dev/null || printf 'localhost') | ||
| if ! sshd_dump=$("$sshd_bin" -T -C "user=${username},host=${host_val},addr=127.0.0.1" 2>/dev/null); then |
| print_error "Quiet mode aborted: User '$DU_USERNAME' already exists and DU_USE_EXISTING_USER is false." | ||
| exit 1 | ||
| fi | ||
| existing_home=$(getent passwd "$DU_USERNAME" | cut -d: -f6) |
| print_info "Skipping custom .bashrc configuration." | ||
| log "Skipped custom .bashrc for $USERNAME." | ||
| return 0 | ||
| fi | ||
|
|
||
| print_info "Preparing custom .bashrc for '$USERNAME'..." | ||
|
|
||
| temp_source_bashrc=$(mktemp "/tmp/custom_bashrc_source.XXXXXX") | ||
| temp_source_bashrc=$(mktemp "${RUN_TMP_DIR:-/tmp}/custom_bashrc_source.XXXXXX") |
| if [[ -n "${DU_TAILSCALE_FLAGS:-}" ]]; then | ||
| local -a raw_ts_flags=() | ||
| local flag | ||
| read -ra raw_ts_flags <<< "${DU_TAILSCALE_FLAGS}" |



No description provided.