环境:
openstack版本:N版
部署方式:kolla(所有服务都运行在docker里面)
说明:kolla部署因为用了vip所以在每个节点上都运行了haproxy容器,每个节点都监听了vip:80,vip:9696,vip:8774,
vip:5000,vip:35357等端口,haproxy代理了每个节点各个服务,所以如果想把http变为https,只需改haproxy
就行了,当然还要改各个服务的配置文件,使其调用https。因为多了haproxy这一层,所以https也可以加在haproxy
这层,同时设置haproxy开启ssl,也可以加在后端服务上,让haproxy只起转发的功能
方法一,修改后段服务
1)、配置horizon为https访问
注意:我们使用自签名证书,生成证书时输入的Common Name要能匹配horizon的域名。
1. yum install mod_ssl openssl
2. openssl genrsa -out horizon.key 2048
3. openssl req -new -key horizon.key -out horizon.csr(生成证书)
4. openssl x509 -req -days 3650 -in horizon.csr -signkey horizon.key -out horizon.crt
5. cp horizon.crt /etc/pki/tls/certs/
6. cp horizon.key /etc/pki/tls/private/
7. cp horizon.csr /etc/pki/tls/private/
8. 在宿主机修改httpd的horizon的配置文件:vim /etc/kolla/horizon/horizon.conf
Listen 10.55.0.45:443
#Listen 10.55.0.45:80 # 1
#<VirtualHost *:80> # 2 打开1和2两处的配置可监听80,并转到https上
# RewriteEngine On
# RewriteCond %{HTTPS} !on
# RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
#</VirtualHost>
<VirtualHost *:443>
# Logging
LogLevel warn
ErrorLog /var/log/kol
openstack版本:N版
部署方式:kolla(所有服务都运行在docker里面)
说明:kolla部署因为用了vip所以在每个节点上都运行了haproxy容器,每个节点都监听了vip:80,vip:9696,vip:8774,
vip:5000,vip:35357等端口,haproxy代理了每个节点各个服务,所以如果想把http变为https,只需改haproxy
就行了,当然还要改各个服务的配置文件,使其调用https。因为多了haproxy这一层,所以https也可以加在haproxy
这层,同时设置haproxy开启ssl,也可以加在后端服务上,让haproxy只起转发的功能
方法一,修改后段服务
1)、配置horizon为https访问
注意:我们使用自签名证书,生成证书时输入的Common Name要能匹配horizon的域名。
1. yum install mod_ssl openssl
2. openssl genrsa -out horizon.key 2048
3. openssl req -new -key horizon.key -out horizon.csr(生成证书)
4. openssl x509 -req -days 3650 -in horizon.csr -signkey horizon.key -out horizon.crt
5. cp horizon.crt /etc/pki/tls/certs/
6. cp horizon.key /etc/pki/tls/private/
7. cp horizon.csr /etc/pki/tls/private/
8. 在宿主机修改httpd的horizon的配置文件:vim /etc/kolla/horizon/horizon.conf
Listen 10.55.0.45:443
#Listen 10.55.0.45:80 # 1
#<VirtualHost *:80> # 2 打开1和2两处的配置可监听80,并转到https上
# RewriteEngine On
# RewriteCond %{HTTPS} !on
# RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
#</VirtualHost>
<VirtualHost *:443>
# Logging
LogLevel warn
ErrorLog /var/log/kol