2017-01-17 52 views
1

我想知道如何配置PEP代理,以便我可以通過HTTPS交換消息。我有一個Orion上下文代理實例,只有在PEP代理通過後才能訪問。我PEP代理(威爾瑪)配置文件(config.js)有以下幾點:FIWARE - 配置爲HTTPS的PEP代理

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的配置爲反向代理),這樣我直接傳送到獵戶座的要求是安全的。 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,包括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',)) 
+0

我對設置有疑慮...... PEP-ngsix-Orion或ngsix-PEP-Orion。你能澄清一下嗎? – fgalan

+0

@fgalan,我正在嘗試PEP-Nginx-Orion:請求轉到PEP,PEP重定向到Nginx通過反向代理訪問的Orion。我現在將在問題中添加Nginx配置。 – Dalton

+0

也許一個ngnix-PEP-Orion設置可以簡化一些事情嗎? – fgalan

回答

1

問題是HTTPS在配置:

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

我不得不調試發現這一點。 PEP代理Wilma將協議(http或https)添加到已配置的應用程序主機。正確的是未經協議來配置:

config.app_host = 'orion'; 

也許這觀察可以加入到威爾瑪文件,以避免像我這樣的錯誤。

+1

嚴格來說,如果給定的URL是'http :: // orion',那麼主機就是'orion'(而'http://'是URL模式)。然而,我同意你在Wilma文檔中添加關於它的評論(可能在config.js.template文件本身,作爲'config.app_host'參數上方的註釋)是一個好主意。也許你甚至可以用https://github.com/ging/fiware-pep-proxy知識庫作出貢獻,並帶有更改的請求:) – fgalan

+1

你說得對,@fgalan。但它有點混亂,因爲config.js文件中的另一個參數與協議一起工作:'account_host ='http://127.0.0.1';'。也許它可以被標準化,包括端口配置:一個是以int('config.keystone_port = 5000;')傳遞的,另一個是字符串('config.app_port ='1026';')。 =) – Dalton

0

您可以配置PEP代理服務器監聽HTTPS在配置文件中使用參數「https」

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

+0

我已經配置爲顯示在鏈接中。但我得到這個錯誤: ('連接中止。',BadStatusLine('HTTP/1.1 0未知\ r \ n',)) 你能給我一些幫助嗎? – Dalton

+0

我在有關問題的問題中添加了更多詳細信息。任何幫助表示讚賞。 – Dalton

+0

這可能是PEP代理Wilma的錯誤嗎?它是否已經通過SSL配置進行了良好測試? – Dalton