1. 程式人生 > >OpenStack Keystone安裝部署流程

OpenStack Keystone安裝部署流程

1. 簡介

  本文將詳細描述Keystone的安裝部署流程,並給出一些簡單的使用例項。

  Keystone是Openstack框架中的一個重要組成部分,負責身份認證、服務管理、服務規則和服務令牌的功能, 它實現了Openstack的Identity API。Keystone類似一個服務匯流排,或者說是整個Openstack框架的登錄檔,其他服務通過Keystone來註冊其服務,任何服務之間相互的呼叫,都需要經過Keystone的身份驗證來獲得目標服務。Keystone包含兩個主要部件:驗證與服務目錄。

  驗證部件提供了一套基於令牌的驗證服務,主要包含以下幾個概念:

  1. 租戶(Tenant)
    :使用相關服務的一個組織(一個租戶可以代表一個客戶、賬號、公司、組織或專案),必須指定一個相應的租戶(Tenant)才可以申請OpenStack服務。在Swift中,一個租戶可以擁有一定的儲存空間,擁有多個容器,可以理解為一個公司擁有一大塊儲存空間。
  2. 使用者(User):表示擁有使用者名稱、密碼、郵箱等賬號資訊的個人,使用者能夠申請並獲得訪問資源的授權。使用者擁有證書,可以與一個或多個租戶關聯。經過身份驗證後,會為每個關聯的租戶提供一個特定的令牌。一個使用者可以在不同的租戶中被分配不同的角色。以Swift為例,我們可以這樣理解:租戶是一個公司,擁有一大塊儲存空間,使用者是個人,是該公司的員工,能夠根據使用者的角色訪問公司的部分或全部儲存空間,當然這個員工可以同時在其他公司兼職,擁有其他公司的儲存空間;如果某個公司只有一個員工,即該員工擁有公司的全部儲存空間,此時的使用者就類似於金山快盤的使用者了。
  3. 證書(Credentials):為了給使用者提供一個令牌,需要用證書來唯一標識一個使用者的密碼或其它資訊。
  4. 令牌(Token):一個令牌是一個任意位元的文字,用於與其它OpenStack服務來共享資訊,Keystone以此來提供一個Central Location,以驗證訪問OpenStack服務的使用者。一個令牌可以是scoped或unscoped。一個scoped令牌代表為某個租戶驗證過的使用者,而unscoped令牌則僅代表一個使用者。令牌的有效期是有限的,可以隨時被撤回。
  5. 角色(Role):代表特定的租戶中的使用者操作許可權,一個角色是應用於某個租戶的使用許可權集合,以允許某個指定使用者訪問或使用特定操作。角色是使用許可權的邏輯分組,它使得通用的許可權可以簡單地分組並繫結到與某個指定租戶相關的使用者。

  服務目錄部件(Service Catalog)提供了一套REST API服務端點列表並以此作為決策參考,主要包含以下幾個概念:

  1. 服務(Service):一個OpenStack服務,例如Nova、Swift、Glance或Keystone。一個服務可以擁有一個或多個端點,使用者可以通過它與OpenStack的服務或資源進行互動。
  2. 端點(Endpoint):一個可以通過網路訪問的地址(例如一個URL),代表了OpenStack服務的API入口。端點也可以分組為模板,每個模板代表一組可用的OpenStack服務,這些服務是跨區域(regions)可用的,例如將多個Swift Proxy Server分別配置為不同的域(regionOne、regionTwo等)。
  3. 模板(Template):一個端點集合,代表一組可用的OpenStack服務端點。

2. 安裝部署

2.1 準備環境

環境型別

詳細資訊

機器型別:

PC物理機

作業系統:

Ubuntu-11.10-desktop-64位

使用者型別:

root

資料庫:

sqlite3

IP地址:

192.168.3.67

