Skip to content

[16.0-stable] evetest: port scans; fix the exposure they found on EVE - #6845

Merged
eriknordmark merged 1 commit into
lf-edge:16.0-stablefrom
milan-zededa:16.0-backport-6665-sshd-publickey-only
Nov 6, 2026
Merged

eriknordmark merged 1 commit into
lf-edge:16.0-stablefrom
milan-zededa:16.0-backport-6665-sshd-publickey-only

Conversation

@milan-zededa

@milan-zededa milan-zededa commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Description

Backport of #6665 to 16.0-stable.

Only the debug: let sshd offer only publickey login commit of the PR is
backported. The EVE-k commits (zedkube, kube, docs) are not applicable to
16.0, and the evetest commit is part of the evetest backport (#6842).

The cherry-pick (-x) conflicted in pkg/installer/Dockerfile on the eve-debug
image hash. The hash from the original commit refers to a master build, so it is
replaced by the hash of pkg/debug as built on 16.0-stable with this change.
The pkg/debug/Dockerfile change (a sshd_config.d drop-in) applies as on master,
now that #6707 has replaced the source-built OpenSSH with Alpine's
openssh-server.

Without this fix TestExternalPortScanKVM fails: sshd offers password methods
to the network.

How to test and validate this PR

Covered by the evetest suite TestPortScanSuite (variant TestExternalPortScanKVM, added to 16.0-stable by #6842):

EVETEST_EVE_VERSION=<16.0-stable build with this PR> make evetest NAME=TestPortScanSuite

To check on a real device, enable SSH access to the device from the controller
and, from another host, run:

ssh -o PreferredAuthentications=none -o PubkeyAuthentication=no root@<device-ip>

The connection must be refused with
Permission denied (publickey). Before this fix it listed
publickey,password,keyboard-interactive, and ssh would prompt for a password.
The same can be seen with nmap -p 22 --script ssh-auth-methods <device-ip>,
which must report only publickey.

Changelog notes

The debug sshd now offers only public key login, so it no longer advertises password-based authentication methods to the network.

Checklist

  • I've provided a proper description
  • I've added the proper documentation
  • I've tested my PR on amd64 device
  • I've tested my PR on arm64 device
  • I've written the test verification instructions
  • I've set the proper labels to this PR

For backport PRs (remove it if it's not a backport):

  • I've added a reference link to the original PR
  • PR's title follows the template

And the last but not least:

  • I've checked the boxes above, or I've provided a good reason why I didn't
    check them.

@codecov

codecov Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 33.07%. Comparing base (1492b8a) to head (c866bec).
⚠️ Report is 1 commits behind head on 16.0-stable.

Additional details and impacted files
@@               Coverage Diff               @@
##           16.0-stable    #6845      +/-   ##
===============================================
+ Coverage        31.67%   33.07%   +1.39%     
===============================================
  Files               10       25      +15     
  Lines             1026     3988    +2962     
===============================================
+ Hits               325     1319     +994     
- Misses             701     2669    +1968     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@milan-zededa
milan-zededa marked this pull request as draft October 19, 2026 08:37
@milan-zededa milan-zededa changed the title [16.0-stable] evetest: port scans; fix the exposure they found on EVE and EVE-k [16.0-stable] evetest: port scans; fix the exposure they found on EVE Oct 20, 2026

@eriknordmark eriknordmark left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shjala

shjala commented Nov 5, 2026

Copy link
Copy Markdown
Member

@milan-zededa should we make this PR just about the SSH auth and merged it, now that sshole is a thing?

@milan-zededa
milan-zededa force-pushed the 16.0-backport-6665-sshd-publickey-only branch from 316e614 to 9efa5fb Compare November 5, 2026 18:36
@github-actions
github-actions Bot requested a review from eriknordmark November 5, 2026 18:36
sshd in the debug container ran with Alpine's defaults, which offer
password and keyboard-interactive authentication to anyone who
connects. No account has a password, so none of those logins could
succeed, but that can only be established by inspecting the image, not
from the network. Turning both methods off leaves what is allowed
unchanged and makes it observable: the evetest port scans now require
that SSH offers publickey only.

Signed-off-by: eriknordmark <erik@zededa.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 97f726a)

Backport note: the eve-debug hash in pkg/installer/Dockerfile is not the one
from the original commit, which referred to a master build. It is the hash
of pkg/debug as built on 16.0-stable with this change.

Signed-off-by: Milan Lenco <milan@zededa.com>
@milan-zededa
milan-zededa force-pushed the 16.0-backport-6665-sshd-publickey-only branch from 9efa5fb to c866bec Compare November 5, 2026 18:41
@milan-zededa
milan-zededa marked this pull request as ready for review November 5, 2026 18:42
@milan-zededa

milan-zededa commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor Author

@eriknordmark @shjala I have redone this PR as a cherry-pick (-x) of 97f726a from master, now that #6707 has replaced the source-built OpenSSH with Alpine's openssh-server on the 16.0 branch.
The only difference is the eve-debug hash in pkg/installer/Dockerfile, which is the one for pkg/debug on 16.0-stable.
The PR is ready for review/merge.

@milan-zededa

Copy link
Copy Markdown
Contributor Author

Confirmed that the test is passing with this backport:

--- PASS: TestExternalPortScan (698.51s)

@eriknordmark
eriknordmark merged commit 74e56a4 into lf-edge:16.0-stable Nov 6, 2026
67 of 71 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants