Ubuntu 24.04
Sponsored Link

OpenStack Caracal : Barbican कॉन्फ़िगर करें2024/05/22

 

OpenStack कुंजी प्रबंधक सेवा (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  |  |  Neutron L2/L3 Agent  |  |        Libvirt        |
|  Memcached  Nginx     |  |   Neutron Metadata    |  |      Nova Compute     |
|  Keystone   httpd     |  |     Open vSwitch      |  |    Neutron L2 Agent   |
|  Glance     Nova API  |  |     iSCSI Target      |  |      Open vSwitch     |
|  Neutron Server       |  |     Cinder Volume     |  |                       |
|  Neutron Metadata     |  |     Heat API/Engine   |  |                       |
|  Cinder API           |  |                       |  |                       |
|  Barbican API         |  |                       |  |                       |
+-----------------------+  +-----------------------+  +-----------------------+

[1] नियंत्रण नोड पर Barbican के लिए Keystone में एक उपयोगकर्ता या समापन बिंदु जोड़ें।
# [service] प्रोजेक्ट में [barbican] उपयोगकर्ता बनाएं

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

+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| default_project_id  | ab9749e59bdb48e4807a18abb83c9f99 |
| domain_id           | default                          |
| enabled             | True                             |
| id                  | f140fe8c172a4e3f829f6d3dc8f4d187 |
| 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          | 046e6676ff5f4fbe94e72ddbbc4b78de |
| name        | barbican                         |
| type        | 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           | 9fe102664c29460695539f3deb505d07 |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 046e6676ff5f4fbe94e72ddbbc4b78de |
| 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           | fbf10e3e2b044e27933aa7b9ad2dddbe |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 046e6676ff5f4fbe94e72ddbbc4b78de |
| 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           | 8b2a65b70d0840b99c7e924bf17a1c2a |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 046e6676ff5f4fbe94e72ddbbc4b78de |
| 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 158
Server version: 10.11.7-MariaDB-2ubuntu2 Ubuntu 24.04

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)#
apt -y install barbican-api
[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 = 127.0.0.1
bind_port = 9311
host_href = https://dlp.srv.world:9311
log_file = /var/log/barbican/api.log
# MariaDB कनेक्शन जानकारी
sql_connection = mysql+pymysql://barbican:password@dlp.srv.world:3306/barbican
# RabbitMQ कनेक्शन जानकारी
transport_url = rabbit://openstack:password@dlp.srv.world:5672

[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 = 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
# यदि Apache2 Keystone पर स्व-हस्ताक्षरित प्रमाणपत्र का उपयोग कर रहे हैं, तो [true] पर जाएँ
insecure = false

[oslo_policy]
enforce_new_defaults = true

root@dlp ~(keystone)#
chmod 640 /etc/barbican/barbican.conf

root@dlp ~(keystone)#
chgrp barbican /etc/barbican/barbican.conf
root@dlp ~(keystone)#
vi /etc/apache2/conf-available/barbican-api.conf
# पंक्ति 1,2 : परिवर्तन

Listen
127.0.0.1
:9311
Listen
127.0.0.1
:9312
[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;
    }
    upstream barbican-api-2 {
        server 127.0.0.1:9312;
    }
    server {
        listen 10.0.0.30:9312 ssl;
        proxy_pass barbican-api-2;
    }
    ssl_certificate "/etc/letsencrypt/live/dlp.srv.world/fullchain.pem";
    ssl_certificate_key "/etc/letsencrypt/live/dlp.srv.world/privkey.pem";
}
[6] डेटाबेस में डेटा जोड़ें और Barbican सेवाएँ प्रारंभ करें।
root@dlp ~(keystone)#
su -s /bin/bash barbican -c "barbican-manage db upgrade"

root@dlp ~(keystone)#
systemctl restart apache2 nginx

मिलान सामग्री