Repository navigation
[17.0-stable] Harden 802.1X (PNAC) re-authentication and removal handling - #6987
Merged
eriknordmark merged 7 commits intoNov 1, 2026
Merged
Conversation
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> (cherry picked from commit feb1432)
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> (cherry picked from commit c96f1ea)
…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> (cherry picked from commit dc0e997)
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> (cherry picked from commit 4040141)
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> (cherry picked from commit 146cbcf)
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> (cherry picked from commit 2b91156)
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> (cherry picked from commit 88aefcf)
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## 17.0-stable #6987 +/- ##
===============================================
+ Coverage 23.24% 23.87% +0.62%
===============================================
Files 516 527 +11
Lines 95468 97158 +1690
===============================================
+ Hits 22193 23197 +1004
- Misses 71401 72125 +724
+ Partials 1874 1836 -38 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
rene
approved these changes
Oct 30, 2026
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
Backport of #6929
The original PR hardens 802.1X (PNAC) re-authentication and removal handling
in nim: re-authentication on a wired port is now detected through the
wpa_supplicant control socket, an EAPOL-Logoff is sent when the supplicant is
stopped, and the DHCP lease is reacquired when PNAC is removed from a port
(unless the lease already moved to another subnet). It also extends the
TestPNACevetest with stress cycles. For more details refer to the original PR.All 7 commits were cherry-picked with
-x. Conflicts on 17.0-stable:nim: detect 802.1X re-authentication through the wpa_supplicant control socket:wpa_supplicant_test.godoes not exist on 17.0-stable, so its 5-linedeletion was dropped (file stays deleted).
nim: reacquire DHCP lease when PNAC is removed from a port: 17.0-stable hasno
dnsCacheClearPendinglogic inverifyDPC(); only the DHCP-reacquirewait was kept.
How to test and validate this PR
Covered by the automated
TestPNACevetest (including the new stress cycles).Manually: on a port with PNAC enabled, force re-authentication from the switch
(e.g. with a VLAN change) and verify nim updates the PNAC state and reacquires
DHCP; remove PNAC from the port and verify the lease is reacquired.
Changelog notes
Improves handling of 802.1X (PNAC) on wired ports: re-authentication and
authentication failures are now detected reliably, and the DHCP lease is
refreshed when 802.1X is removed from a port or the port moves to another VLAN.
PR Backports
Checklist
For backport PRs (remove it if it's not a backport):
And the last but not least:
check them.
🤖 Generated with Claude Code