【问题标题】:Fiware - how to connect PEP proxy to Orion and configure both with HTTPS?Fiware - 如何将 PEP 代理连接到 Orion 并使用 HTTPS 进行配置?
【发布时间】:2018-03-19 09:54:16
【问题描述】:

我正在与 Orion 合作,并尝试使用 PEP 代理和 Keyrock 保护未来的应用程序,但我找不到结合这 3 个 GE 的方法。我所有的基本文件都在this repository 中,虽然我运行了 Orion、Keyrock 和 Cygnus,但我无法使用 PEP 代理发送请求。

这是我的 docker-compose.yml 文件:

version: "2"
networks:
  fiware:
    driver: bridge
services:
# Base de datos Orion
  mongodb:
    image: mongo:3.4.7
    hostname: mongodb
    container_name: mongodb
    expose:
      - "27017"
    ports:
      - "27018:27017"
    command: --smallfiles
    networks:
      - fiware
# GE encargado de la publicación y suscripción
  orion:
    image: fiware/orion:latest
    hostname: orion
    container_name: orion
    links: 
      - mongodb
    expose:
      - "1026"
    ports:
      - "1026:1026"
    volumes:
      - "./data/db/mongo:/data/db:rw" 
    command: -dbhost mongodb
    networks:
      - fiware
# GE encargada de la persistencia de datos
  cygnus:
    image: fiware/cygnus-ngsi:latest
    hostname: cygnus
    container_name: cygnus
    volumes:
      - "./config/cygnus/agent.conf:/opt/apache-flume/conf/agent.conf:rw"
      - "./config/cygnus/grouping_rules.conf:/opt/apache-flume/conf/grouping_rules.conf:rw"
    links:
      - mysql-cygnus
    expose:
      - "5050"
      - "8081"
    ports:
      - "5050:5050"
      - "8081:8081"
    environment:
      - CYGNUS_MYSQL_HOST=mysql-cygnus
      - CYGNUS_MYSQL_PORT=3306
      - CYGNUS_MYSQL_USER=root
      - CYGNUS_MYSQL_PASS=fiware
      - CYGNUS_LOG_LEVEL=INFO
    networks:
      - fiware
# Base de datos para historicos
  mysql-cygnus:
    image: mysql
    hostname: mysql-cygnus
    container_name: mysql-cygnus 
    expose:
      - "3306"
    ports:
      - "3306:3306"
    environment:
      - MYSQL_ROOT_PASSWORD=fiware
    volumes:
      - "./data/db/mysql:/var/lib/mysql:rw"
    networks:
      - fiware
# GE de control de acceso 
  authzforce:
     image: fiware/authzforce-ce-server:release-5.4.1
     hostname: authzforce
     container_name: authzforce
     expose:
         - "8080" 
     ports: 
         - "8080:8080"
# GE encargado de la administración de seguridad
  keyrock:
    image: fiware/idm:latest
    hostname: keyrock
    container_name: keyrock
    volumes:
        - "./config/idm/keystone.db:/keystone/keystone.db:rw"
        - "./config/idm/local_settings.py:/horizon/openstack_dashboard/local/local_settings.py:rw"
        - "./config/idm/keystone.conf:/keystone/etc/keystone.conf:rw"
    links:
        - orion
    expose:  
        - "5000"
        - "8000"
    ports:
        - "5000:5000"
        - "8000:8000"
    networks:
        - fiware
# GE encargado del redireccionamiento
  pepwilma:
    image: ging/fiware-pep-proxy
    hostname: pepwilma
    container_name: pepwilma
    volumes:
        - "./config/pepproxy/config.js:/opt/fiware-pep-proxy/config.js:rw"
    links:
        - keyrock
        - orion
        - authzforce
    volumes_from:
        - keyrock
    expose:
        - "80"
    ports:
        - "80:80"
    networks:
- fiware

创建和获取令牌,您可以在下一个 wiki 中看到:get token

如您在此处看到的:token

我无法继续,因为当我向postman request(未指定端口)发出请求时,PEP 代理显示错误。

使用这个 config.js:config.js

收到此错误:error

ERROR: Server - Caught exception: SyntaxError: Unexpected token E

有人有建议,有人知道我该如何部署 https 支持?

谢谢大家...

【问题讨论】:

  • 您的主要疑问与 PEP 设置有关,对吧?

标签: fiware fiware-orion fiware-wilma


【解决方案1】:

您面临的问题是:“在请求标头中找不到 Auth-token”。这意味着您没有在请求的标头中传递身份验证令牌。

要解决您的问题,您需要通过这种方式获取有效令牌:

POST to "http://idm_ip:8000/oauth2/token"  
Payload: grant_type=password&username=YOUR_USERNAME&password=YOUR_PASSWORD&cli ent_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET
Headers: 'Content-Type': 'application/x-www-form-urlencoded', 'Authorization': 'Basic AUTH_HEADER'

将“idm_ip”和所有“YOUR_...”更改为正确的值。 AUTH_HEADER 必须更改为此信息的 Base64 编码:“client_id:client_secret” - 类似于 base64(client_id + “:” + client_secret)

使用收到的令牌,您可以执行 GET/POST 请求,通知标头如下:

Headers: 'Content-Type': 'application/json', 'Accept': 'application/json', 'X-Auth-Token': 'your received IdM token' 

您可以在此tutorial about Orion, Keyrock and Wilma integration 中找到更多信息。

【讨论】:

  • 如您在此处看到的:github issue 我已经获得了令牌并且错误仍然存​​在,我多次遵循该教程,在最后一步中我得到了错误。您还有其他建议吗?
  • 道尔顿,我收到了这个错误:pepwilma | 2018-03-27 12:51:15.556 - INFO: Root - Access-token OK. Redirecting to app... pepwilma | Refused to set unsafe header "accept-encoding"
  • 通过您的 github 消息,您似乎修复了错误...您收到的 domain 错误来自 authzforce,因为您没有创建一些访问策略...如果您这样做不需要使用 authzforce 只需在 PEP config.js 文件中设置 enabled: false。希望答案和cmets对你有所帮助。
  • 是的道尔顿,出于任何原因,当 docker-compose 文件中存在 authzforce 容器时,禁用它不是一个选项,然后我只评论那部分。
猜你喜欢
  • 1970-01-01
  • 2021-07-13
  • 2017-06-01
  • 2016-09-03
  • 2017-04-21
  • 1970-01-01
  • 2015-06-20
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多