wolfsshd: let QNX own the host key's permissions - #1185
Open
ejohnstown wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates wolfsshd for QNX systems whose host-key ownership and permissions are managed externally, while retaining structural file-safety checks.
Changes:
- Adds QNX-gated host-key permission relaxation.
- Extends secure-file opening with a
relaxPermsoption. - Limits relaxation to host-key loading and adds test coverage.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Summary |
|---|---|
apps/wolfsshd/wolfsshd.c |
Applies relaxed checks only to QNX host-key loading. |
apps/wolfsshd/test/test_configuration.c |
Tests relaxed permission handling and retained structural checks. |
apps/wolfsshd/auth.h |
Updates the secure-file API declaration. |
apps/wolfsshd/auth.c |
Implements relaxed secure-file behavior and updates callers. |
Suppressed comments (2)
apps/wolfsshd/wolfsshd.c:260
- This opt-in changes the result expected by the existing
run_hostkey_perm_check()integration test:run_all_sshd_tests.sh:344-347still launches wolfsshd with a mode-0666 host key and requiresRefusing to load. On a QNX build that definesWOLFSSH_NO_HOSTKEY_PERMS, this path now succeeds, so the test suite exits with a false failure; make that assertion conditional on the same build guard or skip the negative case when the relaxation is enabled.
#if defined(WOLFSSH_NO_HOSTKEY_PERMS) && \
(defined(__QNX__) || defined(__QNXNTO__))
apps/wolfsshd/wolfsshd.c:421
- This message is emitted at
WS_LOG_INFO, butSetupCTX()runs whilewolfSSHDLoggingCbis installed and that callback drops non-error messages unlessdebugModeis enabled; daemon mode switches toSyslogCbonly afterSetupCTX()returns. Consequently a normal startup will not record the fact that the permission guard was compiled out, contrary to the stated startup logging. Route this notice through a path visible during normal startup (or install the intended logging callback beforeSetupCTX()).
wolfSSH_Log(WS_LOG_INFO, "[SSHD] Built with "
"WOLFSSH_NO_HOSTKEY_PERMS, host key ownership and permissions "
"are left to the platform");
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
ejohnstown
force-pushed
the
hostkey-perms
branch
from
August 20, 2026 21:22
7a6d52a to
f680714
Compare
JacobBarthelmeh
approved these changes
Aug 20, 2026
QNX system images fix the host key's owner and modes, and the daemon cannot change either, so the secure gate refuses to load a key the integrator has no way to correct. Add a hand-defined WOLFSSH_NO_HOSTKEY_PERMS, further conditional on QNX, that hands only that policy to the platform. - Fold the macro and the QNX test into the internal WOLFSSHD_HOSTKEY_RELAX_PERMS in wolfsshd.c. - Add a relaxPerms argument to wolfSSHD_OpenSecureFile() that skips the owner, mode and ancestor-directory checks. - Keep the structural checks: lstat, O_NOFOLLOW, S_ISREG and the dev/ino recheck, so a symlink, a non-regular file or a swap during the open is still refused. - Set it only on the host key load, leaving the host cert, UserCAKeysFile, authorized_keys and shadow gates unchanged. - Log at startup when the guard is built in. - Add six test_OpenSecureFile scenarios for the relaxed path, unreachable at runtime off QNX and so otherwise uncovered. Issue: ZD-22308
ejohnstown
force-pushed
the
hostkey-perms
branch
from
August 21, 2026 16:29
f680714 to
59819ab
Compare
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.
QNX system images fix the host private key's owner and modes, and the daemon cannot change either, so
wolfSSHD_OpenSecureFile()refuses a key the integrator has no way to correct and wolfSSHd will not start.Add
WOLFSSH_NO_HOSTKEY_PERMS, hand-defined inuser_settings.horCPPFLAGSand additionally conditional on QNX.wolfsshd.cfolds the macro and the QNX test into one internalWOLFSSHD_HOSTKEY_RELAX_PERMS.relaxPermsargument onwolfSSHD_OpenSecureFile()skips the owner, mode and ancestor-directory checks.HostCertificate,UserCAKeysFile,authorized_keysand the shadow open keep the full gate everywhere.Still enforced regardless:
lstat/O_NOFOLLOW(symlink),S_ISREG(FIFO, device, directory), and the dev/ino recheck (swap during open).Issue: ZD-22308