在 Overcloud 上部署 Fernet

Red Hat OpenStack Platform 16.2

在 Red Hat OpenStack Platform overcloud 上部署 Fernet

OpenStack Documentation Team

摘要

在 Red Hat OpenStack Platform overcloud 上部署 Fernet。

使开源包含更多

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。我们从这四个术语开始:master、slave、黑名单和白名单。由于此项工作十分艰巨,这些更改将在即将推出的几个发行版本中逐步实施。详情请查看 CTO Chris Wright 的信息

对红帽文档提供反馈

我们感谢您对文档提供反馈信息。与我们分享您的成功秘诀。

在 JIRA 中提供文档反馈

使用 Create Issue 表单对文档提供反馈。JIRA 问题将在 Red Hat OpenStack Platform Jira 项目中创建,您可以在其中跟踪您的反馈进度。

  1. 确保您已登录到 JIRA。如果您没有 JIRA 帐户,请创建一个帐户来提交反馈。
  2. 点击以下链接打开 Create Issue 页面: Create Issue
  3. 完成 SummaryDescription 字段。在 Description 字段中,包含文档 URL、章节或章节号以及问题的详细描述。不要修改表单中的任何其他字段。
  4. Create

第 1 章 在 overcloud 中使用 Fernet 密钥进行加密

Fernet 是默认的令牌提供程序,它取代 uuid。您可以查看 Fernet 部署并轮转 Fernet 密钥。Fernet 使用三种类型的密钥,它们存储在 /var/lib/config-data/puppet-generated/keystone/etc/keystone/fernet-keys 中。最高数字目录包含主密钥,它生成新的令牌并解密现有的令牌。

Fernet 密钥轮转使用以下过程:

  1. 主密钥成为辅助密钥。
  2. <system> 签发一个新的主密钥。轮转除的主密钥将不再有效。您可以使用辅助密钥解密与之前的主密钥关联的令牌,但您无法发布新的令牌。

当您决定 Fernet 密钥轮转周期的长度时,遵循您的组织的安全状况。如果您的组织没有指导,因为安全考虑,每月轮转周期是很好的做法。

1.1. 检查 Fernet 部署

要测试 Fernet 令牌是否正常工作,请检索 Controller 节点的 IP 地址,SSH 到 Controller 节点,然后检查令牌驱动程序和提供程序的设置。

流程

  1. 检索 Controller 节点的 IP 地址:

    [stack@director ~]$ source ~/stackrc
    [stack@director ~]$ openstack server list
    --------------------------------------------------------------------------------------------+
    | ID                                   | Name                    | Status | Networks            |
    --------------------------------------------------------------------------------------------+
    | 756fbd73-e47b-46e6-959c-e24d7fb71328 | overcloud-controller-0  | ACTIVE | ctlplane=192.0.2.16 |
    | 62b869df-1203-4d58-8e45-fac6cd4cfbee | overcloud-novacompute-0 | ACTIVE | ctlplane=192.0.2.8  |
    --------------------------------------------------------------------------------------------+
  2. SSH 到 Controller 节点:

    [heat-admin@overcloud-controller-0 ~]$ ssh heat-admin@192.0.2.16
  3. 检索令牌驱动程序和提供程序设置的值:

    [heat-admin@overcloud-controller-0 ~]$ sudo crudini --get /var/lib/config-data/puppet-generated/keystone/etc/keystone/keystone.conf token driver
    sql
    [heat-admin@overcloud-controller-0 ~]$ sudo crudini --get /var/lib/config-data/puppet-generated/keystone/etc/keystone/keystone.conf token provider
    fernet
  4. 测试 Fernet 供应商:

    [heat-admin@overcloud-controller-0 ~]$ exit
    [stack@director ~]$ source ~/overcloudrc
    [stack@director ~]$ openstack token issue
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    | Field | Value |
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    | expires | 2016-09-20 05:26:17+00:00 |
    | id | gAAAAABX4LppE8vaiFZ992eah2i3edpO1aDFxlKZq6a_RJzxUx56QVKORrmW0-oZK3-Xuu2wcnpYq_eek2SGLz250eLpZOzxKBR0GsoMfxJU8mEFF8NzfLNcbuS-iz7SV-N1re3XEywSDG90JcgwjQfXW-8jtCm-n3LL5IaZexAYIw059T_-cd8 |
    | project_id | 26156621d0d54fc39bf3adb98e63b63d |
    | user_id | 397daf32cadd490a8f3ac23a626ac06c |
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

    结果包括长的 Fernet 令牌。

