Close the gaps that a fresh redeploy would have shipped
- install the QEMU guest agent from virtio-win: Proxmox provisions over qm guest exec, so without it every provision would hang waiting for the agent. virtio-win is now attached as ide3 on the Proxmox platform. - restore the .url MIME mapping in fs01.ps1: the earlier patch silently missed, so a rebuilt FS01 would answer 404.3 for the easter-egg shortcut. - kali install now builds a small tool ISO carrying the wordlist, so a fresh Kali is usable without network access to the host. Audited by extracting the bundle and re-rendering the seeds: no unrendered tokens, and every live fix is present in the generated role scripts.
This commit is contained in:
@@ -12,6 +12,38 @@ _kali_pid() { printf '%s/run/kali.pid' "$LAB_ROOT"; }
|
||||
_kali_log() { printf '%s/run/kali.log' "$LAB_ROOT"; }
|
||||
|
||||
_kali_installed() { [[ -f $(_kali_base) ]]; }
|
||||
_kali_tools_iso() { printf '%s/seeds/kali-tools.iso' "$LAB_ROOT"; }
|
||||
|
||||
# The stock Kali image ships without the lab wordlist. A small ISO carries it
|
||||
# into the guest, so a fresh redeploy is reproducible without network access.
|
||||
_kali_build_tools() {
|
||||
local iso dir
|
||||
iso=$(_kali_tools_iso)
|
||||
dir=$(mktemp -d)
|
||||
|
||||
mkdir -p "$(dirname "$iso")"
|
||||
cp "$CONTENT_DIR/scripts/wordlists/norbourg.txt" "$dir/"
|
||||
cat > "$dir/README.txt" <<'EOF'
|
||||
Outils de l'atelier Norbourg
|
||||
============================
|
||||
|
||||
norbourg.txt : liste de mots ciblee (1716 entrees), dimensionnee pour que le
|
||||
cassage prenne quelques secondes.
|
||||
|
||||
Installation dans Kali :
|
||||
|
||||
sudo mkdir -p /opt/norbourg/wordlists
|
||||
sudo cp /media/cdrom/norbourg.txt /opt/norbourg/wordlists/
|
||||
sudo chmod 644 /opt/norbourg/wordlists/norbourg.txt
|
||||
EOF
|
||||
if have_cmd genisoimage; then
|
||||
genisoimage -quiet -volid NORBOURG_TOOLS -J -R -o "$iso" "$dir"
|
||||
else
|
||||
xorriso -as mkisofs -quiet -V NORBOURG_TOOLS -J -R -o "$iso" "$dir"
|
||||
fi
|
||||
rm -rf "$dir"
|
||||
ok "tool ISO: $iso"
|
||||
}
|
||||
|
||||
_kali_ensure_overlay() {
|
||||
local base overlay
|
||||
@@ -70,6 +102,7 @@ _kali_install() {
|
||||
fi
|
||||
ok "base image: $(du -h "$base" | cut -f1) (${KALI_DISK_GB:-40}G nominal)"
|
||||
_kali_ensure_overlay
|
||||
_kali_build_tools
|
||||
|
||||
printf '\n'
|
||||
ok "Kali installed — ./lab.sh kali up"
|
||||
@@ -91,9 +124,15 @@ _kali_up() {
|
||||
vnc=${KALI_VNC_DISPLAY:-9}
|
||||
|
||||
mkdir -p "$LAB_ROOT/run"
|
||||
[[ -f $(_kali_tools_iso) ]] || _kali_build_tools
|
||||
|
||||
# net0: the lab bridge (DHCP from DC01). net1: user networking so apt works
|
||||
# without punching a hole through the lab isolation policy.
|
||||
local cd_args=()
|
||||
if [[ -f $(_kali_tools_iso) ]]; then
|
||||
cd_args=( -drive "if=none,id=cd1,media=cdrom,file=$(_kali_tools_iso)" -device "ide-cd,drive=cd1,bus=ide.1" )
|
||||
fi
|
||||
|
||||
nohup qemu-system-x86_64 \
|
||||
-name norbourg-kali \
|
||||
-machine q35,accel=kvm -cpu host \
|
||||
@@ -107,6 +146,7 @@ _kali_up() {
|
||||
-netdev "user,id=net1,hostfwd=tcp:127.0.0.1:${KALI_SSH_PORT:-2222}-:22" \
|
||||
-device "e1000,netdev=net1" \
|
||||
-monitor "unix:$LAB_ROOT/run/kali.monitor,server,nowait" \
|
||||
"${cd_args[@]}" \
|
||||
-display none -vnc "127.0.0.1:$vnc" \
|
||||
>>"$(_kali_log)" 2>&1 &
|
||||
printf '%s\n' "$!" > "$(_kali_pid)"
|
||||
@@ -115,6 +155,7 @@ _kali_up() {
|
||||
if kill -0 "$(<"$(_kali_pid)")" 2>/dev/null; then
|
||||
ok "Kali started · vnc 127.0.0.1:$(( 5900 + vnc )) · ssh 127.0.0.1:${KALI_SSH_PORT:-2222}"
|
||||
info " login kali/kali · bridge address via DHCP (${KALI_IP:-10.10.10.101} reserved)"
|
||||
info " wordlist on the tool CD: mount /dev/sr0 /mnt && cp /mnt/norbourg.txt /opt/norbourg/wordlists/"
|
||||
else
|
||||
fail "Kali failed to start — see $(_kali_log)"
|
||||
return 1
|
||||
|
||||
Reference in New Issue
Block a user