Fiware Orion-pepProxy

Fiware Orion - pepProxy

我是开发应用程序的团队的一员,该应用程序使用 Fiware GE 的 Smart-AgriFood 加速器的一部分。 我们正在使用 Orion Context Broker 来收集传感器网络提供的数据,我们打算使用 Pep-Proxy 来验证传感器节点以访问 Orion 实例。我们尝试了以下 pepProxy 的:

https://github.com/telefonicaid/fiware-orion-pep

https://github.com/ging/fi-ware-pep-proxy

我们只成功实施了代理的第二个 (fi-ware-pep-proxy) 实施。使用 fiware-orion-pep 我们无法连接到 Keystone Global 实例 (account.lab.fi-ware.org),我们尝试了 account.lab...cloud.lab...,我的问题是:

1) 是用于验证 account.lab 还是 cloud.lab 的 Keystone (IDM) 实例?以及使用什么端口或地址?

2) fiware-orion-pep 是否准备在 account.lab.fi-ware.org 进行身份验证?这是我问这个的方式:

这个与 curl 命令一起使用 >> cloud.lab.fiware.org:4730/v2.0/tokens

{
    "auth": {
        "passwordCredentials": {

                   "username": "<my_user>",
                    "password": "<my_password>"
                }
            }
}'

此命令不适用于 >> account.lab.fi-ware.org:5000/v3/auth/tokens

处的 curl 命令
{
    "auth": {
        "identity": {
            "methods": [
                "password"
            ],
            "password": {
                "user": {
                    "domain": {
                        "name": "<my_domain>"
                    },
                    "name": "<my_user>",
                    "password": "<my_password>"
                }
            }
        }
    } }'

3) 我应该使用什么实现来验证设备或对 Orion 实例的其他调用???

以下是我使用的配置:

fiware-orion-pep

config.authentication = {
    checkHeaders: true,
    module: 'keystone',
    user: '<my_user>',
    password: '<my_password>',
    domainName: '<my_domain>',
    retries: 3,
    cacheTTLs: {
        users: 1000,
        projectIds: 1000,
        roles: 60
    },
    options: {
        protocol: 'http',
        host: 'account.lab.fiware.org',
        port: 5000,
        path: '/v3/role_assignments',
        authPath: '/v3/auth/tokens'
    }
};

fi-ware-pep-proxy(这个有效),我在源代码中将列表端口设置为 1026

var config = {};

config.account_host = 'https://account.lab.fiware.org';

config.keystone_host = 'cloud.lab.fiware.org';
config.keystone_port = 4731;

config.app_host = 'localhost';
config.app_port = '10026';

config.username = 'pepProxy';
config.password = 'pepProxy';

// in seconds
config.chache_time = 300;
config.check_permissions = false;

config.magic_key = undefined;

module.exports = config;

提前感谢抽出时间...:)

目前 PEP 代理在如何针对全局实例进行身份验证和验证方面存在一些差异,因此它们的行为方式并不完全相同。

telefonicaid/fiware-orion-pep 中的一个是为了在具有自己的 Keystone 和 Keypass(一种访问控制)安装的单个项目中满足 PEP 代理要求(针对 Keystone 和访问控制的身份验证和验证)而开发的,因此它比 ging/fi-ware-pep-proxy 中的进化速度更快,而且方向略有不同。例如,前者使用 fiware-service 和 fiware-service 路径 headers 支持多租户,而后者对这些机制是透明的。这种开发方向也意味着功能有时会与全局实例中的功能略有不同。

话虽如此,具体的答案是: - 两个 PEP 代理都应该能够联系全局实例。如果没有,请在 Github 存储库的问题中填写错误,我们将尽快修复它。 - ging/fi-ware-pep-proxy 专为访问全局实例而设计,因此您应该能够按预期使用它。

如果您尝试继续telefonicaid/fiware-orion-pep,请注意: - 配置标志 authentication.checkHeaders 应该为 false,因为全局实例当前不支持多租户。 - 当前的稳定版本 (0.5.0) 即将更改为下一个版本(可能是今天),因此更新可能会解决一些问题。

