AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题

问题[sni](server)

Martin Hope
gelonida
Asked: 2021-06-30 17:13:34 +0800 CST

根据源 ip 选择一个 haproxy tcp 后端

  • 0

我有基本的 haproxy 知识,并且知道如何根据 SNI 服务器名称处理 tcp 后端的选择。

相关线路是

    acl is_myhost req.ssl_sni -i my.host.com
    acl is_otherhost req.ssl_sni -i other.host.com


    use_backend mybackend if is_myhost
    use_backend otherbackend if is_otherhost

现在我想将它们更改为允许我根据源 ip 选择后端的东西,但我不知道以下伪配置的确切语法或这是否可能

    acl is_myhost_for_specif req.ssl_sni -i my.host.com <and source ip = 1.2.3.4>
    acl is_myhost_for_others req.ssl_sni -i my.host.com <and source ip != 1.2.3.4>
    acl is_otherhost req.ssl_sni -i other.host.com


    use_backend mybackend1 if is_myhost_for_specific
    use_backend mybackend2 if is_myhost_for_others
    use_backend otherbackend if is_otherhost

ssl haproxy sni
  • 1 个回答
  • 609 Views
Martin Hope
FlexMcMurphy
Asked: 2020-12-24 14:48:50 +0800 CST

Nginx 和 https - 将 ip 地址指定为 server_name 会提供正确的网站但错误的证书

  • 2

我想运行这个网址:https ://192.168.1.254并在地址栏中获取一个具有正确内容和证书的网站。我正在获取该网站,但在地址栏中出现无效证书错误,因为该证书取自不同的服务器块:默认服务器块000-default.conf。

有人可以向我解释这种行为吗?

我的客户端浏览器是 Google Chrome 版本 87.0.4280.88 (Official Build) (64-bit)

我的 Nginx 服务器是:

root@OpenWrt:/etc/nginx/conf.d# nginx -V
nginx version: nginx/1.19.4 (x86_64-pc-linux-gnu)
built with OpenSSL 1.1.1h  22 Sep 2020
TLS SNI support enabled

我认为这个问题与 SNI 显然不允许将 Literal IPv4 和 IPv6 地址作为 "HostName" 的方式有关。但真的是这样吗?

我有一个默认服务器块000-default.conf,如下所示:

server {
    server_name _;
    listen 80 default_server;
    listen 443 ssl default_server;

    ## To also support IPv6, uncomment this block
    # listen [::]:80 default_server;
    # listen [::]:443 ssl default_server;

    ssl_certificate '/etc/nginx/conf.d/_lan.crt';
    ssl_certificate_key '/etc/nginx/conf.d/_lan.key';
    return 404; # or whatever
}

另一个名为 luci-http.conf 的服务器是这样的:

