用于 https 的清漆

Varnish to be used for https

情况是这样的。我有通过安全网络 (https) 与多个后端通信的客户端。现在,我想建立一个主要用于负载平衡(基于 header 数据或 cookie)和一点缓存的反向代理。所以,我认为清漆可能有用。

但是,清漆不支持ssl-connection。正如我在许多地方读到的那样,引用 "Varnish does not support SSL termination natively"。但是,我想要每一个连接,即。 client-varnish 和 varnish-backend 将通过 https。我不能在整个网络的任何地方拥有纯文本数据(有限制)所以没有其他东西可以用作 SSL-Terminator(或者可以?)。

那么问题来了:

what does this mean (if someone can explain in simple terms) that "Varnish does not support SSL termination natively"

这意味着 Varnish 没有对 SSL 的内置支持。它不能在带有 SSL 的路径中运行,除非 SSL 由单独的软件处理。

这是 Varnish 作者的架构决定,他曾在 2011 年讨论过将 SSL 集成到 Varnish 中的想法。

他基于许多因素,其中最重要的是想要这样做正确,同时观察到 SSL 事实上的标准库是openssl,这是一个包含超过 300,000 行代码的迷宫式集合,他对该代码库既不自信,也不相信有利的 cost/benefit 比率的可能性。

他当时的结论,一句话,"no."

That is not one of the things I dreamt about doing as a kid and if I dream about it now I call it a nightmare.

https://www.varnish-cache.org/docs/trunk/phk/ssl.html

他在 2015 年重新审视了这个概念。

他的结论又是"no."

Code is hard, crypto code is double-plus-hard, if not double-squared-hard, and the world really don't need another piece of code that does an half-assed job at cryptography.

...

When I look at something like Willy Tarreau's HAProxy I have a hard time to see any significant opportunity for improvement.

No, Varnish still won't add SSL/TLS support.

Instead in Varnish 4.1 we have added support for Willys PROXY protocol which makes it possible to communicate the extra details from a SSL-terminating proxy, such as HAProxy, to Varnish.

https://www.varnish-cache.org/docs/trunk/phk/ssl_again.html

此增强功能可以简化将 varnish 集成到具有加密要求的环境中的过程,因为它提供了另一种机制来在卸载的 SSL 设置中保留原始浏览器的身份。

is this scenario good to implement using varnish?

如果您需要 Varnish,请使用它,注意 SSL 必须单独处理。但是请注意,这并不一定意味着未加密的流量必须遍历您的网络……尽管这确实会导致更复杂且 CPU 饥饿的设置。

nothing else can be used as SSL-Terminator (or can be?)

SSL可以在Varnish的前端卸载,在Varnish的后端重新建立,都在同一台机器上运行Varnish,但是通过不同的进程, 在 Varnish 前后使用 HAProxy 或 stunnel 或 nginx 或其他解决方案。任何明文流量都在一台主机的范围内运行,因此如果主机本身是安全的,则可以说不是漏洞点,因为它永远不会离开机器。

if varnish is not a good contender, should I switch to some other reverse proxy

这完全取决于您在堆栈中想要和需要的东西、它对您的 cost/benefit、您的专业水平、资源可用性和其他因素。每个选项都有自己的一组功能和限制,在同一个堆栈中使用多个选项当然不是闻所未闻。