为了安全地提供对基于专有网络的aws elasticsearch kibana的访问,我们使用nginx和cognito与saml提供程序

xzlaal3s  于 2021-06-14  发布在  ElasticSearch
关注(0)|答案(0)|浏览(325)

我有一个基于专有网络的aws elasticsearch域,我们会叫dev。我希望这个域在开放的互联网上是不可访问的,但在专有网络以外的一些网络上是可用的。为此,我将它们设置为基于vpc的elasticsearch域,并计划使用只能从我希望的网络访问的反向代理。我已经使用nginx反向代理设置了dev集群,该集群启用了cognito身份验证,配置如下:

{
server {
    listen 443;
    server_name $host;
    rewrite ^/$ https://$host/_plugin/kibana redirect;

    ssl_certificate           /etc/nginx/cert.crt;
    ssl_certificate_key       /etc/nginx/cert.key;

    ssl on;
    ssl_session_cache  builtin:1000  shared:SSL:10m;
    ssl_protocols  TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
    ssl_prefer_server_ciphers on;

    location /_plugin/kibana {
        # Forward requests to Kibana
        proxy_pass https://$kibana_host/_plugin/kibana;

        # Handle redirects to Cognito
        proxy_redirect https://$cognito_host https://$host;

        # Update cookie domain and path
        proxy_cookie_domain $kibana_host $host;
        proxy_cookie_path / /_plugin/kibana/;

        # Response buffer settings
        proxy_buffer_size 128k;
        proxy_buffers 4 256k;
        proxy_busy_buffers_size 256k;
    }

    location ~ \/(log|sign|fav|forgot|change|saml|oauth2) {
        # Forward requests to Cognito
        proxy_pass https://$cognito_host;

        # Handle redirects to Kibana
        proxy_redirect https://$kibana_host https://$host;

        # Update cookie domain
        proxy_cookie_domain $cognito_host $host;
    }
}

我想知道CognotUserPool中的重定向url是什么。我试过几种选择
当我们使用cognito身份验证更新ElasticSearch时,默认情况下,cognito用户池中的app clients设置将更新为redirect url

"https://vpc_endpoint/_plugin/kibana/".

但当浏览nginx代理url时,我得到了如下错误

“出事了”

我知道这是因为ElasticSearch在专有网络内部。所以,它不会允许任何来自外部的东西
后来,我们手动更改了cognito userpool的redirect\ url in app client设置为

https://nginx-proxy-url/oauth2/authorize

[这是我在cognito userpool中的appclient设置][1]

[1]: https://i.stack.imgur.com/f1bpy.jpg

但现在,我发现你错配了

阿美,我知道cognito用户池中的url是什么

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题