Automation Scripts¶
Two script suites, a shared lib, and pre-fillable state.
Structure¶
lib/
common.bash # Logging, prompting, state load/save, SSH config writer
state.env # All variables with defaults -- pre-fill or let scripts ask
ssh_ready/ # You already have SSH working; need Windows networking
01-tryout.ps1 # Mirrored networking + firewall (brother pastes in admin PS)
02-permanent.ps1 # Task Scheduler + auto-login (brother pastes after test)
local.bash # SSH config + connection test + optional remote hardening
remote.bash # DNS fix, systemd, wsl.conf, sshd hardening (piped via SSH)
full_setup/ # From-scratch: bare WSL2, nothing configured
windows.ps1 # All-in-one Windows orchestrator (calls wsl.bash)
wsl.bash # Inside WSL2: sshd, keypair, authorized_keys, DNS, sudo
local.bash # Home machine: import key, SSH config, test
Shared State (lib/state.env)¶
Pre-fill to skip prompts. Scripts save back after interactive input.
TS_NODE="desktop-au8c428" # Tailscale node name
TS_IP="" # Auto-resolved from TS_NODE
SSH_KEY_PATH="~/.ssh/id_rsa_tower"
SSH_HOST_ALIAS="wsl-dev"
WSL_USER="admin"
WSL_DISTRO="Ubuntu"
WIN_USER=""
SSH_PORT="22"
Idempotency¶
All scripts safe to re-run. Firewall rules removed before re-add, scheduled tasks unregistered before re-register, config files overwritten, keys skipped if they exist, authorized_keys deduped.