1.2. 使用工作流服务轮转 Fernet 密钥

为确保在堆栈更新后保持 Fernet 密钥,请使用 Workflow 服务(mistral)轮转密钥。默认情况下,director 使用 ManageKeystoneFernetKeys 参数在环境文件中管理 overcloud Fernet 密钥。Fernet 密钥存储在工作流服务中,KeystoneFernetKeys 部分中。

流程

  1. 查看现有的 Fernet 密钥:

    1. 确定 Fernet 密钥位置。以 heat-admin 用户身份登录 Controller 节点,再使用 crudini 命令查询 Fernet 密钥:

      [stack@<undercloud_host> ~]$ ssh heat-admin@overcloud-controller-o
      [heat-admin@overcloud-controller-0 ~]$ sudo crudini --get /var/lib/config-data/puppet-generated/keystone/etc/keystone/keystone.conf fernet_tokens key_repository
      /etc/keystone/fernet-keys
      注意

      /etc/keystone/ 目录引用容器文件系统路径。

    2. 检查当前的 Fernet 密钥目录:

      [heat-admin@overcloud-controller-0 ~]$ sudo ls /var/lib/config-data/puppet-generated/keystone/etc/keystone/fernet-keys
      0  1  2
      • 0 - 包括 staged 密钥,它会变为下一个主密钥,并始终为 0
      • 1 - 包含辅助密钥。
      • 2 - 包含主密钥。每次密钥轮转时,这个数字都会递增。最高数字始终用作主密钥。

        注意
        • 使用 max_active_keys 属性设置最大键数。默认值为 5 密钥。
        • 密钥在所有 Controller 节点上传播。
  2. 使用 workflow 命令轮转 Fernet 密钥:

    [stack@director ~]$ source ~/stackrc
    [stack@director ~]$ openstack workflow execution create tripleo.fernet_keys.v1.rotate_fernet_keys {"container": "overcloud"}
    --------------------------------------------------------------+
    | Field             | Value                                     |
    --------------------------------------------------------------+
    | ID                | 58c9c664-b966-4f82-b368-af5ed8de5b47      |
    | Workflow ID       | 78f0990a-3d34-4bf2-a127-10c149bb275c      |
    | Workflow name     | tripleo.fernet_keys.v1.rotate_fernet_keys |
    | Description       |                                           |
    | Task Execution ID | <none>                                    |
    | State             | RUNNING                                   |
    | State info        | None                                      |
    | Created at        | 2017-12-20 11:13:50                       |
    | Updated at        | 2017-12-20 11:13:50                       |
    --------------------------------------------------------------+

验证

  1. 检索 ID,并确保工作流成功。

    [stack@director ~]$ openstack workflow execution show 58c9c664-b966-4f82-b368-af5ed8de5b47
    --------------------------------------------------------------+
    | Field             | Value                                     |
    --------------------------------------------------------------+
    | ID                | 58c9c664-b966-4f82-b368-af5ed8de5b47      |
    | Workflow ID       | 78f0990a-3d34-4bf2-a127-10c149bb275c      |
    | Workflow name     | tripleo.fernet_keys.v1.rotate_fernet_keys |
    | Description       |                                           |
    | Task Execution ID | <none>                                    |
    | State             | SUCCESS                                   |
    | State info        | None                                      |
    | Created at        | 2017-12-20 11:13:50                       |
    | Updated at        | 2017-12-20 11:15:00                       |
    --------------------------------------------------------------+
  2. 在 Controller 节点上,检查 Fernet 密钥的数量,并与前面的结果进行比较。

    [heat-admin@overcloud-controller-0 ~]$ sudo ls /var/lib/config-data/puppet-generated/keystone/etc/keystone/fernet-keys
    0  1  2  3
    • 0 - 包括 staged 密钥,始终为 0。这个密钥在下次轮转过程中成为主密钥。
    • 1 和 2 - 包含辅助密钥。
    • 3 - 包含主密钥。每次密钥轮转时,这个数字会递增。最高数字始终用作主密钥。

      注意
      • 使用 max_active_keys 属性设置最大键数。默认值为 5 密钥。
      • 密钥在所有 Controller 节点上传播。

法律通告

Copyright © 2024 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.