配置SSL (AEN 4.2.0)#

服务器节点使用NGINX来代理所有传入的http(s)请求到运行在本地端口的服务器,并使用NGINX进行SSL终止。默认设置使用http——非SSL——因为配置SSL需要证书文件,而每个企业都有自己的证书文件。

注意:目前不支持带有密码的SSL证书。

www.enterprise.conf 文件是用于 AEN 的默认 nginx.conf 文件。在服务器安装期间,它会被复制到 /etc/nginx/conf.d 目录中。

注意:本节介绍在您的网关节点已安装并注册到服务器节点后设置SSL的过程。

复制所需的文件

要在AEN上配置SSL,您将需要以下文件:

  • Server certificate and key
  • Server CA bundle
  • Gateway certificate and key
  • Gateway CA bundle

在AEN上配置SSL:

  1. Copy the Gateway certificate and key to /opt/wakari/wakari-gateway/etc/ on the Gateway as gateway.crt and gateway.key.
  2. Copy the Gateway CA bundle to /opt/wakari/wakari-server/etc/ on the Server.
  3. Copy the Server certificate and key to /etc/nginx on the Server as server.crt and server.key.
  4. Copy the Server CA bundle to /opt/wakari/wakari-gateway/etc/ on the Gateway.

如果您有一个由私有根证书颁发机构和/或中间机构签名的证书:

  • The Gateway CA bundle can contain the root CA, any intermediate authority and the certificate.
  • The Server CA bundle must be separated into individual files for the root CA, any intermediate and the certificate.

在服务器节点上配置SSL

www.enterprise.https.conf 是一个用于SSL的NGINX配置文件。它被设置为使用server.crtserver.key证书文件。

注意:您必须更改这些值以指向您域名的签名证书文件。

注意:自签名证书或由私有根CA签名的证书需要额外的配置。

以root身份执行以下步骤:

  1. 停止NGINX:

    service nginx stop
    
  2. /etc/nginx/conf.d/www.enterprise.conf文件移动到一个备份目录。

  3. 复制 /opt/wakari/wakari-server/etc/nginx/conf.d/www.enterprise.https.conf 文件到 /etc/nginx/conf.d

    注意:/etc/nginx/conf.d 可能包含 www.enterprise.confwww.enterprise.https.conf,但可能不会同时包含两者。

  4. 编辑 /etc/nginx/conf.d/www.enterprise.https.conf 文件,并将 server.crtserver.key 的值 更改为实际的证书和密钥文件的名称,如果它们不同的话。

  5. 通过运行以下命令重启NGINX:

    service nginx start
    
  6. 更新WAKARI_SERVER和CDN设置,在以下配置文件中使用https代替http:

    /opt/wakari/wakari-server/etc/wakari/config.json
    /opt/wakari/wakari-gateway/etc/wakari/wk-gateway-config.json
    /opt/wakari/wakari-compute/etc/wakari/config.json
    
  7. 将网关证书 gateway.crt 复制到服务器上的 /opt/wakari/wakari-server/etc/ 目录。

  8. 在编辑器中,打开 /opt/wakari/wakari-server/etc/wakari/wk-server-config.json 并添加:

    "verify_gateway_certificate": "/opt/wakari/wakari-server/etc/gateway.crt"
    
  9. 通过在服务器上运行以下命令来重启AEN服务:

    service wakari-server restart
    

    注意:此步骤可能会返回错误,因为网关尚未配置SSL。

  10. 在AEN中,验证浏览器是否使用https。在管理员设置页面,数据中心下,点击网关,然后选择https:

    ../../../../../_images/ae-notebooks/4.2.0/aen-install-https.png

在网关上配置SSL

  1. /opt/wakari/wakari-gateway/etc/wakari/wk-gateway-config.json 中,添加:

    {
        EXISTING_CONFIGURATION,
        "https": {
            "key": "/opt/wakari/wakari-gateway/etc/gateway.key",
            "cert": "/opt/wakari/wakari-gateway/etc/gateway.crt"
        }
    }
    
  2. 如果您有一个由私有根CA或中间机构签名的服务器证书,请添加:

    {
       EXISTING_CONFIGURATION,
       "https": {
           "key": "/opt/wakari/wakari-gateway/etc/gateway.key",
           "cert": "/opt/wakari/wakari-gateway/etc/gateway.crt",
           "ca": ["/opt/wakari/wakari-gateway/etc/server.crt"]
        }
     }
    

    注意:ca 密钥必须包含 CA 根路径、任何中间路径以及服务器证书路径的单独值。

  3. 重启网关:

    sudo service wakari-gateway restart
    

在计算节点上配置SSL

Anaconda Enterprise 不支持在计算节点上直接使用 SSL。 如果您需要在计算节点上使用 SSL,您必须将每个计算节点安装在作为网关的同一服务器上, 使用 http://localhost:5002 作为 URL 值 在将其添加为资源时,并且您必须为每个计算节点使用一个网关。

安全提醒

证书文件的权限必须正确设置,以防止被其他人读取。由于NGINX是由root用户运行的,因此只有root用户需要读取证书文件的权限。

示例:如果证书文件名为 server.crtserver.key,则使用 root 账户设置权限:

chmod 600 server.key
chmod 600 server.crt

启用或禁用Strict-Transport-Security头

默认情况下,Strict-Transport-Security (STS) 在 www.enterprise.https.conf 文件中启用:

add_header Strict-Transport-Security max-age=31536000;

如果以下任一条件为真,它可以保持启用状态:

  • 网关运行在与服务器不同的主机上。

  • 网关已启用SSL。

如果以下两个条件都成立,您必须注释掉这一行:

  • 网关与服务器运行在同一主机上。

  • 网关尚未启用SSL。

当这些条件为真时,保持STS启用将导致服务器和网关之间的协议不匹配,从而导致您的应用程序无法正确启动。