CentOS 7
Sponsored Link

OpenStack Ocata : Configure Barbican2017/03/26

 
Install OpenStack Key Manager Service (Barbican).
This example is based on the environment like follows.
Install and Configure Barbican API on Control Node as an example.
     ------------+--------------------------------+--------------------------------+------------
                 |                                |                                |
             eth0|10.0.0.30                   eth0|10.0.0.50                   eth0|10.0.0.51
     +-----------+-----------+        +-----------+-----------+        +-----------+-----------+
     |    [ Control Node ]   |        |    [ Storage Node ]   |        |    [ Compute Node ]   |
     |                       |        |                       |        |                       |
     |  MariaDB    RabbitMQ  |        |      Open vSwitch     |        |        Libvirt        |
     |  Memcached  httpd     |        |  L2,L3,Metadata Agent |        |      Nova Compute     |
     |  Keystone   Glance    |        |     Cinder-Volume     |        |      Open vSwitch     |
     |  Nova API             |        |                       |        |        L2 Agent       |
     |  Neutron Server       |        |                       |        |                       |
     |  Cinder API           |        |                       |        |                       |
     |  Barbican API         |        |                       |        |                       |
     +-----------------------+        +-----------------------+        +-----------------------+

[1] Add a User or Endpoint for Barbican to Keystone on Control Node.
# add barbican user (set in service project)

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

+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| default_project_id  | 18ba3488fac4462dbdc5689109386c36 |
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 4240618a605b4d0cafcb032c64069dd5 |
| name                | barbican                         |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+

# add barbican user in admin role

[root@dlp ~(keystone)]#
openstack role add --project service --user barbican admin
# add service entry for barbican

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

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

# define Barbican API host

[root@dlp ~(keystone)]#
export controller=10.0.0.30
# add endpoint for barbican (public)

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

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

# add endpoint for barbican (internal)

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

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

# add endpoint for barbican (admin)

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

+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 4e033e97bd824c66a673bd915ff46c82 |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 6333f5668c324c35ae6ec43f97217039 |
| service_name | barbican                         |
| service_type | key-manager                      |
| url          | http://10.0.0.30:9311            |
+--------------+----------------------------------+
[2] Add a User and Database on MariaDB for Barbican.
[root@dlp ~(keystone)]#
mysql -u root -p

Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 43
Server version: 10.1.20-MariaDB MariaDB Server

Copyright (c) 2000, 2016, 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] Install Barbican.
# install from Ocata, EPEL

[root@dlp ~(keystone)]#
yum --enablerepo=centos-openstack-ocata,epel -y install openstack-barbican
[4] Configure Barbican.
[root@dlp ~(keystone)]#
mv /etc/barbican/barbican.conf /etc/barbican/barbican.conf.org

[root@dlp ~(keystone)]#
vi /etc/barbican/barbican.conf
# create new

[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 connection info
sql_connection = mysql+pymysql://barbican:password@10.0.0.30/barbican
# RabbitMQ connection info
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 auth info
[keystone_authtoken]
auth_uri = http://10.0.0.30:5000
auth_url = http://10.0.0.30:35357
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)]#
mkdir /var/run/barbican

[root@dlp ~(keystone)]#
chown barbican. /var/run/barbican

[root@dlp ~(keystone)]#
vi /etc/tmpfiles.d/barbican.conf
# create new

d /var/run/barbican 0755 barbican barbican -
[root@dlp ~(keystone)]#
systemctl start openstack-barbican-api

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

[5] If Firewalld is running, allow service ports.
[root@dlp ~(keystone)]#
firewall-cmd --add-port=9311/tcp --permanent

success
[root@dlp ~(keystone)]#
firewall-cmd --reload

success
Matched Content