Skip to content

Commit 05e4add

Browse files
fix for flags handling, ocsp case, macro guards, unused variable, changed default from MY to required to be set
enable SHA1 with windows cert store test case expand test cases, adjust to authorized key file, minor dead code adjustments add more documentation, refactor duplicate code sections, clean up test cases, more adjustments to logging spamming protections
1 parent da9ef19 commit 05e4add

36 files changed

Lines changed: 5488 additions & 1206 deletions

.github/workflows/windows-cert-store-test.yml

Lines changed: 908 additions & 33 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,72 @@ fred-cert.der would be:
538538

539539
$ ./examples/client/client -u fred -J ./keys/fred-cert.der -i ./keys/fred-key.der
540540

541+
WINDOWS CERTIFICATE STORE
542+
=========================
543+
544+
On Windows, host and user keys can come from the MS Certificate Store instead
545+
of files. Requires certificate support (`--enable-certs` or `WOLFSSH_CERTS`);
546+
enable it with the `--enable-windows-cert-store` build option (mingw hosts
547+
only) or by defining `WOLFSSH_WINDOWS_CERT_STORE`. The build links against
548+
`crypt32` and `ncrypt`. For the Visual Studio build see the comment block in
549+
`ide/winvs/user_settings.h`, including the `WOLFSSH_NO_SHA1_SOFT_DISABLE` and
550+
`WC_SIG_MIN_HASH_TYPE` caveats an RSA store certificate needs (RFC 6187's only
551+
RSA algorithm, `x509v3-ssh-rsa`, signs with SHA-1); ECDSA store keys need
552+
neither.
553+
554+
The echoserver and the SFTP client take a `-W store:subject[:flags]` option
555+
naming the store, the certificate's subject CN, and optionally the store
556+
location. Accepted location names are CURRENT_USER (the default),
557+
LOCAL_MACHINE, USERS, CURRENT_SERVICE, SERVICES, CURRENT_USER_GROUP_POLICY,
558+
LOCAL_MACHINE_GROUP_POLICY and LOCAL_MACHINE_ENTERPRISE, each also accepted
559+
with a `CERT_SYSTEM_STORE_` prefix or as a number. `-W` supplies both the
560+
certificate and its private key; in the SFTP client it therefore cannot be
561+
combined with `-i`, `-j`, or `-J` (the echoserver's options of those names are
562+
unrelated and remain usable). `-W` also skips the wolfssh home directory
563+
search so file arguments resolve against the current directory.
564+
565+
$ ./examples/echoserver/echoserver -W "My:wolfSSH-Server:LOCAL_MACHINE" -a ./keys/ca-cert-ecc.pem
566+
567+
$ ./examples/sftpclient/wolfsftp -u testuser -W "My:testuser:CURRENT_USER" -A ./keys/ca-cert-ecc.der -X
568+
569+
wolfSSHd gains these configuration directives, all global only (they are
570+
rejected inside a `Match` block):
571+
572+
* `HostKeyStore <store>`, `HostKeyStoreSubject <CN>`, and
573+
`HostKeyStoreFlags <location>` select the host key from a certificate
574+
store. All three must be set together, and they conflict with `HostKey`,
575+
`HostCertificate`, and the `-h` command line option.
576+
* `wolfSSH_TrustedUserCAStore yes|no` loads the client-certificate trust
577+
anchors from a Windows store named by `wolfSSH_WinUserPvPara <store>` at
578+
the mandatory location `wolfSSH_WinUserDwFlags <location>`
579+
(`wolfSSH_WinUserStores` optionally names the provider; only
580+
`CERT_STORE_PROV_SYSTEM` is supported). Only certificates with
581+
basicConstraints CA:TRUE are loaded, and the OS-managed public trust
582+
stores (`Root`, `AuthRoot`, `CA`, ...) are refused: every CA in the named
583+
store becomes an SSH login authority, so point it at a store created for
584+
this purpose that holds nothing but your own CA.
585+
* `wolfSSH_TrustedSystemCAKeys yes|no` imports the OS trust store via
586+
wolfSSL (`WOLFSSL_SYS_CA_CERTS`) as the client-certificate trust anchors.
587+
On CN-binding builds (no FPKI) this additionally requires a per-user
588+
`AuthorizedKeysFile` on every config node, so a subject CN match alone can
589+
never log in. On FPKI builds every config node must set
590+
`AuthorizedUPNDomains` or a per-user `AuthorizedKeysFile`; note
591+
`AuthorizedUPNDomains` constrains only the certificate's UPN realm, not
592+
which trusted CA issued it, so use it only when the OS trust store holds
593+
solely your organization's CA.
594+
595+
Note that the pre-existing `HostKey` and `HostCertificate` directives are now
596+
also rejected when they appear after a `Match` block (matching OpenSSH); they
597+
were previously accepted there and silently ignored, so a config that relied
598+
on that will now stop the daemon at startup with a parse error. Builds made
599+
with `WOLFSSH_IGNORE_UNKNOWN_CONFIG` instead log a warning and ignore the
600+
directive, preserving the old behavior as a migration path.
601+
602+
Without FPKI, a client certificate is bound to the requested account by a
603+
case-insensitive subject CN match only; keep the trusted CA set narrow. Note
604+
also that the config parser requires whitespace between an option name and
605+
its value; the OpenSSH `Keyword=value` form is rejected.
606+
541607
TPM PUBLIC KEY AUTHENTICATION
542608
=============================
543609

0 commit comments

Comments
 (0)