SSL (AEN 4.1.2)#
Anaconda Enterprise Notebooks (AEN) 服务器使用 NGINX
来代理所有传入的 http(s) 请求到运行在本地端口的服务器,以及 SSL 终止。默认设置使用 http(非 SSL),因为配置 SSL 需要证书文件,而每个企业都有自己的证书文件。
目前不支持带有密码的SSL证书。
www.enterprise.conf
文件是用于 Anaconda Enterprise Notebooks 的默认 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:
- Copy the Gateway certificate and key to
/opt/wakari/wakari-gateway/etc/
on the Gateway asgateway.crt
andgateway.key
. - Copy the Gateway CA bundle to
/opt/wakari/wakari-server/etc/
on the Server - Copy the Server certificate and key to
/etc/nginx
on the Server asserver.crt
andserver.key
- Copy the Server CA bundle to
/opt/wakari/wakari-gateway/etc/
on the Gateway
如果您有一个由私有根CA和/或中间机构签名的证书,则以下内容必须为真:
- 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.crt
和server.key
证书文件,但这些值必须更改为指向您域名的签名证书文件。
注意:自签名证书或由私有根CA签名的证书需要额外的配置。
以root
身份执行以下步骤:
停止
NGINX
:service nginx stop
将
/etc/nginx/conf.d/www.enterprise.conf
文件移动到备份目录- Copy the
/opt/wakari/wakari-server/lib/python2.7/site-packages/
将
wk_server/config/www.enterprise.https.conf
文件复制到/etc/nginx/conf.d
注意:在
/etc/nginx/conf.d
中只能存在www.enterprise.conf
或www.enterprise.https.conf
中的一个- Copy the
编辑 /etc/nginx/conf.d/www.enterprise.https.conf 文件,并将
server.crt
和server.key
的值更改为 实际证书和密钥文件的名称(如果它们不同)启动
NGINX
:service nginx start
更新配置文件中的
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
编辑
/opt/wakari/wakari-server/etc/wakari/wk-server-config.json
并添加"verify_gateway_certificate": "/opt/wakari/wakari-server/etc/gateway.crt"
在服务器上重新启动Anaconda Enterprise Notebooks服务:
service wakari-server restart
浏览到Anaconda Enterprise Notebooks并验证浏览器是否使用
https
。在管理员设置中,在
Data Centers
下选择Gateway
并勾选https
框。
注意:此步骤可能会返回错误,因为网关尚未配置为SSL。
在网关上配置SSL¶
编辑
/opt/wakari/wakari-compute/etc/wakari/config.json
将 http 改为 https修改
/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" } }
如果您有一个由私有根CA(和/或中间机构)签名的服务器证书,请将以下内容添加到
https
键中"ca": ["/opt/wakari/wakari-gateway/etc/server.crt"]
注意:
ca
键必须包含CA根路径、任何中间路径和服务器证书路径的单独值重启网关:
sudo service wakari-gateway restart
计算节点上的SSL¶
Anaconda Enterprise 不支持在计算节点上直接使用 SSL。
如果您需要在计算节点上使用 SSL,您必须将每个计算节点安装在作为网关的同一服务器上,
使用 http://localhost:5002
作为 URL 值
在将其添加为资源时,并且您必须为每个计算节点使用一个网关。
安全提醒¶
证书文件的权限需要正确设置,以防止被其他人读取。只有root用户需要读取证书文件的权限,因为NGINX
是由root用户运行的。
假设证书文件名为 server.crt
和 server.key
,
使用 root
账户设置权限如下:
chmod 600 server.key
chmod 600 server.crt
严格传输安全头¶
Strict-Transport-Security 默认在
www.enterprise.https.conf
文件中启用。
add_header Strict-Transport-Security max-age=31536000;
如果以下任一条件为真,则可以保持启用状态。
- The Gateway is running on a different host than the Server; or
- SSL has been enabled for the Gateway
如果同时满足以下两个条件,您需要注释掉这一行:
- The Gateway is running on the same host as the Server; and
- SSL has not been enabled for the Gateway
当这些条件为真时保持启用将导致服务器和网关之间的协议不匹配,应用程序将无法正确启动。