[Bug Report] CLI modify-dns accepts invalid IPv4 addresses (e.g. 999.999.999.999)

SYSTEM INFORMATION
OS type and version Debian 12
Webmin version 2.610
Virtualmin version 7.50.2 GPL

Hello Virtualmin Team,

I am currently developing a custom DNS management script using the Virtualmin CLI API, and I noticed a lack of validation when adding DNS records via modify-dns.

The Issue: The virtualmin modify-dns command allows adding A-records with mathematically impossible IPv4 addresses (octets greater than 255).

Steps to reproduce: Run the following command in the terminal:

virtualmin modify-dns --domain example.com --add-record "test A 999.999.999.999"

Expected Behavior: The command should fail with an error message stating that the IP address is invalid (octets must be between 0-255).

Actual Behavior: The command returns success, and the record is added to the Virtualmin UI. However, this creates a broken zone file because BIND/Named will fail to load a zone containing 999.999.999.999.

It would be great if strict IPv4 validation could be added to the CLI tools to prevent corrupting zones with typos like 192.168.1.555.

Thanks!

2 Likes

Thanks for the heads up! It was a bug and fixed in this commit: