【问题标题】:FIWARE - PEP Proxy configured to HTTPSFIWARE - 配置为 HTTPS 的 PEP 代理
【发布时间】:2017-06-01 01:55:07
【问题描述】:

我想知道如何配置 PEP 代理,以便我可以通过 HTTPS 交换消息。我有一个 Orion 上下文代理实例,只有在 PEP 代理通过后才能访问。我的 PEP 代理 (Wilma) 配置文件 (config.js) 具有以下内容:

config.https = {
   enabled: true,
   cert_file: 'cert/idm.crt',
   key_file: 'cert/idm.key',
   port: 443
};

config.account_host = 'https://localhost:8000';   //account.lab.fiware.org';
config.keystone_host = 'localhost'; //'cloud.lab.fiware.org';
config.keystone_port = 5000; //4731;

config.app_host = 'https://orion'; //'localhost';
config.app_port = ''; //Nginx is configured to redirect to port 1026
// Use true if the app server listens in https
config.app_ssl = true;

config.username = 'pep_proxy_credential_obtained_at_portal';
config.password = 'password_obtained_at_portal';

我还有 HTTPS 到 HTTP(Nginx 配置为反向代理),这样我的请求直接发送到 Orion 是安全的。 HTTPS 仅在没有 PEP 代理流的情况下工作。当我插入授权/身份验证流程时,我遇到了问题,因为 PEP 代理不处理 SSL 证书。以下是 Nginx 配置:

location / {
    proxy_set_header        Host $host;
    proxy_set_header        X-Real-IP $remote_addr;
    proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header        X-Forwarded-Proto $scheme;

    # Fix the “It appears that your reverse proxy set up is broken" error.
    proxy_pass          http://orion:1026;
    proxy_read_timeout  90;
    proxy_redirect      http://orion:1026 https://orion;
}

我想以一种只能通过 HTTPS 与 Orion 通信的方式集成我拥有的东西,包括 PEP 代理流程。我已经搜索过,但没有发现任何与 PEP 代理中的 HTTPS 配置相关的有用信息。

编辑:当 PEP 代理重定向到应用程序时出错:

2017-01-17 20:52:55.544  - INFO: Server - Success authenticating PEP proxy. 
Proxy Auth-token:  d7ec08edd87d43418edfd558df26f427
2017-01-17 20:53:49.450  - INFO: IDM-Client - Checking token with IDM...
2017-01-17 20:53:49.508  - INFO: Root - Access-token OK. Redirecting to app...
Refused to set unsafe header "accept-encoding"
Refused to set unsafe header "content-length"

应用程序出现的错误是:

('Connection aborted.', BadStatusLine('HTTP/1.1 0 unknown\r\n',))

【问题讨论】:

  • 我对设置有疑问... PEP-ngsix-Orion 或 ngsix-PEP-Orion。请你澄清一下好吗?
  • 尝试停止 Orion 并在同一台机器上运行 nc -l -p 1026,从而“冒充”。然后重复测试,以查看在这种情况下哪个确切的请求(如果有)是 PEP 转发到 Orion。请在您的问题帖中发布测试结果。
  • 不幸的是,我不熟悉 PEP-Nginx-Orion 设置,但熟悉 Nginx-PEP-Orion 设置。在我的情况下,这是有道理的,因为 PEP-Orion 连接是使用安全通道(通过 L2/L3 安全手段)实现的,因此我们尝试尽快从 HTTPS 传递到 HTTP(即在 nginx 点)。无论如何,我希望 Wilma 团队可以看看确认该软件是否存在错误或请求更多信息来调试案例。
  • 啊...我刚刚意识到您可以自行回答问题的解决方案。很高兴看到问题最终解决了:)
  • 是的。但是,只要有安全通道,PEP 和 Orion 就可以在不同的机器中,例如。他们在 dame L2 隔离段

标签: ssl https reverse-proxy fiware fiware-wilma


【解决方案1】:

问题在于配置时的 https:

config.app_host = 'https://orion';

我必须调试才能找到它。 PEP 代理 Wilma 将协议(http 或 https)添加到配置的应用程序主机。正确的是不带协议配置:

config.app_host = 'orion';

也许可以将此观察结果添加到 Wilma 文档中以避免像我这样的错误。

【讨论】:

  • 严格来说,如果给定的 URL 是 http:://orion,那么主机是 orion(而 http:// 是 URL 架构)。但是,我同意你的看法,最好在 Wilma 文档中添加关于它的注释(可能在 config.js.template 文件本身中,作为config.app_host 参数上方的注释)。也许您甚至可以通过拉取请求为 github.com/ging/fiware-pep-proxy 存储库做出贡献:)
  • 你是对的,@fgalan。但这有点令人困惑,因为 config.js 文件中的另一个参数适用于协议:account_host = 'http://127.0.0.1';。也许它可以标准化,包括端口配置:一个作为 int (config.keystone_port = 5000;) 传递,另一个作为 string (config.app_port = '1026';) 传递。 =)
【解决方案2】:

您可以使用配置文件中的参数“https”将 PEP 代理配置为侦听 HTTPS

https://github.com/ging/fiware-pep-proxy/blob/master/config.js.template#L7

【讨论】:

  • 我已经按照链接中的说明进行了配置。但是我收到了这个错误: ('Connection aborted.', BadStatusLine('HTTP/1.1 0 unknown\r\n',)) 你能给我一些帮助吗?
  • 我在问题中添加了更多细节。任何帮助表示赞赏。
  • 这可能是 PEP 代理 Wilma 的错误吗?是否已经通过 SSL 配置进行了良好的测试?
猜你喜欢
  • 2021-07-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-09-03
  • 1970-01-01
  • 2017-12-14
  • 2017-04-21
  • 1970-01-01
相关资源
最近更新 更多