OpenStack Dalmatian : Barbican 設定2024/10/11 |
OpenStack Key Manager Service(Barbican)をインストールします。 当例では以下のような環境を例に Control ノードに Barbican をインストールして利用できるよう設定します。 ------------+--------------------------+--------------------------+------------ | | | eth0|10.0.0.30 eth0|10.0.0.50 eth0|10.0.0.51 +-----------+-----------+ +-----------+-----------+ +-----------+-----------+ | [ dlp.srv.world ] | | [ network.srv.world ] | | [ node01.srv.world ] | | (Control Node) | | (Network Node) | | (Compute Node) | | | | | | | | MariaDB RabbitMQ | | Open vSwitch | | Libvirt | | Memcached Nginx | | Neutron Server | | Nova Compute | | Keystone httpd | | OVN-Northd | | Open vSwitch | | Glance Nova API | | Nginx iSCSI Target | | OVN Metadata Agent | | Cinder API | | Cinder Volume | | 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 | aff8e7e402dc4d9e849bbe0e34fa4538 | | domain_id | default | | email | None | | enabled | True | | id | d4378723dc5b4c8eb67a1c8029b07d3d | | name | barbican | | description | None | | 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 | +-------------+----------------------------------+ | id | cac3f1c6134140ef9c78648be7a064dc | | name | barbican | | type | key-manager | | enabled | True | | description | OpenStack Key Manager | +-------------+----------------------------------+ # Barbican API ホストを定義 [root@dlp ~(keystone)]# export controller=dlp.srv.world
# [barbican] 用エンドポイント作成 (public) [root@dlp ~(keystone)]# openstack endpoint create --region RegionOne key-manager public https://$controller:9311 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 273ac6a1c1864c5db3b9ff58f2ba8641 | | interface | public | | region | RegionOne | | region_id | RegionOne | | service_id | cac3f1c6134140ef9c78648be7a064dc | | service_name | barbican | | service_type | key-manager | | url | https://dlp.srv.world:9311 | +--------------+----------------------------------+ # [barbican] 用エンドポイント作成 (internal) [root@dlp ~(keystone)]# openstack endpoint create --region RegionOne key-manager internal https://$controller:9311 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 4447525b62554ecfb936f51d031394eb | | interface | internal | | region | RegionOne | | region_id | RegionOne | | service_id | cac3f1c6134140ef9c78648be7a064dc | | service_name | barbican | | service_type | key-manager | | url | https://dlp.srv.world:9311 | +--------------+----------------------------------+ # [barbican] 用エンドポイント作成 (admin) [root@dlp ~(keystone)]# openstack endpoint create --region RegionOne key-manager admin https://$controller:9311 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 33feb1016b554112aa2ef99f0331b287 | | interface | admin | | region | RegionOne | | region_id | RegionOne | | service_id | cac3f1c6134140ef9c78648be7a064dc | | service_name | barbican | | service_type | key-manager | | url | https://dlp.srv.world:9311 | +--------------+----------------------------------+ |
[2] | Barbican 用のユーザーとデータベースを MariaDB に作成しておきます。 |
[root@dlp ~(keystone)]# mysql Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 128 Server version: 10.11.6-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)]> exit Bye |
[3] | Barbican サービスをインストールします。 |
[root@dlp ~(keystone)]# dnf --enablerepo=centos-openstack-dalmatian,epel,crb -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] host_href = https://dlp.srv.world:9311 log_file = /var/log/barbican/api.log # RabbitMQ 接続情報 transport_url = rabbit://openstack:password@dlp.srv.world [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=' # MariaDB 接続情報 [database] connection = mysql+pymysql://barbican:password@dlp.srv.world/barbican # Keystone 認証情報 [keystone_authtoken] www_authenticate_uri = https://dlp.srv.world:5000 auth_url = https://dlp.srv.world:5000 memcached_servers = dlp.srv.world:11211 auth_type = password project_domain_name = Default user_domain_name = Default project_name = service username = barbican password = servicepassword # httpd Keystone で自己署名の証明書を使用の場合は [true] insecure = false [oslo_policy] enforce_new_defaults = true
[root@dlp ~(keystone)]#
vi /etc/barbican/gunicorn-config.py # 3行目 : 変更 bind = '127.0.0.1:9311'[root@dlp ~(keystone)]# chmod 644 /etc/barbican/barbican.conf |
[5] | Nginx にプロキシの設定をします。 |
[root@dlp ~(keystone)]#
vi /etc/nginx/nginx.conf # [stream] セクション内に追記
stream {
upstream glance-api {
server 127.0.0.1:9292;
}
server {
listen 10.0.0.30:9292 ssl;
proxy_pass glance-api;
}
upstream nova-api {
server 127.0.0.1:8774;
}
server {
listen 10.0.0.30:8774 ssl;
proxy_pass nova-api;
}
upstream nova-metadata-api {
server 127.0.0.1:8775;
}
server {
listen 10.0.0.30:8775 ssl;
proxy_pass nova-metadata-api;
}
upstream placement-api {
server 127.0.0.1:8778;
}
server {
listen 10.0.0.30:8778 ssl;
proxy_pass placement-api;
}
upstream novncproxy {
server 127.0.0.1:6080;
}
server {
listen 10.0.0.30:6080 ssl;
proxy_pass novncproxy;
}
upstream cinder-api {
server 127.0.0.1:8776;
}
server {
listen 10.0.0.30:8776 ssl;
proxy_pass cinder-api;
}
upstream barbican-api {
server 127.0.0.1:9311;
}
server {
listen 10.0.0.30:9311 ssl;
proxy_pass barbican-api;
}
ssl_certificate "/etc/letsencrypt/live/dlp.srv.world/fullchain.pem";
ssl_certificate_key "/etc/letsencrypt/live/dlp.srv.world/privkey.pem";
}
|
[6] | SELinux を有効にしている場合は、ポリシーの変更が必要です。 |
[root@dlp ~(keystone)]# semanage port -a -t http_port_t -p tcp 9311 |
[7] | Firewalld を有効にしている場合は、サービスポートの許可が必要です。 |
[root@dlp ~(keystone)]# firewall-cmd --add-port=9311/tcp success [root@dlp ~(keystone)]# firewall-cmd --runtime-to-permanent success |
[8] | データベースにデータを追加して Barbican サービスを起動します。 |
[root@dlp ~(keystone)]# su -s /bin/bash barbican -c "barbican-manage db upgrade" [root@dlp ~(keystone)]# systemctl enable --now openstack-barbican-api [root@dlp ~(keystone)]# systemctl restart nginx |
Sponsored Link |