Persist the Kali setup in its base image

New 'kali snapshot' subcommand commits the working overlay into the base
image, the same way the Windows guests are frozen. After it, reset returns
to a Kali that already has: the wordlist under /opt/norbourg, bloodyAD,
sshd enabled at boot, and the dual resolver (DC first, slirp second).

Verified by booting from the committed base with no manual step: sshd
answers, 1716-line wordlist present, bloodyad on PATH, lab and public names
both resolving.

Docs: README and instructor checklist describe the new step.
This commit is contained in:
2026-10-23 07:14:19 -04:00
parent 6fb5c3b4ca
commit b13ec8da95
3 changed files with 30 additions and 3 deletions
+4 -2
View File
@@ -91,7 +91,8 @@ Impacket, `evil-winrm`, `hashcat` et `bloodhound-python` ; `bloodyAD` s'ajoute a
```bash
./lab.sh kali install # télécharge ~4 Go, extrait, prépare une couche jetable
./lab.sh kali up # démarre (VNC 127.0.0.1:5909, SSH 127.0.0.1:2222)
./lab.sh kali reset # repart de l'image propre
./lab.sh kali snapshot # fige l'état courant (outils, liste de mots, DNS) dans la base
./lab.sh kali reset # repart de la base figée
./lab.sh kali down
```
@@ -100,7 +101,8 @@ Identifiants par défaut : `kali` / `kali`. La VM a deux cartes : le pont du lab
passage vers le réseau du bureau.
Un petit ISO « outils » est monté dans la VM : il contient `norbourg.txt`, la liste de mots de
l'atelier. À récupérer une fois au premier démarrage :
l'atelier. À récupérer une fois au premier démarrage, puis à figer avec `./lab.sh kali snapshot`
pour que `reset` la conserve :
```bash
sudo mkdir -p /opt/norbourg/wordlists
+23 -1
View File
@@ -62,8 +62,9 @@ cmd_kali() {
up) _kali_up ;;
down) _kali_down ;;
reset) _kali_reset ;;
snapshot) _kali_snapshot ;;
status) _kali_status ;;
*) info "usage: ./lab.sh kali install|up|down|reset|status"; return 2 ;;
*) info "usage: ./lab.sh kali install|up|down|reset|snapshot|status"; return 2 ;;
esac
}
@@ -177,6 +178,27 @@ _kali_down() {
ok "Kali stopped"
}
# Fold the current overlay into the base image: wordlist, DNS, packages and
# any tooling you installed survive a reset from then on.
_kali_snapshot() {
local overlay
_kali_installed || die "Kali is not installed"
overlay=$(_kali_disk)
_kali_down >/dev/null 2>&1 || true
if [[ ! -f $overlay ]]; then
ok "nothing to commit — no working overlay"
return 0
fi
step "commit the overlay into ${KALI_NAME:-kali}'s base image"
qemu-img commit -q "$overlay" || die "qemu-img commit failed"
rm -f "$overlay"
_kali_ensure_overlay
ok "baseline updated: ./lab.sh kali reset now returns to this state"
}
_kali_reset() {
local overlay
_kali_installed || die "Kali is not installed"
+3
View File
@@ -62,6 +62,9 @@ site et le partage `Public`, `ws01` est joint au domaine avec `user.txt` en plac
sudo mount /dev/sr0 /mnt && sudo cp /mnt/norbourg.txt /opt/norbourg/wordlists/
```
Puis figez l'état : `cd platforms/qemu && ./lab.sh kali snapshot`. Sans cela, `kali reset`
ramène l'image d'origine et la liste de mots disparaît.
4. **Outils dans Kali** : l'image officielle contient déjà `nxc`, Impacket, `evil-winrm`,
`hashcat` et `bloodhound-python`. L'interface BloodHound n'y est pas et n'est pas nécessaire.
S'il manque `bloodyAD` : `sudo apt install bloodyad` (nécessite Internet, donc avant de