希望这能澄清您的一些疑虑。

[编辑]

1) 我已经从源代码和按照 github 中提供的教程创建的 rpm 包安装了 telefonicaid/fiware-orion-pep (v 0.6.0)。创建 rpm 包时,创建时使用以下名称 pep-proxy-0.4.0_next-0.noarch.rpm.

2) 这是我使用的配置:

/opt/fiware-orion-pep/config.js

 var config = {};
 config.resource = {
     original: {
         host: 'localhost', 
         port: 10026
     },
     proxy: { 
        port: 1026,
        adminPort: 11211
     } }; 

 config.authentication = {
     checkHeaders: false,
     module: 'keystone',
     user: '<##################>',
     password: '<###################>',
     domainName: 'admin_domain',
     retries: 3,
     cacheTTLs: {
         users: 1000,
         projectIds: 1000,
         roles: 60
     },
     options: {     protocol: 'http',
         host: 'cloud.lab.fiware.org',
         port: 4730,
         path: '/v3/role_assignments',
         authPath: '/v3/auth/tokens'
     } };  

 config.ssl = {
     active: false,
     keyFile: '',
     certFile: '' }

 config.logLevel = 'DEBUG'; // List of component
 config.middlewares = {
     require: 'lib/plugins/orionPlugin',
     functions: [
         'extractCBAction'
     ] };

 config.componentName = 'orion'; 
 config.resourceNamePrefix = 'fiware:';

 config.bypass = false;

 config.bypassRoleId = '';

 module.exports = config;

/etc/sysconfig/pepProxy

# General Configuration
############################################################################

# Port where the proxy will listen for requests
PROXY_PORT=1026

# User to execute the PEP Proxy with
PROXY_USER=pepproxy

# Host where the target Context Broker is located
# TARGET_HOST=localhost

# Port where the target Context Broker is listening
# TARGET_PORT=10026

# Maximum level of logs to show (FATAL, ERROR, WARNING, INFO, DEBUG)
LOG_LEVEL=DEBUG

# Indicates what component plugin should be loaded with this PEP: orion, keypass, perseo
COMPONENT_PLUGIN=orion

#
# Access Control Configuration
############################################################################

# Host where the Access Control (the component who knows the policies for the incoming requests) is located
# ACCESS_HOST=

# Port where the Access Control is listening
# ACCESS_PORT=

# Host where the authentication authority for the Access Control is located
# AUTHENTICATION_HOST=

# Port where the authentication authority is listening
# AUTHENTICATION_PORT=

# User name of the PEP Proxy in the authentication authority
PROXY_USERNAME=XXXXXXXXXXXXX

# Password of the PEP Proxy in the Authentication authority
PROXY_PASSWORD=XXXXXXXXXXXXX

在上面的文件中,我尝试了以下参数:

Keystone 实例:account.lab.fiware.org 或 cloud.lab.fiware.org

用户:pep 或 pepProxy 或 "user from fiware account"

通过:pep 或 pepProxy 或 "user password from account"

端口:4730、4731、5000

结果和以前一样...telefonicaid/fiware-orion-pep 无法验证:

log file at /var/log/pepProxy/pepProxy
time=2015-04-13T14:49:24.718Z | lvl=ERROR | corr=71a34c8b-10b3-40a3-be85-71bd3ce34c8a | trans=71a34c8b-10b3-40a3-be85-71bd3ce34c8a | op=/v1/updateContext | msg=VALIDATION-GEN-003] Error connecting to Keystone authentication: KEYSTONE_AUTHENTICATION_ERROR: There was a connection error while authenticating to Keystone: 500
time=2015-04-13T14:49:24.721Z | lvl=DEBUG | corr=71a34c8b-10b3-40a3-be85-71bd3ce34c8a | trans=71a34c8b-10b3-40a3-be85-71bd3ce34c8a | op=/v1/updateContext | msg=response-time: 50745 statusCode: 500

来自客户端控制台的结果

{
    "message": "There was a connection error while authenticating to Keystone: 500", 
    "name": "KEYSTONE_AUTHENTICATION_ERROR"
}

我这里做错了什么??