Haproxy ssl配置 - 安装根证书和中间证书
经过大量的谷歌搜索,我终于使我的haproxy ssl工作。但现在我得到了问题,因为根和中间证书没有安装,所以我的ssl没有绿色条。Haproxy ssl配置 - 安装根证书和中间证书
我HAProxy的配置
global
maxconn 4096
nbproc 1
#debug
daemon
log 127.0.0.1 local0
defaults
mode http
option httplog
log global
timeout connect 5000ms
timeout client 50000ms
timeout server 50000ms
frontend unsecured
bind 192.168.0.1:80
timeout client 86400000
reqadd X-Forwarded-Proto:\ http
default_backend www_backend
frontend secured
mode http
bind 192.168.0.1:443 ssl crt /etc/haproxy/cert.pem
reqadd X-Forwarded-Proto:\ https
default_backend www_backend
backend www_backend
mode http
balance roundrobin
#cookie SERVERID insert indirect nocache
#option forwardfor
server server1 192.168.0.2:80 weight 1 maxconn 1024 check
server server2 192.168.0.2:80 weight 1 maxconn 1024 check
192.168.0.1是我的负载平衡器IP。 /etc/haproxy/cert.pem包含私钥和域证书,例如。 www.domain.com
有another question with ssl configuration,其中包括bundle.crt。当我联系我的SSL支持时,他们告诉我我需要安装根证书和中级证书。
从Comodo Documentation,创建捆绑包很简单,因为合并他们的crt,我做了。
但是当我试图重新配置我的HAProxy的配置为
,我不能使用的配置参数上绑定bind 192.168.0.1:443 ssl crt /etc/haproxy/cert.pem ca-file /path/to/bundle.crt
即时得到错误。
p.s im使用1.5 dev12版本。随着最新版本dev17我有问题,甚至开始HAProxy的as on this post
它看起来你需要重新编译,像这样:
make clean
make \
TARGET="linux26" \
USE_STATIC_PCRE=1 \
USE_OPENSSL=1
make install PREFIX="/opt/haproxy"
之后,bind
应该认识到你的CRT选项。 就我而言,我用:
bind 0.0.0.0:443 ssl crt /envs/production/ssl/haproxy.pem
我串联所有的SSL文件放入的顺序证书链1个大文件,私钥。例如: -
-----BEGIN MY CERTIFICATE-----
-----END MY CERTIFICATE-----
-----BEGIN INTERMEDIATE CERTIFICATE-----
-----END INTERMEDIATE CERTIFICATE-----
-----BEGIN INTERMEDIATE CERTIFICATE-----
-----END INTERMEDIATE CERTIFICATE-----
-----BEGIN ROOT CERTIFICATE-----
-----END ROOT CERTIFICATE-----
-----BEGIN RSA PRIVATE KEY-----
-----END RSA PRIVATE KEY-----
重新启动,测试与openssl s_client -connect 127.0.0.1:443 -servername www.transloadit.com |head
。
它应该返回正确的证书信息。
编辑:我刚刚通过HackerNews发现本教程:https://serversforhackers.com/c/using-ssl-certificates-with-haproxy。认为添加更多细节会很有用。
虐待尝试,但你可以告诉我我的证书订单,https://support.comodo.com/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=1209 – 2013-03-06 18:09:08
已更新答案,以显示确切的顺序证书。 – kvz 2013-03-21 15:52:59
没有必要发送根证书,因为客户端在其信任存储中拥有该证书,否则它将不被信任。 – 2016-07-26 21:54:38
对不起,我不知道哪HAProxy的版本是可用的USE_OPENSSL选项...我无法找到我的代码库选项为V 1.4.24
Valid USE_* options are the following. Most of them are automatically set by
# the TARGET, others have to be explictly specified :
# USE_CTTPROXY : enable CTTPROXY on Linux (needs kernel patch).
# USE_DLMALLOC : enable use of dlmalloc (see DLMALLOC_SRC) patch).
# USE_EPOLL : enable epoll() on Linux 2.6. Automatic. patch).
# USE_GETSOCKNAME : enable getsockname() on Linux 2.2. Automatic. patch).
# USE_KQUEUE : enable kqueue() on BSD. Automatic. patch).
# USE_MY_EPOLL : redefine epoll_* syscalls. Automatic. patch).
# USE_NETFILTER : enable netfilter on Linux. Automatic.patch).
# USE_PCRE : enable use of libpcre for regex. Recommended.patch).
# USE_POLL : enable poll(). Automatic.patch).
# USE_REGPARM : enable regparm optimization. Recommended on x86.patch).
# USE_SEPOLL : enable speculative epoll(). Automatic.patch).
# USE_STATIC_PCRE : enable static libpcre. Recommended.patch).
# USE_TPROXY : enable transparent proxy. Automatic. patch).
# USE_LINUX_TPROXY : enable full transparent proxy. Automatic. patch).
# USE_LINUX_SPLICE : enable kernel 2.6 splicing. Automatic. patch).
# USE_LIBCRYPT : enable crypted passwords using -lcrypt patch).
# USE_CRYPT_H : set it if your system requires including crypt.h
尝试1.5+版本不是1.4+。但是1。5仍然是“开发”版本,但它在我的生产中正常工作 – 2013-10-27 17:26:55
截至2014年6月19日,HAProxy 1.5 stable已发布 – kvz 2014-07-15 09:49:18
你应该[关闭的SSLv3(HTTP:/ /blog.haproxy.com/2014/10/15/haproxy-and-sslv3-poodle-vulnerability/)with bind 192.168.0.1:443 ssl crt /etc/haproxy/cert.pem ca-file/path/to/bundle.crt no-sslv3' – 2016-12-15 11:57:28