Repository navigation
Harden 802.1X (PNAC) re-authentication and removal handling - #6929
Conversation
|
Claude finished @milan-zededa's task in 6m 5s —— View job Review complete — PR #6929: Harden 802.1X (PNAC) re-authentication and removal handling
SummarySolid, well-tested hardening change. I traced the two production-side state machines in detail and found no correctness bugs — just two low-severity robustness observations, posted inline:
Things I verified as correct (no action needed):
No blocking issues from my side. |
4441ada to
13ec271
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #6929 +/- ##
==========================================
+ Coverage 28.47% 29.04% +0.57%
==========================================
Files 540 552 +12
Lines 98258 99985 +1727
==========================================
+ Hits 27975 29045 +1070
- Misses 68009 68707 +698
+ Partials 2274 2233 -41 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
c182be8 to
fb520b6
Compare
rene
left a comment
There was a problem hiding this comment.
Kicking off Eden tests.....
fb520b6 to
fee54ce
Compare
Extend TestPNAC with a configurable number of cycles (EVETEST_PNAC_REAUTH_CYCLE_COUNT, default 3) that exercise 802.1X more aggressively than a single enrollment and authentication: - re-initialize the port on the authenticator twice and verify that LastAuthTimestamp advances each time and the port keeps an IP from the authenticated VLAN - make the authenticator trust only an unrelated CA and verify that the failure is reported and the port gets a pre-auth VLAN IP - restore the CA and verify that EVE recovers on its own - disable PNAC and remove the SCEP profile, verify the certificate is removed and the port falls back to the pre-auth VLAN, then enroll a new certificate with a different key type and hash - log EVE memory usage after every cycle and fail if it approaches the EVE memory limit, so a higher cycle count can expose growth Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Milan Lenco <milan@zededa.com>
Bumping Hostapd.ReauthGeneration only deauthenticated the stations. For a wired supplicant that sends no frame at all, so the supplicant kept considering its port authorized and never re-authenticated, unlike with a real switch that re-initializes the port and sends a new EAP-Request/Identity. After deauthenticating, wait for hostapd to remove each station and add it back with "hostapd_cli new_sta", which makes hostapd start a new EAP exchange. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Milan Lenco <milan@zededa.com>
…ol socket nim learned about the 802.1X state from "wpa_cli -a", which only calls its action script for CONNECTED and DISCONNECTED. When a wired port re-authenticates (e.g. after the authenticator re-initializes it), wpa_supplicant stays in the COMPLETED state and emits neither event. As a result the PNAC state file was not updated, the reported LastAuthTimestamp stayed stale and, if the switch had moved the port to a different VLAN, DHCP was never reacquired. The same happened when the authenticator rejected the certificate after such a re-init. Attach to the control socket of wpa_supplicant directly and update the PNAC state file also on CTRL-EVENT-EAP-SUCCESS and CTRL-EVENT-EAP-FAILURE. Events are coalesced for a short moment so that the supplicant state machines have settled before the network monitor reads the status. The wpa_cli watcher process and its generated script are no longer needed. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Milan Lenco <milan@zededa.com>
When PNAC is disabled or reconfigured, nim stops wpa_supplicant by terminating the process. That does not make the supplicant send an EAPOL-Logoff frame, so the authenticator keeps treating the port as authorized and does not move it back to the pre-authentication VLAN. Ask wpa_supplicant to log off through its control socket before it is stopped. The event listener is stopped first, so the logoff is not reported as a change of the authentication state. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Milan Lenco <milan@zededa.com>
When PNAC is removed from a port, the supplicant logs off and the switch may move the port to a different VLAN, so the lease has to be reacquired just like after a change of the authentication state. The scheduled reacquire used to be cancelled whenever the current DPC had PNAC disabled. Cancel it only if the PNAC configuration of the port differs from the one at the time of scheduling, or the port has no DHCP client. Also make DPC verification wait for the first DHCP reacquire of a port to finish (bounded the same way as for async operations). Otherwise the connectivity test of a new DPC can run with a lease obtained in the previous VLAN, fail, and make nim fall back to the previous DPC. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Milan Lenco <milan@zededa.com>
The console was described as unusable by AI agents. It can be driven by piping short commands into it, and it is the only way in when ssh does not work because of networking problems, which is when it is most useful. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Milan Lenco <milan@zededa.com>
After a PNAC state change, the DHCP client may obtain a lease from the new VLAN by itself before the first scheduled reacquire runs. Releasing that lease again caused a short loss of the IP address and of the DNS servers right after the port was reported as authenticated, which made connections started at that moment fail. Cancel the reacquire tracker instead of releasing the lease when the subnet of the port already differs from the one recorded when the PNAC event was received. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Milan Lenco <milan@zededa.com>
fee54ce to
6b87882
Compare
evetest: skip decisionThis PR only hardens 802.1X/PNAC re-authentication and removal handling (nim's wpa_supplicant/wpa_ctrl event handling, dpcmanager's PNAC-gated DHCP reacquire tracker and DPC-verify wait, and the evetest SDN hostapd/ Skipping the following as unrelated (whole suites, none touch PNAC/802.1X/wired-port auth or the DHCP-reacquire mechanism):
Skipping the following individual tests in
An engineer can comment |
Description
Hardening of the 802.1X (PNAC) support in nim, fixing problems found during
EVE 17.0.1 RC testing, where repeated re-authentications and trusted CA changes
could leave a port with a wrong IP address or a stale authentication status.
Changes in nim:
wpa_supplicantcontrol socket(EAP-SUCCESS/EAP-FAILURE events) instead of the
wpa_cli -aaction script.The script is only invoked for CONNECTED/DISCONNECTED, which are not emitted
when a wired port re-authenticates, so the reported PNAC state could be stale
and the DHCP lease was not re-acquired after the port moved between VLANs.
immediately unauthorizes the port instead of keeping the session of a
supplicant that no longer exists.
DHCP reacquire mechanism. DPC verification now waits for the first reacquire
to finish, so that the connectivity test is not run with the stale IP address
of the authenticated network (which previously caused a rollback to the
previous DPC).
Changes in evetest:
TestPNACgets stress cycles of repeated re-authentications, trusted CAchanges and SCEP profile replacements, verifying after each cycle that the
reported status is updated and that the port gets the IP from the
correct (authenticated or non-authenticated) VLAN. The number of cycles is set
by
EVETEST_PNAC_REAUTH_CYCLE_COUNT(default 3), which can be increased tolook for resource growth. Memory usage is logged after each cycle, and an
unexpected reboot fails the test.
configuration changes (
new_sta), restarts hostapd when the CA or users change(hostapd does not reload TLS certificates), and reaps child processes
(zombie hostapd previously made the SDN fail to stop it).
evetest/CLAUDE.mdnow describes how an AI agent can use the EVE console.How to test and validate this PR
Run the automated test, optionally with more cycles:
Pillar unit tests of the changed packages:
Manual check: on a device with PNAC enabled on an uplink, change the trusted
CA or force the authenticator to re-authenticate the port, and verify that the
reported PNAC state changes and the port gets an IP from the expected network.
Then remove PNAC from the port and verify that the port acquires an address from
the non-authenticated network and that the authenticator sees EAPOL-Logoff.
Changelog notes
Improved reliability of 802.1X (port-based network access control): the port
status is updated on every re-authentication, the DHCP lease is re-acquired
after the port moves between authenticated and non-authenticated networks,
and the switch is notified when 802.1X is turned off on a port.
PR Backports
Checklist