Syslog allowlist: CIDR ranges and discrete IPs #11
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/syslog-cidr-allowlist"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What does this PR do?
Extends the syslog source allowlist to accept CIDR ranges, discrete IP addresses, or any mix of both, so many LAN machines can send syslog to Viegard without enumerating every host, while single-host configurations keep working unchanged.
Viegard.Application.Net.CidrSet: shared pre-parsed matcher. Entries are bare addresses (exact /32 / /128 semantics) or CIDR ranges; IPv4-mapped IPv6 normalized on both sides; matching is pure, with fail-open/fail-closed semantics left to each caller.SyslogDatagramHandlermatches peers against the set; the allowlist remains checked before any parsing and remains fail-closed (enabled listener requires a non-empty, fully parseable list; startup now reports the specific bad entry and reason).swag-syslog-setup.mdshows the mixed single-host + LAN-range configuration.ProtectedAddressList(policy) keeps its own verified implementation; consolidation ontoCidrSetis possible later but not worth churning security-critical code in this PR.Fixes #
How was this tested?
dotnet build Viegard.slnx- 0 errors, 0 warningsdotnet test Viegard.slnx- 260/260 pass (20 new: CIDR admit/reject boundaries, mixed exact+range lists, IPv4-mapped IPv6 peers, and a brand-new validator test file covering fail-closed empty-list, invalid entries incl. /33 and /-1, ports, listen address)Checklist