apache - 将 Apache 配置为 ASP.NET Core 非 SSL 应用程序的 HTTPS 反向代理是否存在安全问题?

标签 apache asp.net-core ssl ubuntu-16.04

我不确定这是否已准备好用于生产环境。
本质上,我的公共(public) URL (https://*.example.com) 有一个 SSL 证书,但我的 ASP.NET Core 2.1 应用程序(以及仅在端口 5000 上配置的 Kestrel 服务)从未配置为使用 HTTPS。

在 Apache 中,我配置了一个虚拟主机来将请求从端口 80 重定向到 443,然后另一个用于在后端将端口 443(传入)反向代理到 5000:

# Force usage of https for public requests
<VirtualHost *:80>
        ServerName aspnet01.example.com
        Redirect / https://aspnet01.example.com
</VirtualHost>

<VirtualHost *:443>
        ProxyPreserveHost On
        ProxyPass / http://127.0.0.1:5000/
        ProxyPassReverse / http://127.0.0.1:5000/
        ServerName aspnet01.example.com
        ServerAlias *.example.com
        ErrorLog /opt/bitnami/apache2/logs/aspnet01_error.log
        CustomLog /opt/bitnami/apache2/logs/aspnet01_access.log combined
</VirtualHost>

并且在防火墙上只有两个端口开放,80、443 和 22 用于服务器管理。 我想知道以这种方式发布我的应用程序有什么风险,我坚信来自外部的流量是加密的并且没有人在嗅探我的内部网络。

更一般地说,将旧应用程序(不使用 HTTPS)放在反向代理后面是否足以认为它是安全的?

我在 Ubuntu 16.04 上使用 LAMP。提前致谢。

最佳答案

Kestrel 应用程序的安全性取决于您的反向代理配置和网络,但这通常是一种可接受的安全处理方式,因为它减少了 Kestrel 和反向代理之间的网络开销。

根据 Microsoft 的文档:

A reverse proxy:

  • Can limit the exposed public surface area of the apps that it hosts.
  • Provide an additional layer of configuration and defense.
  • Might integrate better with existing infrastructure.
  • Simplify load balancing and secure communication (HTTPS) configuration. Only the reverse proxy server requires an X.509 certificate, and that server can communicate with the app's servers on the internal network using plain HTTP.

https://learn.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel?view=aspnetcore-3.1#when-to-use-kestrel-with-a-reverse-proxy

关于apache - 将 Apache 配置为 ASP.NET Core 非 SSL 应用程序的 HTTPS 反向代理是否存在安全问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61915089/

相关文章:

php - 未指定输入文件 - apache 和 php-fastcgi

基于环境变量的 Apache VirtualHost 有条件

c# - 在 ASP.NET Core 中允许 Cors Origin

security - WSO2:我的 keystore 已添加到碳中,但在启动时未加载

apache - Nginx vs Apache 用于高流量站点

ruby - 进入域后如何配置静默登录Redmine?

python - 收到此错误 :SSLError: [SSL] PEM lib (_ssl. c:2515)

web-applications - 如何验证安全 https 页面加载时没有任何浏览器警告?

asp.net-core - 如何拥有与 "Id"不同名称的主键

azure - 从 Visual Studio Online 将 ASP.NET 5 构建到 Azure 网站 ERROR_FILE_IN_USE