Repository navigation
Resolve IPv6 sender addresses and exercise an alert in CI (stacked on #422) - #424
Merged
Merged
Conversation
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
Stacked on #422 (base
fix/review-hardening). Merge #422 first; this PR must merge after it and should be retargeted todeveloponce #422 lands.Hostname resolution now handles IPv6, and the CI test data now contains an alert rule that fires.
syslog_resolve_incoming_hosts()used IPv4-onlygethostbyname(), so a sender known only by an AAAA record, or by an IPv6 address, was markedunresolved-. Names are now checked withdns_get_record()for A and AAAA, falling back togethostbyname(). IPv4 and IPv6 literals need no lookup and do not use the lookup budget from Harden alert commands, upgrades and dashboards, and fix review findings #422. IPv6 text is normalised withinet_pton()/inet_ntop()(compressed, lower case; brackets removed, zone suffix kept) before it is compared with Cacti devices and stored. Harden alert commands, upgrades and dashboards, and fix review findings #422's lookup budget, its "left as received" handling when the budget is spent, andsyslog_no_dnsare unchanged. The function gains an optional last argument,$dns_records, so tests can supply DNS answers.tests/bin/populate_syslog_incoming.shinserted its alert rule withoutsuppression_schedule(text NOT NULL, no default), and with mismatched column and value counts, so the insert failed under strict mode and CI never had a rule to evaluate. The insert is fixed, the script usesset -euo pipefail, and the removal rule usesREPLACE INTO.syslog_logsrow for hostbob). "Check Cacti Logs for Errors" still fails on anyFATAL:,ERROR:orWARNING:line except that one alert line, matched literally.HostnameLookupBudgetTestused the literal192.0.2.1as a name that fails to resolve. Literals now count as resolved, so it usesno-such-sender.invalid.Related Issue
None.
Motivation and Context
IPv6-only senders were reported as unresolved. The CI gap meant alert evaluation was never exercised end to end.
How Has This Been Tested?
Executed, on Cacti
1.2.xand ondevelop, on top of #422 head f93418a:tests/Unit/HostAddressResolutionTest.phpcover IPv4 literal; IPv6 compressed, expanded, mixed case, bracketed, mapped and zoned; A only, AAAA only, both, none and a failed query; hosts-file fallback;syslog_no_dnson; and the budget: AAAA-only names resolve within the budget, are left as received with one budget log line when it is exhausted, literals skip the budget, and no lookup is made whensyslog_no_dnsis on, with either budget.php tests/bin/patch-coverage.php coverage/clover.xml f93418a 100: 100.00% (31/31 lines).php tests/bin/check-i18n-pot.php f93418a: OK.cli_schema_upgrade_test.phppass (includingreview_fixes_paths_database_test.php, 124 checks), populate and processor give one alert-fired line and onesyslog_logsrow forbob,live_pipeline_test.phppasses (39 checks) aswww-data, and nothing remains after the log-check filter.Not run: a real AAAA lookup against a live resolver (stubbed in tests); the GitHub workflow itself; the optional Xdebug dump and coverage merge from #422 (no Xdebug in the replay containers).
Types of changes
Checklist:
README gains a short note on IPv6 senders.