server {
        listen 80;
        listen [::]:80;
        server_name openwrt.lan 192.168.1.254;
        # access_log /proc/self/fd/1 openwrt; # use logd (init forwards stdout).
        include conf.d/*.locations;
}

当我将http://192.168.1.254放在地址栏中时,它会为我提供正确的网页。

我也有这个 https 服务器: luci-https.conf

server {
        listen 443 ssl;
        listen [::]:443 ssl;

        server_name openwrt.lan 192.168.1.254;
        #include '/var/lib/nginx/lan_ssl.listen.default';
        ssl_certificate '/etc/nginx/conf.d/_lan.crt';
        ssl_certificate_key '/etc/nginx/conf.d/_lan.key';
        ssl_session_cache 'shared:SSL:32k';
        ssl_session_timeout '64m';
        # access_log /proc/self/fd/1 openwrt; # use logd (init forwards stdout).
        include conf.d/*.locations;
}

当我将https://192.168.1.254放在地址栏中时,它会为我提供正确的网页和_lan.crt中的证书。如您所见,我在此和默认服务器块中有相同的证书/密钥对。

但是,当我从luci-https.conf中删除该 IP 地址作为 server_name并将其添加为 server_name 时:mysite.lan.conf我没有看到相同的行为。

server {
        listen 443 ssl;
        listen [::]:443 ssl;
        #listen 192.168.1.254 ssl;
        #include '/var/lib/nginx/lan_ssl.listen';

        server_name mysite.lan www.mysite.lan fun.mysite.lan 192.168.1.254;

        root /www/mysite;
        index index.html index.htm index.nginx-debian.html;

        ssl_certificate '/etc/nginx/conf.d/mysite.lan.crt';
        ssl_certificate_key '/etc/nginx/conf.d/mysite.lan.key';
        ssl_session_cache 'shared:SSL:32k';
        ssl_session_timeout '64m';

        location / {
                try_files $uri $uri/ =404;
        }

        access_log /var/log/nginx/mysite.lan.access.log;
        error_log /var/log/nginx/mysite.lan.error.log;
}

现在,当我将https://192.168.1.254放在地址栏中时,它会为我提供正确的网页,但再次是_lan.crt中的证书,而不是mysite.lan.conf中的mysite.lan.crt。

当我放..

ssl_certificate '/etc/nginx/conf.d/mysite.lan.crt';
ssl_certificate_key '/etc/nginx/conf.d/mysite.lan.key';

在默认服务器块000-default.conf中,然后当我将https://192.168.1.254放在浏览器地址栏中时,我得到了该证书,无论 192.168.1.254 是否被指定为luci-https.conf或mysite.lan中的 server_name .conf。

因此,SNI 似乎将匹配作为 IP 地址的“主机名”,但它从默认服务器块获取证书。这是为什么?

ssl nginx https sni
  • 1 个回答
  • 1818 Views
Martin Hope
Philipp
Asked: 2020-10-09 07:17:21 +0800 CST

HAProxy:SSL 终止,特定域通配符 SSL 证书请求例外

  • 1

我是 HAProxy 的新手,大部分部件都按预期工作。当前设置是:如果我将新站点添加到其中一个平衡(在 LB 之后)服务器,则证书由负载均衡器颁发和提供。所以 SSL Termination 可以正常使用常规 Let's Encrypt 证书,但是我正在使用的服务在此设置中存在限制:

如果我将新站点添加到平衡服务器并希望使用通配符*.wilddomain.com证书,则它不是由负载平衡器颁发,而是由平衡服务器 (10.0.0.10) 颁发。由于 LE 验证是通过 DNS 完成的,因此通配符证书现在有效并且可以在平衡服务器上使用。

因此,现在我有一个负载均衡器,其中包含几个正确使用的“常规”LE 证书,以及一个保存通配符证书的服务器。

我的问题是:如何将 HAProxy 设置为仅针对特定域 (wilddomain.com) 传递通配符证书,同时通过 SSL 终止直接从 LB 提供所有其他证书。

我目前的配置是这样的:

global
    log /dev/log        local0
    log /dev/log        local1 notice
    chroot /var/lib/haproxy
    stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners
    stats timeout 30s
    user haproxy
    group haproxy
    daemon

    # Default SSL material locations
    ca-base /etc/ssl/certs
    crt-base /etc/ssl/private

    # Default ciphers to use on SSL-enabled listening sockets.
    # For more information, see ciphers(1SSL). This list is from:
    #  https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/
    # An alternative list with additional directives can be obtained from
    #  https://mozilla.github.io/server-side-tls/ssl-config-generator/?server=haproxy
    ssl-default-bind-ciphers ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE->
    ssl-default-bind-options no-sslv3

defaults
    log global
    mode        http
    option      httplog
    option      dontlognull
    timeout connect 5000
    timeout client  50000
    timeout server  50000
    errorfile 400 /etc/haproxy/errors/400.http
    errorfile 403 /etc/haproxy/errors/403.http
    errorfile 408 /etc/haproxy/errors/408.http
    errorfile 500 /etc/haproxy/errors/500.http
    errorfile 502 /etc/haproxy/errors/502.http
    errorfile 503 /etc/haproxy/errors/503.http
    errorfile 504 /etc/haproxy/errors/504.http

# Default Let's Encrypt backend server used for renewals and requesting certificates
backend letsencrypt-backend
    server letsencrypt 127.0.0.1:8888

# Load balancer settings
frontend load-balancer
    bind *:80

    bind *:443 ssl crt /etc/ssl/domain1.com/domain1.com.pem crt /etc/ssl/domain2.com/domain1.com.pem

    redirect scheme https code 301 if !{ ssl_fc }

    # See if its an letsencrypt request
    acl letsencrypt-acl path_beg /.well-known/acme-challenge/
    use_backend letsencrypt-backend if letsencrypt-acl

    mode http
    default_backend webservers

# Backend webservers (the attached servers to the load balancer)
backend webservers
    balance roundrobin
    option forwardfor
    cookie SRVNAME insert
    http-request set-header X-Forwarded-Port %[dst_port]
    http-request add-header X-Forwarded-Proto https if { ssl_fc }

    # Server www1
    server www1 10.0.0.10:80 weight 1 check
    # Server www2
    server www2 10.0.0.11:80 weight 1 check

编辑我

通过将以下内容添加到上述配置中,我更进一步,但这会在 HAProxy 日志中产生“负载平衡器/2:SSL 握手失败”。

frontend wildcard_tcp
    bind *:443
    option tcplog
    mode tcp 

    tcp-request inspect-delay 5s
    tcp-request content accept if { req_ssl_hello_type 1 } 

    acl is_wilddomain req_ssl_sni -m end wilddomain.com

    use_backend wildcard_server_tcp  if is_wilddomain

backend wildcard_server_tcp
    mode tcp 
    server ssl-wildcard-server 10.0.0.10:443

这是一个合适且正确的解决方案吗?还是有更好/性能更好的?是否有可能拥有一个仅负责 ssl-offload 的非常基本的后端服务器?那么仅用于颁发、更新和提供证书吗?

非常感谢!

load-balancing haproxy lets-encrypt sni
  • 1 个回答
  • 2133 Views
Martin Hope
Bc96
Asked: 2020-08-14 05:26:49 +0800 CST

使用 SNI 的后缀 SSL

  • 0

I 将多个 SSL 证书分配给多个域的内容

我设法做到了:

通过创建单个通配符 SSL 证书(例如 mail.example.com、mail.example2.com 等)

但我希望每个域都有自己的 ssl 证书。

像 所以 smtpd_tls_cert_file = msql:/etc/postfix/pem smtpd_tls_key_file = mysql:/etc/postfix/key

SQL查询是

选择 dir From ssl where domain = "$1" limit 1;

mysql postfix sni
  • 1 个回答
  • 623 Views
Martin Hope
Dirty_Programmer
Asked: 2020-08-01 22:23:34 +0800 CST

纯 ftpd 中的 SNI

  • 0

我正在寻找纯 ftpd 中的 SNI 支持。我在这里找到了一些文档:https ://download.pureftpd.org/pub/pure-ftpd/doc/README.TLS

请阅读以上链接中的自定义证书处理程序部分。它指定了服务 pure-certd 的使用。但我找不到安装此服务的方法。

请帮助我找到安装它的方法。使用的操作系统是 Centos 7。 Pure-ftpd 版本:pure-ftpd v1.0.47 [privsep]

centos pureftpd sni
  • 1 个回答
  • 199 Views
Martin Hope
gelonida
Asked: 2020-04-03 16:14:13 +0800 CST

https 与 sni 两个证书 tho 服务器名称但相同的配置。我可以使用一个服务器块吗?

  • 1

我经常遇到以下问题。

我有一个 nginx 服务器通过 https 在同一个 IP 和同一个端口上提供两个主机名。每个主机名都有自己的证书。

到目前为止,我正在做的是有两种配置:

server {
    listen              443 ssl;
    server_name         www.example1.com;
    ssl_certificate     www.example1.com.crt;
    ssl_certificate_key www.example1.com.key;
    ssl_protocols       ...;
    ssl_ciphers         ...;
    ...
}

和

server {
    listen              443 ssl;
    server_name         www.example2.com;
    ssl_certificate     www.example2.com.crt;
    ssl_certificate_key www.example2.com.key;
    ssl_protocols       ...;
    ssl_ciphers         ...;
    ...
}

仅在一个服务器块中完成此操作有什么技巧吗?

我问的原因是,两台服务器共享名称和证书完全相同的配置。

到目前为止我所做的是:

server {
    listen              443 ssl;
    server_name         www.example1.com;
    ssl_certificate     www.example1.com.crt;
    ssl_certificate_key www.example1.com.key;
    include /etc/nginx/common_config/example1_and_2/*;
}

server {
    listen              443 ssl;
    server_name         www.example2.com;
    ssl_certificate     www.example2.com.crt;
    ssl_certificate_key www.example2.com.key;
    include /etc/nginx/common_config/example1_and_2/*;
}

这可以改进吗?有一些标准的建议吗?如果这很好,是否至少有关于这种常见配置文件的路径的建议?

nginx ssl-certificate sni
  • 1 个回答
  • 164 Views
Martin Hope
Álvaro González
Asked: 2017-03-04 05:17:19 +0800 CST

使用虚拟主机证书

  • 1

我正在尝试在基于名称的虚拟主机中启用 SSL。从文档中我了解到 SNI 不需要显式启用,如果服务器和客户端都符合最低要求,它会自动发生,我认为他们这样做:

  • Apache/2.4.25 (Win32)
  • OpenSSL/1.0.2k
  • 火狐/51.0.1 (x64)

我已将配置剥离到最低限度:

Listen 80

LoadModule ssl_module modules/mod_ssl.so


<VirtualHost *:80>
    ServerName localhost
    DocumentRoot "D:/Servidores/Apache/htdocs"
</VirtualHost>


Listen 443
SSLCipherSuite HIGH:MEDIUM:!MD5:!RC4
SSLProxyCipherSuite HIGH:MEDIUM:!MD5:!RC4
SSLHonorCipherOrder on
SSLProtocol all -SSLv3
SSLProxyProtocol all -SSLv3
SSLPassPhraseDialog builtin
SSLSessionCacheTimeout 300

<VirtualHost _default_:443>
    ServerName localhost
    DocumentRoot "D:/Servidores/Apache/htdocs"
    SSLEngine on
    SSLCertificateFile "D:/DOS/Apache24/conf/server.crt"
    SSLCertificateKeyFile "D:/DOS/Apache24/conf/server.key"
</VirtualHost>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin


<VirtualHost *:80>
    ServerName tmp
    DocumentRoot "D:/tmp"
</VirtualHost>
<VirtualHost *:443>
    ServerName tmp
    DocumentRoot "D:/tmp"
    SSLCertificateFile "D:/Servidores/Apache/certificados/tmp.crt"
    SSLCertificateKeyFile "D:/Servidores/Apache/certificados/tmp.key"
</VirtualHost>
C:\>httpd -f conf/prueba-test.conf

然而,当我尝试加载时,https://tmp/我总是从<VirtualHost _default_:443>(对于 host localhost)而不是从(对于ServerName tmphost )获取证书tmp。

这是记录的内容:

[Fri Mar 03 14:11:57.360237 2017] [ssl:warn] [pid 11684:tid 668] AH01906: tmp:80:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Fri Mar 03 14:11:57.361240 2017] [ssl:warn] [pid 11684:tid 668] AH01906: localhost:443:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Fri Mar 03 14:11:57.433220 2017] [ssl:warn] [pid 11684:tid 668] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
[Fri Mar 03 14:11:57.433220 2017] [ssl:warn] [pid 11684:tid 668] AH01906: tmp:80:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Fri Mar 03 14:11:57.434223 2017] [ssl:warn] [pid 11684:tid 668] AH01906: localhost:443:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Fri Mar 03 14:11:57.436228 2017] [mpm_winnt:notice] [pid 11684:tid 668] AH00455: Apache/2.4.25 (Win32) OpenSSL/1.0.2k configured -- resuming normal operations
[Fri Mar 03 14:11:57.436228 2017] [mpm_winnt:notice] [pid 11684:tid 668] AH00456: Apache Lounge VC14 Server built: Dec 17 2016 10:42:52
[Fri Mar 03 14:11:57.436228 2017] [core:notice] [pid 11684:tid 668] AH00094: Command line: 'httpd -d D:/DOS/Apache24 -f conf/prueba-ssl.conf'
[Fri Mar 03 14:11:57.444250 2017] [mpm_winnt:notice] [pid 11684:tid 668] AH00418: Parent: Created child process 15380
[Fri Mar 03 14:11:57.910024 2017] [ssl:warn] [pid 15380:tid 648] AH01906: localhost:443:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Fri Mar 03 14:11:57.988164 2017] [ssl:warn] [pid 15380:tid 648] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
[Fri Mar 03 14:11:57.988164 2017] [ssl:warn] [pid 15380:tid 648] AH01906: localhost:443:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Fri Mar 03 14:11:57.988164 2017] [mpm_winnt:notice] [pid 15380:tid 648] AH00354: Child: Starting 64 worker threads.

问题可能是什么?

ssl ssl-certificate apache-2.4 windows-10 sni
  • 2 个回答
  • 1868 Views
Martin Hope
Al Amin
Asked: 2017-01-20 22:37:00 +0800 CST

SNI 如何与谷歌应用引擎一起工作?

  • 1

我发现谷歌应用引擎在单个谷歌应用引擎应用程序中支持多个自定义域。可能可以使用多租户域/命名空间来完成。我想对那些多个自定义域使用 ssl。我通过 SNI 发现了它的可能。

现在我的问题是:-SNI 如何与谷歌应用引擎一起工作?- 我是否需要为每个域购买单独的 SSL 证书并将它们上传到谷歌应用引擎,谷歌将该机制称为 SNI?在那种情况下,每个域的 CSR 生成过程会怎样?

- 或者 SNI 是谷歌内部管理的东西,这样我就可以简单地添加我的域并从谷歌控制台为这些域应用 SNI,它就可以正常工作。

但我在谷歌控制台中没有看到 SNI 的任何部分。无论谷歌收取 SNI 费用还是费用。

有人可以简要解释一下谷歌应用引擎中的 SNI 配置过程吗?

ssl google-app-engine openssl sni
  • 1 个回答
  • 638 Views
Martin Hope
Cybran
Asked: 2016-12-21 02:56:42 +0800 CST

req.ssl_sni 的 haproxy 日志记录

  • 1

我正在尝试通过添加 [req.ssl_sni] 来扩展自定义 haproxy 日志格式。在 Ubuntu 上使用的 haproxy 版本是 1.6.3。

前端配置如下:

bind *:443
mode tcp

tcp-request inspect-delay 5s
tcp-request content accept if { req_ssl_hello_type 1 }
tcp-request content reject

log-format [...]{%[req.ssl_sni]}

Where[...]表示其他运行良好的日志选项。前端在 TCP 模式下运行,在不解密的情况下转发 TLS 会话。

预期的日志输出类似于{my.server.com}有效的 TLS 会话。我看到的日志输出始终是{-}(一个破折号而不是服务器名称),即使后端服务器成功处理了 TLS 会话。我必须更改什么才能在日志中查看实际的 SNI 值?

logging ssl haproxy sni
  • 2 个回答
  • 3127 Views
Martin Hope
agent provocateur
Asked: 2016-11-04 12:40:32 +0800 CST

SNI Apache SSL 证书

  • 0

对于 SNI Apache 设置:

是否可以:
为所有具有 URL 别名的虚拟主机使用一个安全证书

和

两者之间是否有区别:
为所有具有 URL 别名的虚拟主机使用一个安全证书
和为
每个虚拟主机使用一个安全证书

ssl-certificate apache-2.4 sni
  • 1 个回答
  • 149 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve