我正在尝试使用 Keycloack 在 zabbix 中设置条目。我的设置如下:
- Zabbix 在 apache host1:62200 中启动
- 密钥斗篷在 host2:63665 中开始
- Nginx 是 host1:62236 上的入口点:它处理“虚拟主机”,将请求转发到 keycloak-proxy(localhost:4180)。
- 我在 zabbix host1:62237 上安装了 nginx 代理,因为我无法通过 host1:62200/zabbix 的方式
keycloak-gatekeeper 配置了 client_id、client_secret 等,用于对 Keycloak 进行用户身份验证;Apache 上的 Zabbix 仪表板,默认设置:我启用 HTTP 身份验证。
它配置网守
client-id: zabbix_tst
client-secret: f2d8a52c-ebca-4fdb-85b7-36b203a75h54
discovery-url: http://host2:63665/auth/realms/demo
enable-default-deny: true
enable-logout-redirect: true
enable-logging: true
listen: 0.0.0.0:4180
redirection-url: http://host1:62236
upstream-url: http://127.0.0.1:62237
secure-cookie: false
enable-authorization-header: true
#enable-refresh-tokens: true
enable-session-cookies: true
scopes:
- data
- email
add-claims:
- name
- email
- given_name
网守的 Nginx 配置
server {
listen 62236;
root / ;
access_log /var/log/nginx/kc.access.log;
server_name keycloak;
index index.html;
location / {
proxy_pass http://127.0.0.1:4180;
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 http;
proxy_set_header X-Forwarded-Scheme http;
proxy_set_header X-Scheme http;
#proxy_redirect off;
}
location /oauth/callback {
proxy_pass http://127.0.0.1:4180;
#proxy_set_header X-Auth-Name $email;
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 http;
proxy_set_header X-Forwarded-Scheme http;
proxy_set_header X-Scheme http;
}
location /oauth/authorize {
proxy_pass http://127.0.0.1:4180;
proxy_set_header X-Auth-Name $request_uri;
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 http;
proxy_set_header X-Forwarded-Scheme http;
proxy_set_header X-Scheme https;
}
}
我得到授权表格并重定向到 zabbix,但总是错误地认为我没有在 zabbix 中获得授权。
我究竟做错了什么?