简体   繁体   English

.NET的X509Store可以用于从远程Linux商店获取证书吗?

[英]Can .NET's X509Store be used to get certificates from remote Linux stores?

I'm writing a service to periodically traverse certificate stores on remote servers in production, for the purpose of tracking certificates used, where, and their expiration dates, in case some were not updated as required. 我正在编写一项服务,以定期遍历生产环境中的远程服务器上的证书存储,目的是跟踪所使用的证书,位置以及它们的过期日期(以防某些证书未按要求更新)。

Traversing the Windows servers works as expected. 遍历Windows服务器按预期方式工作。 But I'm not sure what to do with Tomcat stores on (Ubuntu) linux. 但是我不确定如何在(Ubuntu)linux上使用Tomcat存储。 Does the X509Store object have the capability to target remote Linux machines? X509Store对象是否具有针对远程Linux机器的功能? And how do the StoreName and StoreLocation concepts map there? 以及StoreName和StoreLocation概念如何映射在那里? How do I authenticate? 我该如何认证? I'm assuming it'll want an SSH session to attempt to connect to the stores. 我假设它将希望SSH会话尝试连接到商店。 Yeh, I don't know where to start. 是的,我不知道从哪里开始。

using(var store = new X509Store($@"\\{serverName}\{storeName}", StoreLocation.LocalMachine))
{
    store.Open(OpenFlags.ReadOnly);
    foreach(var cert in store.Certificates)
    {
        var issuedTo = cert.GetNameInfo(X509NameType.SimpleName, false);

No. The X509Store API on Linux tries to emulate the Windows behavior to a local process, but it has no remote capabilities. 否。Linux上的X509Store API尝试将Windows行为模拟为本地进程,但没有远程功能。

On Windows the real implementation of X509Store is the CAPI CertStore* APIs, which have an intrinsic cross-machine communication capability (probably through WinRPC); 在Windows上,X509Store的真正实现是CAPI CertStore * API,它们具有固有的跨机器通信功能(可能通过WinRPC); but they're fundamentally part of the OS. 但它们基本上是操作系统的一部分。

On Linux the functionality is only provided by the System.Security.Cryptography.X509Certificates library, and so there's nothing at all listening remotely. 在Linux上,该功能仅由System.Security.Cryptography.X509Certificates库提供,因此根本没有远程监听。

On macOS there's probably nothing listening remotely, but the X509Store classes are interpretations and projections of the SecKeychain* and SecTrust* APIs of Security.framework, so there may be some level of remote interaction at the lower level. 在macOS上,可能没有任何远程监听,但是X509Store类是Security.framework的SecKeychain *和SecTrust * API的解释和投影,因此在较低级别上可能存在某种级别的远程交互。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM