使用样书管理证书库中的 SSL 证书
NetScaler 控制台证书存储可帮助您在一个位置存储和管理 SSL 证书。因此,您可以将 SSL 证书存储在 NetScaler 控制台中,并在配置 NetScaler 期间重复使用它们。
本文介绍如何创建样书定义,允许您上载和重用 NetScaler 控制台证书存储区中的 SSL 证书。
参数
样书 定义支持 certkey 作为新的内置参数类型。使用此参数类型可重用 NetScaler 控制台证书存储库中的 SSL 证书。
parameters: - name: certificate label: Certificate description: "Certificate to be bound to this virtual load balanced application" type: certkey required: true <!--NeedCopy--> 在此示例中,证书参数是指来自 NetScaler 控制台证书存储库的 SSL 证书或证书链。
在 样书 定义中,您可以引用 certkey 参数的以下属性:
-
certkeyname— 要在实例上配置的 SSL 证书密钥的名称。 -
cert_filename— SSL 证书的文件名。 -
password— 必要时访问 SSL 证书所需的密码。 -
key_filename— SSL 证书密钥的文件名。 -
keyfile_contents— SSL 证书的文件内容。 -
subject— SSL 证书中提到的主题。 -
issuer— 它指颁发 SSL 证书的颁发机构。 -
certchain_certkeyname— 有时,服务器证书由多个分层证书颁发机构 (CA) 签署,这意味着证书形成链。当证书存储有证书链时,使用此属性。它可以帮助您将证书引用和绑定在一起。创建配置包时,证书链显示为列表。
这些属性可帮助您在 样书 定义中创建所需的组件。
组件
当样书有 参数时type: certkey,样书用户可以从 NetScaler 控制台证书存储库中为该参数提供证书。在此工作流程中,除了从 NetScaler 控制台证书存储库中查看和选择证书外,用户还可以执行以下操作:
- 上载新证书。
- 更新现有证书。例如,过期的证书。
- 移除证书。
备注
您还可以使用 NetScaler 控制台SSL 控制面板管理 NetScaler 控制台证书存储库中的证书。
在 NetScaler 控制台证书存储库中更新 SSL 证书时,与 SSL 证书关联的配置包会自动更新。
构建您的样书
以下是样书定义示例。它是一个使用来自 NetScaler 控制台证书存储库的 SSL 证书的完整定义。该样书包含将主证书和密钥文件上载到 NetScaler 实例的组件。如果这些文件已经存在于 NetScaler 实例上,则 NetScaler 控制台将跳过上载步骤,这些组件将不起作用。
name: lb-with-cert-from-certstore namespace: com.example.stylebooks version: "1.0" display-name: Application using a CertStore certificate description: This StyleBook defines a simple SSL Vserver. schema-version: "1.0" import-stylebooks: - namespace: netscaler.nitro.config version: "13.0" prefix: ns parameters: - name: name type: string label: Application Name description: Give a name to the application configuration. required: true - name: ip type: ipaddress label: Application Virtual IP (VIP) description: The Application VIP that clients access required: true - name: certificate label: Application Certificate description: Certificate chain and key to be bound to this application type: certkey required: true components: - name: pem-cert-files-comp type: ns::systemfile description: This component uploads the PEM certificate file onto the NetScaler condition: $parameters.certificate properties: filename: $parameters.certificate.cert_filename filelocation: /nsconfig/ssl filecontent: base64($parameters.certificate.certfile_contents) fileencoding: BASE64 - name: pem-KEY-files-comp type: ns::systemfile description: This component uploads the PEM key file onto the NetScaler. condition: $parameters.certificate properties: filename: $parameters.certificate.key_filename filelocation: /nsconfig/ssl filecontent: base64($parameters.certificate.keyfile_contents) fileencoding: BASE64 - name: cert-files-comp type: ns::sslcertkey description: This component creates the certkey on the NetScaler using the uploaded files. condition: $parameters.certificate properties: certkey: $parameters.certificate.certkeyname cert: $parameters.certificate.cert_filename key: $parameters.certificate.key_filename - name: lbvserver-comp type: ns::lbvserver description: This component creates the lbvserver of the application. properties: name: $parameters.name + "-lbvserver" servicetype: SSL ipv46: $parameters.ip port: 443 lbmethod: ROUNDROBIN components: - name: sslvserver-comp type: ns::sslvserver description: This component configures SSL settings on the vserver properties: vservername: $parent.properties.name ssl3?: ENABLED tls1?: ENABLED tls11?: ENABLED - name: cert-bindings-adv-comp type: ns::sslvserver_sslcertkey_binding description: This component binds the certkey to the vserver condition: $parameters.certificate properties: vservername: $parent.properties.name certkeyname: $parameters.certificate.certkeyname <!--NeedCopy-->