CentOS Stream 8
Sponsored Link

OpenStack Xena : Barbican 設定2021/11/24

 
OpenStack Key Manager Service(Barbican)をインストールします。
当例では以下のような環境を例に Control ノードに Barbican をインストールして利用できるよう設定します。
------------+---------------------------+---------------------------+------------
            |                           |                           |
        eth0|10.0.0.30              eth0|10.0.0.50              eth0|10.0.0.51
+-----------+-----------+   +-----------+-----------+   +-----------+-----------+
|    [ Control Node ]   |   |    [ Network Node ]   |   |    [ Compute Node ]   |
|                       |   |                       |   |                       |
|  MariaDB    RabbitMQ  |   |      Open vSwitch     |   |        Libvirt        |
|  Memcached  httpd     |   |     Neutron Server    |   |     Nova Compute      |
|  Keystone   Glance    |   |       OVN-Northd      |   |      Open vSwitch     |
|  Nova API             |   |     Cinder Volume     |   |   OVN Metadata Agent  |
|  Cinder API           |   |      iSCSI Target     |   |     OVN-Controller    |
|  Barbican API         |   |     Heat API/Engine   |   |                       |
+-----------------------+   +-----------------------+   +-----------------------+

[1] Control ノードの Keystone に Barbican 用のユーザー等々を登録しておきます。
# [service] プロジェクト所属で [barbican] ユーザーを作成

[root@dlp ~(keystone)]#
openstack user create --domain default --project service --password servicepassword barbican

+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| default_project_id  | 7e53ef14eb894f379ea1929f5defc949 |
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 5064c0eeedeb4c39a1ce9afa23abf903 |
| name                | barbican                         |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+

# [barbican] ユーザーを [admin] ロール に加える

[root@dlp ~(keystone)]#
openstack role add --project service --user barbican admin
# [barbican] 用サービスエントリ作成

[root@dlp ~(keystone)]#
openstack service create --name barbican --description "OpenStack Key Manager" key-manager

+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Key Manager            |
| enabled     | True                             |
| id          | ec569b12b83045d187bc124062ca096b |
| name        | barbican                         |
| type        | key-manager                      |
+-------------+----------------------------------+

# Barbican API ホストを定義

[root@dlp ~(keystone)]#
export controller=10.0.0.30
# [barbican] 用エンドポイント作成 (public)

[root@dlp ~(keystone)]#
openstack endpoint create --region RegionOne key-manager public http://$controller:9311

+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 0aa55ed715ee4c14b15021464bd7b769 |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | ec569b12b83045d187bc124062ca096b |
| service_name | barbican                         |
| service_type | key-manager                      |
| url          | http://10.0.0.30:9311            |
+--------------+----------------------------------+

# [barbican] 用エンドポイント作成 (internal)

[root@dlp ~(keystone)]#
openstack endpoint create --region RegionOne key-manager internal http://$controller:9311

+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 1da0a9fb18fa499a94f2ca528ce6a514 |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | ec569b12b83045d187bc124062ca096b |
| service_name | barbican                         |
| service_type | key-manager                      |
| url          | http://10.0.0.30:9311            |
+--------------+----------------------------------+

# [barbican] 用エンドポイント作成 (admin)

[root@dlp ~(keystone)]#
openstack endpoint create --region RegionOne key-manager admin http://$controller:9311

+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 4826cf9d26c84c3e9baed5a795452db8 |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | ec569b12b83045d187bc124062ca096b |
| service_name | barbican                         |
| service_type | key-manager                      |
| url          | http://10.0.0.30:9311            |
+--------------+----------------------------------+
[2] Barbican 用のユーザーとデータベースを MariaDB に作成しておきます。
[root@dlp ~(keystone)]#
mysql

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 130
Server version: 10.5.9-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database barbican; 
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant all privileges on barbican.* to barbican@'localhost' identified by 'password'; 
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> grant all privileges on barbican.* to barbican@'%' identified by 'password'; 
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> flush privileges; 
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> exit 
Bye
[3] Barbican サービスをインストールします。
# Xena, EPEL, PowerTools からインストール

[root@dlp ~(keystone)]#
dnf --enablerepo=centos-openstack-xena,powertools,epel -y install openstack-barbican
[4] Barbican の基本設定です。
[root@dlp ~(keystone)]#
mv /etc/barbican/barbican.conf /etc/barbican/barbican.conf.org

[root@dlp ~(keystone)]#
vi /etc/barbican/barbican.conf
# 新規作成

[DEFAULT]
bind_host = 0.0.0.0
bind_port = 9311
host_href = http://10.0.0.30:9311
log_file = /var/log/barbican/api.log
# MariaDB 接続情報
sql_connection = mysql+pymysql://barbican:password@10.0.0.30/barbican
# RabbitMQ 接続情報
transport_url = rabbit://openstack:password@10.0.0.30

[oslo_policy]
policy_file = /etc/barbican/policy.json
policy_default_rule = default

[secretstore]
namespace = barbican.secretstore.plugin
enabled_secretstore_plugins = store_crypto

[crypto]
namespace = barbican.crypto.plugin
enabled_crypto_plugins = simple_crypto

[simple_crypto_plugin]
kek = 'YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoxMjM0NTY='

# Keystone 認証情報
[keystone_authtoken]
www_authenticate_uri = http://10.0.0.30:5000
auth_url = http://10.0.0.30:5000
memcached_servers = 10.0.0.30:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = barbican
password = servicepassword

[root@dlp ~(keystone)]#
chmod 644 /etc/barbican/barbican.conf

[root@dlp ~(keystone)]#
su -s /bin/bash barbican -c "barbican-manage db upgrade"

[root@dlp ~(keystone)]#
systemctl enable --now openstack-barbican-api

[5] Firewalld を有効にしている場合は、サービスポートの許可が必要です。
[root@dlp ~(keystone)]#
firewall-cmd --add-port=9311/tcp

success
[root@dlp ~(keystone)]#
firewall-cmd --runtime-to-permanent

success
関連コンテンツ