【问题标题】:Rundeck behind and SSL ProxyRundeck 背后和 SSL 代理
【发布时间】:2017-06-07 10:54:19
【问题描述】:

我目前正在尝试建立一个运行 Rundeck 和 nginx 反向 ssl 代理的环境。我在网上找到了针对这种情况的不同教程,但没有一个对我有用。我在运行 rundeck 和 nginx 的 linux 环境中工作。我的 rundeck 的 nginx 配置文件如下所示:

server {
        access_log   /var/log/nginx/rundeck.access.log  main;


        listen 443;
        listen       [::]:443;
        ssl    on;
        ssl_certificate    /etc/nginx/conf.d/cert.crt;
        ssl_certificate_key    /etc/nginx/conf.d/key.rsa;

        location / {
          proxy_pass http://localhost:4440/;
          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-Ssl on;
}

        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }

此外,我在 rundeck 中配置了这些参数: framework.server.url = https://localhost:4440grails.serverURL=https://lde71d6p.de.top.com:443 我尝试了使用 https 或仅使用 http 的不同组合,没有端口和端口。它们都不能正常工作。

使用当前配置,我得到以下错误情况。 如果我尝试调用http://hostname.top.com -> 连接错误(似乎很好,因为 nginx 不处理端口 80) https://hostname.top.com -> 得到 302 并被重定向到 http://hostname.top.com/user/login;jsessionid=xxxxxxx,然后出现连接错误。 https://hostname.top.com/user/login 让我直接进入 rundeck 的登录界面。一切都好。

谁能帮我解决我首先提到的错误情况?

亲切的问候,

最大

【问题讨论】:

    标签: ssl nginx reverse-proxy rundeck


    【解决方案1】:

    要在 SSL 代理后运行 Rundeck,您需要以下三个设置:

    https://github.com/rundeck/rundeck/wiki/FAQ#can-i-do-ssl-offloading

    • 将 RunDeck 设置为 http
    • 在配置文件中,将选项 -Drundeck.jetty.connector.forwarded=true 添加到 RDECK_JVM
    • 设置 framework.rundeck.url 和 grails.serverURL 以使用 https

    在您的情况下,配置文件设置似乎尚未完成。

    个人资料位于/etc/rundeck/profile。 (可能取决于分布)

    将选项-Drundeck.jetty.connector.forwarded=true 添加到RDECK_JVM 如下:

    RDECK_JVM="-Djava.security.auth.login.config=$JAAS_CONF \
           -Dloginmodule.name=$LOGIN_MODULE \
           -Drdeck.config=$RDECK_CONFIG \
           -Drundeck.server.configDir=$RDECK_SERVER_CONFIG \
           -Dserver.datastore.path=$RDECK_SERVER_DATA/rundeck \
           -Drundeck.server.serverDir=$RDECK_INSTALL \
           -Drdeck.projects=$RDECK_PROJECTS \
           -Drdeck.runlogs=$RUNDECK_LOGDIR \
           -Drundeck.config.location=$RDECK_CONFIG/rundeck-config.properties \
           -Djava.io.tmpdir=$RUNDECK_TEMPDIR \
           -Drundeck.server.workDir=$RUNDECK_WORKDIR \
           -Dserver.http.port=$RDECK_HTTP_PORT \
           -Drundeck.jetty.connector.forwarded=true"
    

    【讨论】:

    • 嘿,谢谢你的回答,我忘了提这个,我已经改变了JVM参数:export RDECK_JVM="-Dloginmodule.conf.name=jaas-gdiscombined.conf \ -Dloginmodule.name=combined -Drundeck.jetty.connector.forwarded=true"这没有帮助:(
    • 在我的/etc/rundeck/framework.properties 中,framework.server.url 是 http,framework.rundeck.url 是 https。检查您的设置。
    【解决方案2】:

    你的错误背后的原因

    错误 1: listen 443 你的服务器没有监听 80 端口,要修复它,请在你的配置中添加 listen 80;

    错误 2:location / { proxy_pass http://localhost:4440/; 它将请求重定向到 4440,得到错误代码 302

    错误 3 和 4:错误的代理配置。

    请使用以下配置解决您的问题。

    server {
    
    listen 80;
    
    server_name <hostname>;
    
    location / {
    
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
    
        proxy_redirect http://localhost:4440/ /;
    
        proxy_pass http://localhost:4440/;
        }
    
     }
    

    【讨论】:

      猜你喜欢
      • 2011-03-22
      • 1970-01-01
      • 2018-03-09
      • 2013-12-14
      • 2014-11-06
      • 2012-04-19
      • 1970-01-01
      • 1970-01-01
      • 2015-10-17
      相关资源
      最近更新 更多