Files
ProxmoxVE/vm
CanbiZ (MickLesk) 3dbf115e0b VM's: add input validation and hostname sanitization to all VM scripts (#12973)
* Sanitize hostname generation from VM_NAME

Replace the previous simple space-removal with stricter sanitization when deriving the hostname from VM_NAME. Non-alphanumeric/hyphen sequences are collapsed to a single hyphen and leading/trailing hyphens are trimmed, preserving lowercase and ensuring a cleaner, more valid hostname string.

* fix(vm): validate CORE_COUNT input - require positive integer, re-ask on invalid

* Validate RAM input in VM scripts

Add input validation and retry loop for RAM size prompts across multiple VM scripts. Each modified advanced_settings() now wraps the whiptail RAM input in a while-true loop, ensures a default of 2048 when empty, validates that the value is a positive integer, shows an "INVALID INPUT" msgbox on bad values, and calls exit-script when the dialog is canceled. Also fixes quoting of RAM_SIZE in several scripts. Affected files: vm/archlinux-vm.sh, vm/debian-13-vm.sh, vm/mikrotik-routeros.sh, vm/nextcloud-vm.sh, vm/owncloud-vm.sh, vm/ubuntu2204-vm.sh, vm/ubuntu2404-vm.sh, vm/ubuntu2504-vm.sh, vm/umbrel-os-vm.sh. These changes prevent invalid RAM entries and improve user experience when configuring VMs.

* Validate RAM input for VM scripts

Add robust RAM input validation to multiple VM helper scripts (debian, docker, haos, openwrt, opnsense, pimox-haos, truenas). Each RAM prompt is now wrapped in a while loop that: provides a sensible default when the input is empty, ensures the value is a positive integer via regex, shows an "INVALID INPUT" whiptail message on bad input, and exits cleanly when the user cancels. Also fixed quoting of variable tests and normalized echoing of the allocated RAM. The pimox change preserves exit-status handling while integrating the same validation loop.

* fix(vm): validate VLAN input - require 1-4094 range, re-ask on invalid

* fix(vm): validate MTU input - require 576-65520 range, re-ask on invalid

* fix(vm): validate MAC address input - require XX:XX:XX:XX:XX:XX format, re-ask on invalid
2026-03-20 13:18:01 +01:00
..
2026-02-05 12:02:06 +01:00