接下来继续安装认证服务:
1.keystone介绍
keystone在openstack框架中负责身份验证,服务规则令牌的功能,使用restful接口来提供认证和授权服务。任何服务之间的访问,都需要经过keystone的身份认证。获取目标服务的endpoint。
2.keystone基本概念
user:用户,代表可以通过keystone进行访问的程序或者人
tenant: 租户
role:角色,代表一组用户可以访问资源的权限
service:服务
endpoint:可以理解为api,程序访问接口
3.先决条件
创建keystone数据库并授权:
create database keystone;
grant all privileges on keystone.* to "keystone"@"localhost" identified by "123456";
grant all privileges on keystone.* to "keystone"@"%" identified by "123456";
4.安装并配置组件
安装软件包:
yum install openstack-keystone httpd mod_wsgi修改配置文件/etc/keystone/keystone.conf:
分别添加如下内容:
admin_token =85a18ebf9306d572b902
connection = mysql+pymysql://keystone:123456@192.168.141.170/keystone 【database】
servers = 192.168.141.170:11211 【memcache】
provider = fernet 【token】
driver = memcache 【token】
注意:admin_token为随机生成的字符串token。命令为:openssl rand -hex 10
初始化身份认证服务器:
su -s /bin/sh -c "keystone-manage db_sync" keystone
初始化Fernet key:
# keystone-manage fernet_setup --keystone-user keystone --keystone-group keystone # keystone-manage credential_setup --keystone-user keystone --keystone-group keystoneBootstrap the Identity service:
# keystone-manage bootstrap --bootstrap-password ADMIN_PASS \ --bootstrap-admin-url http://controller:35357/v3/ \ --bootstrap-internal-url http://controller:35357/v3/ \ --bootstrap-public-url http://controller:5000/v3/ \ --bootstrap-region-id RegionOne
配置apache http服务器:
1.编辑``/etc/httpd/conf/httpd.conf`` 文件,配置``ServerName`` 选项为控制节点:
ServerName ip:80
2.创建一个链接到``/usr/share/keystone/wsgi-keystone.conf``文件
ln -s /usr/share/keystone/wsgi-keystone.conf /etc/httpd/conf.d/启动 Apache HTTP 服务并配置其随系统启动:
# systemctl enable httpd.service # systemctl start httpd.service配置admin账号:
$ export OS_USERNAME=admin $ export OS_PASSWORD=ADMIN_PASS $ export OS_PROJECT_NAME=admin $ export OS_USER_DOMAIN_NAME=default $ export OS_PROJECT_DOMAIN_NAME=default $ export OS_AUTH_URL=http://controller:35357/v3 $ export OS_IDENTITY_API_VERSION=3
以上认证服务keystone安装的版本为N版本opensatck。