简体   繁体   English

Apache 反向代理背后的自签名证书有问题吗?

[英]Issues with self-signed certificate behind an Apache reverse-proxy?

I understand this topic was discussed in a couple of older posts, especially Will a self-signed certificate work behind an Apache reverse-proxy?我知道在一些较旧的帖子中讨论了这个主题,特别是自签名证书是否可以在 Apache 反向代理后面工作? posted by @Ryan由@Ryan 发布

I am facing the same issue but unable to get around it.我面临同样的问题,但无法解决它。 I have Apache 2.4.12 setup as reverse proxy in front of an Oracle HTTP server.我在 Oracle HTTP 服务器前将 Apache 2.4.12 设置为反向代理。 I have valid certs on the proxy server but self signed certs on Oracle HTTP server.我在代理服务器上有有效证书,但在 Oracle HTTP 服务器上有自签名证书。 The goal is to do https all the way through, but whenever the browser gets to myhost.domain, it throws a cert warning(because of self signed certs).目标是一直执行 https,但是每当浏览器访问 myhost.domain 时,它都会抛出一个证书警告(因为自签名证书)。 Having authentic certs on Oracle HTTP server is not an option and the users browsers are restricted and hence cannot ignore the self signed cert warning.在 Oracle HTTP 服务器上拥有真实证书不是一种选择,用户浏览器受到限制,因此不能忽略自签名证书警告。

Here's my virtual host这是我的虚拟主机


LogLevel ERROR
ServerName  myhost.domain
ServerAlias  xxx.xxx.xxx.xx
DocumentRoot D:/xyz/pubdocs
SSLEngine      On
SSLProxyEngine On
SSLCertificateFile      certs/myserver.crt
SSLCertificateKeyFile   certs/myserver.key
SSLCertificateChainFile certs/myserver_chain.crt
SSLProxyCACertificateFile certs/my_self_signed.pem
SSLProxyVerify none
SSLProxyCheckPeerName off
SSLProxyCheckPeerCN off
SSLProxyCheckPeerExpire off
SSLProtocol    -all +TLSv1
SSLProxyProtocol +SSLv3 +TLSv1 +TLSv1.1
#SSLCipherSuite ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:!NULL:RC4+RSA:+HIGH:+MEDIUM
ErrorLog "logs/abc-error.log"
CustomLog "logs/abc-access.log" cert

ProxyRequests Off  
# IE compatibility
Header set X-UA-Compatible "IE=EmulateIE8"
# Prevent page from being loaded within an IFrame (Cross-Frame Scripting protection)
Header always append X-Frame-Options SAMEORIGIN
# Prevent mime sniffing exploint ; disabled breaks PEM Popup image rendering
# Header set X-Content-Type-Options: nosniff
# Disable caching
Header set Cache-Control "no-cache, must-revalidate, private"
# Enable X-XSS-Protection
Header set X-XSS-Protection: "1; mode=block"
ProxyPass / https://myhost.domain/
ProxyPassReverse / https://myhost.domain/

It seems like using the following directives worked for many people, but doesnt seem to work for me似乎使用以下指令对很多人都有效,但似乎对我不起作用

SSLProxyVerify none SSLProxyVerify 无

SSLProxyCheckPeerName off SSLProxyCheckPeerName 关闭

SSLProxyCheckPeerCN off SSLProxyCheckPeerCN 关闭

SSLProxyCheckPeerExpire off SSLProxyCheckPeerExpire 关闭

Is there anything else i am missing.还有什么我想念的。

Any help is appreciated.任何帮助表示赞赏。

Thanks, Raj谢谢,拉吉

It seems that the error is not entirely connected to proxying.似乎该错误并不完全与代理有关。 The configuration is not entirely clear.配置不是很清楚。 I will assume that there are following three machines:我假设有以下三台机器:

  1. 'laptop' - you “笔记本电脑”——你
  2. 'proxy' - where the apache with your conf is running 'proxy' - 与您的 conf 一起运行的 apache
  3. 'oracle' - with some arbitrary webserver 'oracle' - 带有一些任意的网络服务器

I also assume that all DNS domains aim at the 'proxy' and the rest of the machines are accessed by IP adresses.我还假设所有 DNS 域都针对“代理”,其余的机器都可以通过 IP 地址访问。

The certification path you see from browser is only between 'laptop' and 'proxy'.您从浏览器看到的认证路径仅在“笔记本电脑”和“代理”之间。 If you are seeing invalid cert from browser, it meens the 'proxy' failed to authenticate to 'laptop'.如果您看到来自浏览器的无效证书,则意味着“代理”未能通过“笔记本电脑”的身份验证。 If 'oracle' could not identify itself towards 'proxy', the connection would fail outright, throwing 502 error.如果 'oracle' 无法向 'proxy' 标识自己,连接将彻底失败,抛出 502 错误。

So now, what to do next:那么现在,下一步该怎么做:

  • Check the certificate from the browser.从浏览器检查证书。 See whose cert it is.看看是谁的证书。
  • If it comes from 'oracle', it means you are not proxying the request at all.如果它来自“oracle”,则意味着您根本没有代理请求。 Make sure your DNS records aims at the 'proxy' machine.确保您的 DNS 记录针对“代理”机器。
  • If it comes from 'proxy', but the browser throws fit about wrong CN, you need to create certificate that also includes the 'oracle' domain and put it on the 'proxy' machine.如果它来自'proxy',但浏览器抛出错误的CN,则需要创建还包含'oracle'域的证书并将其放在'proxy'机器上。

In case none of it works, try to investigate at which point the following scenario fails:如果它都不起作用,请尝试调查以下场景在哪个点失败:

  1. Laptop asks DNS for 'oracle.domain.com'笔记本电脑向 DNS 请求“oracle.domain.com”
  2. DNS returns IP address for 'proxy' machine and sends request. DNS 返回“代理”机器的 IP 地址并发送请求。
  3. 'proxy' authenticates to you as provider of the 'oracle.domain.com' service “proxy”向您证明您是“oracle.domain.com”服务的提供者
  4. At this moment you get a green lock icon in browser.此时您会在浏览器中看到一个绿色的锁形图标。
  5. 'proxy' machine resolves the IP adress of the 'oracle' and sends request. “代理”机器解析“oracle”的IP地址并发送请求。
  6. 'oracle' authenticates towards 'proxy' with the self signed cert “oracle”使用自签名证书向“代理”进行身份验证
  7. content is returned from 'oracle' through 'proxy' to you.内容从“oracle”通过“proxy”返回给您。

Also, you should include the ' SSLProxyVerify require ' to make your config at least a bit secure.此外,您应该包括“ SSLProxyVerify require ”以使您的配置至少有点安全。

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

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