2.2 版本說明

  如果你使用的是Ubuntu,那麼也可以直接通過apt-get來安裝Keystone,不過本文介紹的是從git(https://github.com/openstack/keystone)上獲取Master分支的最新程式碼來進行安裝部署。請務必確保各處安裝的Keystone與python-keystoneclient的版本統一,這在Keystone與其他服務(如Swift)整合使用時尤為重要,可關注後續文件《Keystone與Swift(叢集)整合使用說明》,你就會明白其中的道理了。

2.3 安裝軟體環境

  首先,需要安裝Keystone所需的軟體環境(確保你的機器可以訪問網際網路),例如git用於獲取Keystone程式碼,sqlite3作為本地資料庫。

# apt-get install git python-dev sqlite3 libxml2-dev libxslt1-dev libsasl2-dev libsqlite3-dev libssl-dev libldap2-dev

2.4 安裝Keystone

  從git上獲取最新的Keystone Service程式碼。

# cd ~

# git clone https://github.com/openstack/keystone.git

  安裝Keystone的依賴項與主體程式(Keystone會被安裝到python的dist-packages中)。

# cd ~/keystone

# pip install -r tools/pip-requires

# pip install -r tools/test-requires(本條命令可不執行)

# python setup.py install

  檔案~/keystone/tools/pip-requires中(內容如下所示)記錄了執行Keystone程式所需的依賴項,setup.py就是根據該檔案來檢查依賴項並自動下載安裝的。其中指明瞭python-keystoneclient為依賴項,python-keystoneclient作為本地客戶端元件,用於訪問Keystone。python-keystoneclient與Keystone的版本需要統一,否則可能會出現版本相容性問題,採用依賴項的方式安裝python-keystoneclient,可確保不會出現版本相容性問題。

# keystone dependencies

pam>=0.1.4

WebOb==1.2.3

eventlet

greenlet

PasteDeploy

paste

routes

sqlalchemy>=0.7.8,<=0.7.9

sqlalchemy-migrate>=0.7.2

passlib

lxml

iso8601>=0.1.4

python-keystoneclient>=0.2.1,<0.3

oslo.config>=1.1.0

  檔案~/keystone/tools/test-requires中(內容如下所示)記錄了Keystone動態開發與測試所需的依賴項。這些依賴項不是執行Keystone所必須的,所以可以不安裝(即不執行上面的命令:pip install -r tools/test-requires)。

# Optional backend: SQL

pysqlite

# Optional backend: Memcache

python-memcached

# Optional backend: LDAP

python-ldap==2.3.13 # authenticate against an existing LDAP server

# Testing

coverage # computes code coverage percentages

mox # mock object framework

nose # for test discovery and console feedback

nosexcover

openstack.nose_plugin

nosehtmloutput

pylint # static code analysis

pep8==1.3.3 # checks for PEP8 code style compliance

Sphinx>=1.1.2 # required to build documentation

unittest2 # backport of unittest lib in python 2.7

webtest # test wsgi apps without starting an http server

distribute>=0.6.24

# for python-keystoneclient

httplib2 # keystoneclient <0.2.1

requests>=1.0.0 # replaces httplib2 in keystoneclient >=0.2.1

keyring

# swift_auth test dependencies

http://tarballs.openstack.org/swift/swift-master.tar.gz#egg=swift

netifaces

# For translations processing

Babel

  需要特別注意的是,安裝tools/test-requires依賴項時會自動下載swift-master.tar.gz包並重新安裝Swift。因此,如果電腦上已經安裝了Swift,就不可以再執行“pip install -r tools/test-requires”命令了(該命令會覆蓋掉之前安裝的Swift程式)。

  如果你不小心覆蓋掉了之前安裝的Swift程式,也無需擔心,執行以下命令,重新安裝你的Swift程式即可。(假設Swift的原始碼在目錄~/swift/swift_1.7.6下,python-swiftclient的原始碼在目錄~/swift/python-swiftclient_1.2.0下)

# cd ~/swift/swift_1.7.6

# python setup.py develop

# cd ~/swift/python-swiftclient_1.2.0

# python setup.py develop

2.5 配置Keystone

  由於是從git上獲取的程式碼,所以我們需要手動將程式碼中的配置檔案複製到系統中正確的目錄下。配置檔案在~/keystone/etc目錄下,共有四個,包括default_catalog.templateskeystone.conf.samplelogging.conf.samplepolicy.json。將這四個配置檔案複製到/etc/keystone目錄下,並重命名(去掉“.sample”)。使用者需要注意下文中的紅色標註部分。

# mkdir -p /etc/keystone

# cp ~/keystone/etc/* /etc/keystone/

# cp mv /etc/keystone/keystone.conf.sample /etc/keystone/keystone.conf

# cp mv /etc/keystone/logging.conf.sample /etc/keystone/logging.conf

  其中keystone.conf是核心配置檔案,logging.conf是日誌配置檔案,default_catalog.templates是目錄模版檔案,policy.json定義了Identity服務的訪問策略。我們需要修改核心配置檔案/etc/keystone/keystone.conf。

[DEFAULT]

# A "shared secret" between keystone and other openstack services

# admin_token = ADMIN

# 注意該資訊,admin_token引數是用來訪問Keystone服務的,即Keystone服務的Token。預設為ADMIN,當然也可以改成別的。客戶端可以使用該Token訪問Keystone服務、檢視資訊、建立其他服務等。

# The IP address of the network interface to listen on

# bind_host = 0.0.0.0

# The port number which the public service listens on

# public_port = 5000

# Keystone提供的認證授權服務監聽的埠,通常為公網(外網),也可以是內網。

# The port number which the public admin listens on

# admin_port = 35357

# Keystone提供的認證授權、系統管理服務監聽的埠,通常為內網。除了認證授權功能外,使用者需要訪問該埠來進行管理員操作,如建立刪除Tenant、User、Role、Service、Endpoint等。

# The port number which the OpenStack Compute service listens on

# compute_port = 8774

# Path to your policy definition containing identity actions

# TODO(dolph): This config method will probably be deprecated during grizzly

# policy_file = policy.json

# Rule to check if no matching policy definition is found

# FIXME(dolph): This should really be defined as [policy] default_rule

# policy_default_rule = admin_required

# === Logging Options ===

# Print debugging output

# verbose = False

# Print more verbose output

# (includes plaintext request logging, potentially including passwords)

# debug = False

# Name of log file to output to. If not set, logging will go to stdout.

# log_file = keystone.log

# The directory to keep log files in (will be prepended to --logfile)

# log_dir = /var/log/keystone

# Use syslog for logging.

# use_syslog = False

# syslog facility to receive log lines

# syslog_log_facility = LOG_USER

# If this option is specified, the logging configuration file specified is

# used and overrides any other logging options specified. Please see the

# Python logging module documentation for details on logging configuration

# files.

# log_config = logging.conf

# A logging.Formatter log message format string which may use any of the

# available logging.LogRecord attributes.

# log_format = %(asctime)s %(levelname)8s [%(name)s] %(message)s

# Format string for %(asctime)s in log records.

# log_date_format = %Y-%m-%d %H:%M:%S

# onready allows you to send a notification when the process is ready to serve

# For example, to have it notify using systemd, one could set shell command:

# onready = systemd-notify --ready

# or a module with notify() method:

# onready = keystone.common.systemd

[sql]

# The SQLAlchemy connection string used to connect to the database

# connection = sqlite:///keystone.db

# 此處為資料庫引數,預設使用sqlite,並且指定資料庫檔案的存放位置,keystone.db表示在主目錄下建立keystone.db檔案,用於存放資料。也可以指定其他儲存位置,例如sqlite:////var/lib/keystone/keystone.db。

# 當然也可以使用mysql,如mysql://root:[email protected]/keystone,其中192.168.3.67為資料庫地址,keystone為資料庫名稱,root為使用者名稱,123456為訪問密碼。需要事先安裝mysql,並且建立名為keystone的資料庫,設定使用者名稱密碼。

# the timeout before idle sql connections are reaped

# idle_timeout = 200

[identity]

# driver = keystone.identity.backends.sql.Identity

[catalog]

# dynamic, sql-based backend (supports API/CLI-based management commands)

# driver = keystone.catalog.backends.sql.Catalog

# static, file-based backend (does *NOT* support any management commands)

# driver = keystone.catalog.backends.templated.TemplatedCatalog

# template_file = default_catalog.templates

[token]

# driver = keystone.token.backends.kvs.Token

# Amount of time a token should remain valid (in seconds)

# expiration = 86400

[policy]

# driver = keystone.policy.backends.sql.Policy

[ec2]

# driver = keystone.contrib.ec2.backends.kvs.Ec2

[ssl]

#enable = True

#certfile = /etc/keystone/ssl/certs/keystone.pem

#keyfile = /etc/keystone/ssl/private/keystonekey.pem

#ca_certs = /etc/keystone/ssl/certs/ca.pem

#cert_required = True

[signing]

# token_format = PKI

# 此處需要特別注意,新版本中預設Token為PKI,因而需要為此設定PKI認證,較為麻煩,可改為UUID以方便使用,UUID是一個幾十位的隨機字串。

token_format = UUID

#certfile = /etc/keystone/ssl/certs/signing_cert.pem

#keyfile = /etc/keystone/ssl/private/signing_key.pem

#ca_certs = /etc/keystone/ssl/certs/ca.pem

#key_size = 1024

#valid_days = 3650

#ca_password = None

[ldap]

# url = ldap://localhost

# user = dc=Manager,dc=example,dc=com

# password = None

# suffix = cn=example,cn=com

# use_dumb_member = False

# allow_subtree_delete = False

# dumb_member = cn=dumb,dc=example,dc=com

# user_tree_dn = ou=Users,dc=example,dc=com

# user_filter =

# user_objectclass = inetOrgPerson

# user_id_attribute = cn

# user_name_attribute = sn

# user_mail_attribute = email

# user_pass_attribute = userPassword

# user_enabled_attribute = enabled

# user_enabled_mask = 0

# user_enabled_default = True

# user_attribute_ignore = tenant_id,tenants

# user_allow_create = True

# user_allow_update = True

# user_allow_delete = True

# tenant_tree_dn = ou=Groups,dc=example,dc=com

# tenant_filter =

# tenant_objectclass = groupOfNames

# tenant_id_attribute = cn

# tenant_member_attribute = member

# tenant_name_attribute = ou

# tenant_desc_attribute = desc

# tenant_enabled_attribute = enabled

# tenant_attribute_ignore =

# tenant_allow_create = True

# tenant_allow_update = True

# tenant_allow_delete = True

# role_tree_dn = ou=Roles,dc=example,dc=com

# role_filter =

# role_objectclass = organizationalRole

# role_id_attribute = cn

# role_name_attribute = ou

# role_member_attribute = roleOccupant

# role_attribute_ignore =

# role_allow_create = True

# role_allow_update = True

# role_allow_delete = True

[filter:debug]

paste.filter_factory = keystone.common.wsgi:Debug.factory

[filter:token_auth]

paste.filter_factory = keystone.middleware:TokenAuthMiddleware.factory

[filter:admin_token_auth]

paste.filter_factory = keystone.middleware:AdminTokenAuthMiddleware.factory

[filter:xml_body]

paste.filter_factory = keystone.middleware:XmlBodyMiddleware.factory

[filter:json_body]

paste.filter_factory = keystone.middleware:JsonBodyMiddleware.factory

[filter:user_crud_extension]

paste.filter_factory = keystone.contrib.user_crud:CrudExtension.factory

[filter:crud_extension]

paste.filter_factory = keystone.contrib.admin_crud:CrudExtension.factory

[filter:ec2_extension]

paste.filter_factory = keystone.contrib.ec2:Ec2Extension.factory

[filter:s3_extension]

paste.filter_factory = keystone.contrib.s3:S3Extension.factory

[filter:url_normalize]

paste.filter_factory = keystone.middleware:NormalizingFilter.factory

[filter:stats_monitoring]

paste.filter_factory = keystone.contrib.stats:StatsMiddleware.factory

[filter:stats_reporting]

paste.filter_factory = keystone.contrib.stats:StatsExtension.factory

[app:public_service]

paste.app_factory = keystone.service:public_app_factory

[app:service_v3]

paste.app_factory = keystone.service:v3_app_factory

[app:admin_service]

paste.app_factory = keystone.service:admin_app_factory

[pipeline:public_api]

pipeline = stats_monitoring url_normalize token_auth admin_token_auth xml_body json_body debug ec2_extension user_crud_extension public_service

[pipeline:admin_api]

pipeline = stats_monitoring url_normalize token_auth admin_token_auth xml_body json_body debug stats_reporting ec2_extension s3_extension crud_extension admin_service

[pipeline:api_v3]

pipeline = stats_monitoring url_normalize token_auth admin_token_auth xml_body json_body debug stats_reporting ec2_extension s3_extension service_v3

[app:public_version_service]

paste.app_factory = keystone.service:public_version_app_factory

[app:admin_version_service]

paste.app_factory = keystone.service:admin_version_app_factory

[pipeline:public_version_api]

pipeline = stats_monitoring url_normalize xml_body public_version_service

[pipeline:admin_version_api]

pipeline = stats_monitoring url_normalize xml_body admin_version_service

[composite:main]

use = egg:Paste#urlmap

/v2.0 = public_api

/v3 = api_v3

/ = public_version_api

[composite:admin]

use = egg:Paste#urlmap

/v2.0 = admin_api

/v3 = api_v3

相關推薦

OpenStack Keystone安裝部署流程

1. 簡介   本文將詳細描述Keystone的安裝部署流程,並給出一些簡單的使用例項。   Keystone是Openstack框架中的一個重要組成部分,負責身份認證、服務管理、服務規則和服務令牌的功能, 它實現了Openstack的Identity A

webacula安裝部署流程

bacula webacula 以webacula-7.0.0為例 建議安裝在os6上下載webcaulahttp://webacula.sourceforge.net/#downloads安裝和配置安裝要求1、Bacula 3.0 或以上版本2、系統安裝有 Mysql,PostgreSQL 或 SQ

swagger安裝部署流程

在網上搜索很多swagger安裝流程資料,最後總結一下。 需要下載 node.js、swagger-editor、swagger-ui,可以搜尋下載。 a 安裝node.js 1.下載並且安裝node.js b. 安裝swagger-editor 1. 下載專案https://github.c

Openstack Swift 安裝部署總結

環境 硬體 這裡只使用了一臺伺服器,既作為Controller Node,也作為Storage Node 主機名 IP OS 磁碟 檔案系統 sf-dev 10.202.127.4 Centos-7.4

cloudera CDH5 Hadoop叢集全套安裝部署流程

CDH install [detail installing PDF]($ sudo ./cloudera-manager-installer.bin) create virtual machine eth0: hostonly eth1: br

完整的 LDAP + phpLDAPadmin安裝部署流程 (ubuntu18.04)

## LDAP 安裝部署以及基礎使用 因工作需求需要使用`ldap`管理使用者許可權,在踩了一系列坑之後,總結了一些流暢的文件,希望可以幫到和曾經的我一樣迷茫的人。 --- 基礎環境:Ubuntu 18.04 ### 一、安裝 ``` root@cky:~# apt install slapd l

Openstack 安裝部署指南翻譯系列 之 Keystone服務安裝(Identity)

openstack 翻譯 keystone安裝OpenStack系統由分開安裝的幾個關鍵服務組成。這些服務可根據其他雲需求一起工作,包括計算(Compute),身份(Identity),網絡(Networking),鏡像(Image),塊存儲(Block Storage),對象存儲(Object Storag

OpenStack部署應用第一篇:認證服務keystone安裝(轉)

注:OpenStack版本N版 1、網路時間協議(NTP) 注:一定要保證openstack所有節點的時間一致性,不然無法正常建立虛擬機器 1.1 控制節點 # yum install -y chrony ntpdate # 安裝軟體包 # vim /etc/chro

Openstack 安裝部署指南翻譯系列 之 網絡

openstack 翻譯 網絡網絡包括兩種類型,網絡選項1:提供商網絡(Provider networks)和網絡選項2:自助網絡(Self-service networks),其中網絡選項2:自助網絡(Self-service networks)能夠實現更加高級的網絡功能,能夠實現網絡選項1的所有功能,因此

Openstack安裝部署指南翻譯系列 之 硬件需求

openstack 翻譯1.1.1.1. 控制節點控制器節點運行身份服務,鏡像服務,計算的管理部分,網絡的管理部分,各種網絡代理和儀表板。它還包括支持服務,如SQL數據庫,消息隊列和NTP。可選地,控制節點運行塊存儲,對象存儲,編排和計量服務的部分。控制器節點至少需要兩個網絡接口。1.1.1.2. 計算節點計

Openstack 安裝部署指南翻譯系列 之 Horizon服務安裝(Dashboad)

openstack 翻譯 horizon安裝1.1.1.1. Horizon服務安裝(Dashboad)本節介紹如何在控制器節點上安裝和配置儀表板。儀表板所需的唯一核心服務是身份服務。您可以使用儀表板與其他服務(如鏡像服務,計算和網絡)結合使用。您還可以在具有獨立服務(如對象存儲)的環境中使用儀表板。註意:本

Openstack 安裝部署指南翻譯系列 之 Cinder服務安裝(Block Storage)

openstack 翻譯 cinder安裝1.1.1.1. Cinder服務安裝(Block Storage)塊存儲服務(cinder)為訪客實例提供塊存儲設備。存儲設置方法由塊存儲驅動程序確定,或者在多後端配置的情況下確定驅動程序。有各種可用的驅動程序:NAS / SAN,NFS,iSCSI,Ceph等。塊

Openstack 安裝部署指南翻譯系列 之 概況

openstack 翻譯概況Openstack項目是支持所有類型的雲環境的一個開源雲計算平臺。該項目旨在簡單實施,大規模可擴展性和豐富的功能。來自世界各地的雲計算專家為項目做出了貢獻。OpenStack通過各種互補服務提供基礎設施即服務(IaaS)解決方案。每個服務都提供了一個便於集成的應用程序編程接口(AP

Openstack實踐(1)安裝部署第一個實例及neutron網絡

ipv6 dir hostname 鏈接 segment 訪問外網 繼續 過程 命名 版權聲明:本文為博主原創文章,歡迎轉載,轉載請註明作者、原文超鏈接 ,博主地址:http://www.cnblogs.com/SuperXJ/ 如何快速部署使用op

openstack安裝部署

user rabbit ubun clone sudoers art org -m 就是 系統:ubuntu16.4 amd64 ,不得不說是個二流貨,中文版那麽大個bug就是不解決。DevStack安裝 1.$ sudo useradd -s /bin/bash -d /

OpenStack-Q Keystone安裝

Keystone安裝 一、Keystone概述 二、安裝Keystone元件 一、Keystone概述 Keystone通常是使用者與之互動的第一個服務。一旦經過身份驗證,終端使用者就可以使用他們的身份來訪問其他OpenS

OpenStack一鍵部署安裝

openstack 環境準備基礎條件:CentOS或Redhat裸機一臺,記憶體16G以上,並自行安裝基礎工具包(net-tools及vim等)配置物理機YUM源(請使用官方提供的最完整的倉庫) TIPS: 前面的步驟均為環境準備,具體安裝步驟請看該部落格最後部分 搭建KVM平臺 yum -y ins

OpenStack-Q Keystone安裝

一、Keystone概述 Keystone通常是使用者與之互動的第一個服務。一旦經過身份驗證,終端使用者就可以使用他們的身份來訪問其他OpenStack服務。同樣地,其他OpenStack服務利用Keystone驗證真假,並發現部署中其他服務的位置。Keyst

使用devstack安裝OpenStack 雙節點部署

本文安裝的Pike版OpenStack,之前試過liberty、newton和mitaka、ocata版本都以失敗告終,所以百度了一下版本順序,秉著最新最優的執念,終於,Pike版本安裝成功!一:軟硬體準備    裝置:win10電腦    軟體:VMware Worksta

Openstack Kolla-Ansible安裝部署

Openstack Kolla-Ansible安裝部署 部署節點製作 環境準備 CentOS環境安裝 配置國內pypi源: mkdir -p ~/.config/pip/ vim ~/.config/pip/pip.conf [global] inde