WCF - 使用证书通过 Message Security 对客户端进行身份验证
希望是一个快速的问题。
我想要保护我的 WCF 服务,该服务将由已知方使用。我们的组织信任他们的组织,反之亦然。
该服务已经受到IP地址的限制,因此我们知道呼叫者一定来自他们的网络。
不过,我希望它能够受到保护,免受该组织内的恶意开发人员的侵害。理论上,他们可以编写一个错误的应用程序并将其安装在该网络上的任何位置,然后调用我们的服务,该服务将返回数据。
我认为解决这个问题的一种方法是也使用客户端证书,该证书将使用对等信任进行验证。每个请求都会发送此证书,我们将在 WCF 服务上验证该证书,然后发回数据。
我的问题 - 这是否可以防止上述恶意开发人员的情况?我们知道请求必须源自安装了客户端证书的服务器(对吗?) - 我想恶意开发人员应该很难在那里获得不良应用程序。遗憾的是我们无法将其精确地绑定到客户端应用程序 - 或者我们可以吗?
任何帮助表示赞赏 - 只是想确保我对此的理解!
Hopefully a quick question.
I want to secure my WCF service that will be consumed by a known party. Our organisation trust theirs and vice versa.
This service is already restricted by IP address, so we know the caller must have come from their network.
However I would like it to be protected against malicious developers within that organisation. In theory they could write a Bad App and install it anywhere on this network, and call our service, which would return the data.
I think a way around this would be to also use Client Certificates, which would be validated using Peer Trust. Each request would send this certificate, which we would validate on the WCF service, and send back the data.
My question - is this going to protect against the malicious developer scenario outlined above? We would know that the request would have to originate on the server with the client certificate installed (right?) - and I imagine it should be difficult for a malicious developer to get a Bad App on there. It is a shame we can't tie it down to exactly the client application - or could we?
Any help appreciated - just want to make sure I nail my understanding of this!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您将根据特定的传入客户端证书授予对服务的访问权限,则它应该与该证书的私钥一样安全。也就是说,如果私钥在其他组织中保持安全,您的服务将同样安全(在加密方面与证书的公钥/私钥对一样安全)。
如果私钥在其他组织内被泄露,例如,攻击者可以在远程服务器上访问它,或者能够将其复制到另一个远程服务器,那么该攻击者就可以访问您的服务。因为,一旦他们拥有了私钥,他们就可以使用客户端证书来使用 SSL 连接进行连接,然后他们只需要通过 IP 地址检查即可。保护客户端证书的私钥。
If you will be granting access to your service based on the specific incoming client certificate, it should be as secure as the private key of that certificate. That is, if the private key is kept safe in the other organization, your service will be as safe (as safe as that public/private key pair of the certificate in terms of encryption).
If the private key is compromised within the other organization, for example, an attacker has access to it on the remote server, or is able to copy it to another remote server, then that attacker has access to your service. Because, once they have the private key, they can use the client certificate to connect using an SSL connection, and then they just have to pass the IP address check. Protect the client certificate's private key.
您可以在服务端检查客户端是否已使用特定证书进行了身份验证。您还可以编写自定义证书验证程序并根据您自己的需要验证证书。但是,如果您假设攻击者可能能够在您的环境中使用受信任证书的私钥,那么我想您可能会认为攻击者基本上可以做任何事情,并且您无法保护您的服务。
You may check on the service side if the client has authenticated itself with specific certificate. You may also write Custom Certificate Validator and validate certificate according to your own needs. However, if you assume that the attacker may be able to use private key of trusted certificate in your environment, then I guess you may assume that the attacker can basically do anything and there is no way you can secure your service.