我建立了一个新网站,并希望使用以下命令在Docker安装程序中运行Keycloak:

docker run \
 -v /etc/letsencrypt/live/data-mastery.com/fullchain.pem:/etc/x509/https/tls.crt \
 -v /etc/letsencrypt/live/data-mastery.com/privkey.pem:/etc/x509/https/tls.key \
 -e KEYCLOAK_USER=myadmin \
 -e KEYCLOAK_PASSWORD=mypassword \
 -e PROXY_ADDRESS_FORWARDING=true \
 -p 8443:8443 jboss/keycloak

这是我的nginx:
server {
    listen 80 default_server;
    listen [::]:80 default_server;

    root /var/www/html;

    index index.html index.htm index.nginx-debian.html;

    server_name _;

    location / {
        try_files $uri $uri/ =404;
    }

}

server {
  listen                443;
  server_name           data-mastery.com;


  ssl on;
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
  ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384;
  ssl_prefer_server_ciphers on;
  ssl_session_cache shared:SSL:10m;

  ssl_certificate /etc/letsencrypt/live/data-mastery.com/fullchain.pem; # managed by Certbot
  ssl_certificate_key /etc/letsencrypt/live/data-mastery.com/privkey.pem; # managed by Certbot

   location /auth/ {
       proxy_pass          https://127.0.0.1:8443;

       proxy_http_version 1.1;
       proxy_set_header Upgrade $http_upgrade;
       proxy_set_header Connection "upgrade";
       proxy_read_timeout 600s;

       proxy_redirect    off;
       proxy_set_header  Host             $http_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;
     }

}



server {
    if ($host = data-mastery.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    listen 80 ;
    listen [::]:80 ;
    server_name data-mastery.com;
    return 404; # managed by Certbot

}

我得到以下错误/警告,它实际上可以帮助我了解Keycloak是否有有效的SSL设置:



我设置了所有密码,ssl协议(protocol),即使似乎有一个有效的SSL连接,它仍然无法正常工作。但是,当我访问/ auth端点时,出现错误。我很无奈。

最佳答案

也许您可以添加配置接受的密码列表。
尝试:
ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384;
您还可以配置所需的协议(protocol)
ssl_protocols TLSv1.2 TLSv1.3;


此错误告诉我们您的客户端和服务器没有共同的密码来进行通信。
检查客户端使用的密码和服务器使用的密码。确保至少有一个共同点

08-28 14:41