You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Windows: Puma TLS fails with 'Access denied' where DPAPI is unavailable (PFX key import) #130
Puma::MiniSSL on Windows (Src/Libraries/Puma/MiniSsl.cs, LoadCertificate) round-trips the server certificate through a PFX, because SChannel cannot serve with an ephemeral key:
With default key-storage flags that import persists the private key in the user's key store, which needs DPAPI. Where DPAPI is not available, the import fails with CryptographicException: Access denied. and puma cannot bind its TLS listener (OpenSSL::X509::CertificateError from ImportPfx). Seen in an OpenSSH session logged in with a public key (no credentials, so DPAPI cannot unlock the user's master key: ProtectedData.Protect also fails "Access is denied"); the same session with a password logon works. The same would likely hit a service account without a loaded profile.
Under such a session the test suite's Puma_Tls1 hangs, and NetHttp_Tls1, NetHttp_TlsVerifyCallback1, NetHttp_PlainNoOpenSsl1, NetHttp_GemNetTls1 and Ssl_NonBlocking1 fail in their certificate setup (NetHttpTlsTests.csLoadPkcs12). CI is not affected (GitHub runners have a full interactive profile).
Possible fixes: try X509KeyStorageFlags.MachineKeySet (or UserKeySet explicitly) as a fallback when the default import is denied, and make the error say what is missing; in the tests, skip with a clear message when DPAPI is unavailable instead of hanging.
Activity