如何在不中断登录的情况下将Thruk http请求重定向到https

时间:2020-07-31 14:22:31

标签: apache thruk

系统详细信息

  • Ubuntu 20.04
  • 瑟鲁克2.36
  • Apache 2.4.41
  • perl 5.30.0
  • liblwp-protocol-https-perl 6.07
  • openssl 1.1.1

我或多或少地遵循thruk documentation

我的麻烦

我可以使该站点通过http和https正常运行。我正在尝试将所有http流量重定向到https。重定向之后,我仍然可以使用现有的cookie访问该网站,但是注销后就无法重新登录。我已将错误跟踪到cookie_auth_restricted_url,但是我无法弄清楚它出了什么问题。

这是我的设置,其中一些不相关的设置会被截断:
/etc/apache2/sites-enabled/000-default.conf

<VirtualHost *:80>
 ServerName naemon.mydomain.local
 Redirect / https://naemon.mydomain.local/
</VirtualHost>
<VirualHost> *:443>
 ServerName naemon.mydomain.local
 DocumentRoot /var/www/html
 SSLEngine on
 SSLCertificateFile /my/cert/file
 SSLCertificateKeyFile /my/key/file
</VirutalHost>

/etc/apache2/conf-enabled/thruk_cookie_auth_vhost.conf

Include /usr/share/thruk/thruk_cookie_auth.include

/etc/thruk/thuk_local.conf(我也在这里尝试过使用fqdn,这会导致相同的错误)

cookie_auth_restricted_url=https://localhost/thruk/cgi-bin/restricted.cgi

如果然后尝试登录,它什么也没做,我在apache错误日志中找到了以下内容。

$VAR1 = bless( {
                 '_content' => 'Can\'t connect to localhost:443 (certificate verify failed)

SSL connect attempt failed error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed at /usr/lib/thruk/perl5/LWP/Protocol/http.pm line 50.
',
                 '_headers' => bless( {
                                        '::std_case' => {
                                                          'client-date' => 'Client-Date',
                                                          'client-warning' => 'Client-Warning'
                                                        },
                                        'client-date' => 'Fri, 31 Jul 2020 14:07:12 GMT',
                                        'client-warning' => 'Internal response',
                                        'content-type' => 'text/plain'
                                      }, 'HTTP::Headers' ),
                 '_msg' => 'Can\'t connect to localhost:443 (certificate verify failed)',
                 '_rc' => 500,
                 '_request' => bless( {
                                        '_content' => '',
                                        '_headers' => bless( {
                                                               'content-length' => 0,
                                                               'content-type' => 'application/x-www-form-urlencoded',
                                                               'user-agent' => 'thruk_auth'
                                                             }, 'HTTP::Headers' ),
                                        '_method' => 'POST',
                                        '_uri' => bless( do{\(my $o = 'https://localhost/thruk/cgi-bin/restricted.cgi')}, 'URI::https' )
                                      }, 'HTTP::Request' )
               }, 'HTTP::Response' );

0 个答案:

没有答案