linux 使用RavenDB 5客户端禁止访问

8dtrkrch  于 5个月前  发布在  Linux
关注(0)|答案(1)|浏览(42)

我正在尝试使用raqib客户端连接到基于云的raqib数据库。我在本地机器上没有问题,但是每当我尝试连接到生产游戏服务器时,我都会收到以下错误:
禁止进入

{"Type":"InvalidAuth","Message":"This server requires client certificate for authentication, but none was provided by the client. Did you forget to install the certificate?"}

字符串
请注意,生产服务器运行在精简版的ubuntu Linux上。
我验证了证书是与构建映像一起提供的。我验证了证书是有效的并且可以工作。我知道它可以正常工作,因为在我的本地环境中它可以正常工作。
我有以下代码:

public static class DocumentStoreHolder
{
    private const string CERTIFICATE_PASSWORD = "-snip-";
    private static string CERTIFICATE_PATH = Path.GetFullPath("certificate.pfx");

    public static X509Certificate2 GetCertificate()
    {
        return new X509Certificate2(CERTIFICATE_PATH, CERTIFICATE_PASSWORD);
    }
    public static void Initialize()
    {
        var certificate = GetCertificate();
        if (certificate.HasPrivateKey)
        {
            ksLog.Debug("Private key exists.");
        }
        else
        {
            ksLog.Debug("Private key does not exist.");
        }
        LazyStore = new Lazy<IDocumentStore>(() =>
        {
            var store = new DocumentStore
            {
                Urls = new[] { "-snip-" },
                Database = "-snip-",
                Certificate = certificate,
            };

            return store.Initialize();
        });

    }

    private static Lazy<IDocumentStore> LazyStore;

    public static IDocumentStore Store => LazyStore.Value;
}


在生产服务器上,输出“私钥证书”,因此我们知道证书已正确加载到内存中。
请注意,我使用的是.net Framework 4.8。我运行的是最新版本的Ravendb客户端。
我联系了他们,他们说:Basically it's about the X509 certificate's private key. In a lot of platform you need to allow the app to load that certificate explicitly e.g. by providing its thumbprint
不幸的是,这对我没有多大帮助。
如果其他人有建议或我可以尝试的事情,我将不胜感激。

ngynwnxp

ngynwnxp1#

在您的prod服务器和RavenDB Cloud示例上或之间是否有某种实用程序?
代码看起来很好,上次我看到这样的错误是当公司的安全团队启用软件过滤掉通过网络发送到服务器的客户端证书时。

相关问题