diff --git a/README.md b/README.md index 971491e..bf5c5ba 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ fournisseur), et une image se reconstruit à la demande plutôt que de se télé | Image | Source | Personnalisation | |-------|--------|------------------| -| `rocky10` | Rocky Linux 10.2 GenericCloud Base `20260525.0` (SHA-256 signée par Rocky) | exigences two + `docs/deploiement/image-qcow2.rst` (sshd, utilisateur `syonad`, SELinux désactivé…) | +| `rocky10` | Rocky Linux 10.2 GenericCloud Base `20260525.0` (SHA-256 signée par Rocky) | exigences two + `docs/deploiement/image-qcow2.rst` (sshd, utilisateur `syonad`, SELinux désactivé…), chrony sur les seuls serveurs NTP du DHCP | | `debian13` | Debian 13 genericcloud `20261021-2638` (SHA-512) | exigences two | Exigences two, communes : source de métadonnées NoCloud vers `169.254.169.254`, `network-config` diff --git a/packer/scripts/check.sh b/packer/scripts/check.sh index 139629c..e91b5bf 100644 --- a/packer/scripts/check.sh +++ b/packer/scripts/check.sh @@ -36,6 +36,10 @@ machine_id_blank () { [ ! -s /mnt/etc/machine-id ] } +no_fixed_ntp () { + ! grep -qE '^[[:space:]]*(pool|server|peer)[[:space:]]' /mnt/etc/chrony.conf +} + check "/var/lib/cloud vide" empty_or_absent /mnt/var/lib/cloud check "aucune clé d'hôte SSH" no_match /mnt/etc/ssh -maxdepth 1 -name 'ssh_host_*' check "aucun authorized_keys sous /root" no_match /mnt/root -name authorized_keys @@ -54,6 +58,8 @@ case "${FAMILY}" in check "DHCP sur toutes les interfaces (NetworkManager)" has_line /mnt/etc/NetworkManager/system-connections/90-all-en.nmconnection "interface-name=en*" check "SELinux désactivé" has_line /mnt/etc/selinux/config "SELINUX=disabled" check "utilisateur par défaut syonad" has_line /mnt/etc/cloud/cloud.cfg.d/20_user.cfg " name: syonad" + check "chrony sans serveur NTP fixe" no_fixed_ntp + check "chrony sur les serveurs NTP du DHCP" has_line /mnt/etc/chrony.conf "sourcedir /run/chrony-dhcp" ;; esac diff --git a/packer/scripts/rocky.sh b/packer/scripts/rocky.sh index 2b807ae..0be7ca3 100644 --- a/packer/scripts/rocky.sh +++ b/packer/scripts/rocky.sh @@ -54,6 +54,7 @@ for unit in rpcbind.service rpcbind.socket; do done augtool -r /mnt -s set /files/etc/selinux/config/SELINUX disabled +augtool -r /mnt -s rm /files/etc/chrony.conf/pool mapfile -t cockpit < <(chroot /mnt rpm -qa 'cockpit*') if [ "${#cockpit[@]}" -gt 0 ]; then diff --git a/test.sh b/test.sh index 7406e6a..3be425d 100755 --- a/test.sh +++ b/test.sh @@ -132,6 +132,12 @@ cloud_init_done () { vm 'cloud-init status --wait' | grep -q 'status: done' } +no_ntp_source () { + local sources + sources=$(vm 'chronyc -n -c sources') || return 1 + [ -z "${sources}" ] +} + image="${1:-}" if [ -z "${image}" ] || [ ! -f "${DIST}/${image}.qcow2" ]; then die "usage : ${0} (fichier ${DIST}/.qcow2)" @@ -158,6 +164,9 @@ check "aucune clé de construction" vm '! sudo grep -rq two-images-build /home / if vm 'command -v getenforce' >/dev/null; then check "SELinux désactivé" test "$(vm getenforce)" = Disabled fi +if vm 'command -v chronyc' >/dev/null; then + check "aucune source NTP hors DHCP (QEMU n'en annonce pas)" no_ntp_source +fi BOOT=$(boot_id) vm_closing 'sudo systemctl reboot' wait_reboot "${BOOT}"