grafana / grafana-kiosk

Kiosk Utility for Grafana
Apache License 2.0
372 stars 60 forks source link

Bypass Oauth stopped working #145

Closed DennieDev closed 1 month ago

DennieDev commented 1 month ago

As mentioned, in the newest release I'm met with my Keycloak login screen again instead of bypassing it to login with a local account.

Can't share much as I had to revert again but thought I'd mention it here aswell.

briangann commented 1 month ago

let me look into this, so version 1.0.7 works ok?

can you share the configuration file (removing anything personal in it), and any flags that are passed?

sounds like a regression and would be easy to fix.

DennieDev commented 1 month ago

Hi Brian,

Yes 1.0.7 works (Some graphs did break this release for some reason but the bypass oauth worked fine)

I can't reach the local net where these Pi's are running from home, I'm back in the office tomorrow but it's basically this: /usr/bin/grafana-kiosk -URL=https://grafana.example -login-method=local -auto-login=true -username=admin -password=xxx -kiosk-mode=full -lxde

I'm not using any configuration files, just this line in /home/pi/.config/lxsession/LXDE-pi/autostart

When I'm back at the office I can provide you with the actual command but I think it's basically that.

briangann commented 1 month ago

i'm not seeing any changes in the code that would trigger this behavior other than chromedp package updates, the logic hasn't changed. a log would help if you can send it

DennieDev commented 1 month ago

Hi Brian,

I had the bypass work a single time on 1.0.8 after multiple retries,

Here's the log when it shows me the Keycloak login page instead of the local login:

GrafanaKiosk Version: v1.0.8
2024/09/26 09:42:14 No config specified, using environment and args
2024/09/26 09:42:14 AutoFit: true
2024/09/26 09:42:14 LXDEEnabled: true
2024/09/26 09:42:14 LXDEHome: /home/pi
2024/09/26 09:42:14 Mode: full
2024/09/26 09:42:14 WindowPosition: 0,0
2024/09/26 09:42:14 WindowSize: 
2024/09/26 09:42:14 ScaleFactor: 1.0
2024/09/26 09:42:14 URL: http://grafana.local:3000/d/ekCfPXnMk/elasticsearch
2024/09/26 09:42:14 LoginMethod: local
2024/09/26 09:42:14 Username: dash-monitor
2024/09/26 09:42:14 Password: *redacted*
2024/09/26 09:42:14 IgnoreCertificateErrors: false
2024/09/26 09:42:14 IsPlayList: false
2024/09/26 09:42:14 UseMFA: false
2024/09/26 09:42:14 Fieldname AutoLogin: true
2024/09/26 09:42:14 Fieldname Username: username
2024/09/26 09:42:14 Fieldname Password: password
2024/09/26 09:42:14 path: /home/pi
2024/09/26 09:42:14 command: /usr/bin/lxpanel
2024/09/26 09:42:14 arg0: --profile
2024/09/26 09:42:14 Waiting for command to finish...
2024/09/26 09:42:14 Command finished with error: exit status 1
2024/09/26 09:42:14 path: /home/pi
2024/09/26 09:42:14 command: /usr/bin/pcmanfm
2024/09/26 09:42:14 arg0: --desktop
2024/09/26 09:42:14 Waiting for command to finish...
2024/09/26 09:42:15 path: /home/pi
2024/09/26 09:42:15 command: /usr/bin/xset
2024/09/26 09:42:15 arg0: --desktop
2024/09/26 09:42:15 Waiting for command to finish...
2024/09/26 09:42:15 path: /home/pi
2024/09/26 09:42:15 command: /usr/bin/xset
2024/09/26 09:42:15 arg0: s
2024/09/26 09:42:15 Waiting for command to finish...
2024/09/26 09:42:15 path: /home/pi
2024/09/26 09:42:15 command: /usr/bin/xset
2024/09/26 09:42:15 arg0: -dpms
2024/09/26 09:42:15 Waiting for command to finish...
2024/09/26 09:42:15 path: /home/pi
2024/09/26 09:42:15 command: /usr/bin/xset
2024/09/26 09:42:15 arg0: s
2024/09/26 09:42:15 Waiting for command to finish...
2024/09/26 09:42:15 DISPLAY not set, autosetting to :0.0
2024/09/26 09:42:15 DISPLAY= :0.0
2024/09/26 09:42:15 XAUTHORITY not set, autosetting
2024/09/26 09:42:15 path: /home/pi
2024/09/26 09:42:15 command: /usr/bin/unclutter
2024/09/26 09:42:15 arg0: -display
2024/09/26 09:42:15 XAUTHORITY= /home/web-iq/.Xauthority
2024/09/26 09:42:15 method  local
2024/09/26 09:42:15 Launching local login kiosk
2024/09/26 09:42:15 Using temp dir: /tmp/chromedp-kiosk3211282521
2024/09/26 09:42:15 Waiting for command to finish...
2024/09/26 09:42:32 KioskMode: Fullscreen
2024/09/26 09:42:32 Navigating to  http://grafana.local:3000/d/ekCfPXnMk/elasticsearch?kiosk=1&autofitpanels
2024/09/26 09:42:32 Sleeping 2000 MS before navigating to url
2024/09/26 09:42:34 Bypassing Azure AD autoLogin at  http://grafana.local:3000/login/local
2024/09/26 09:42:51 target crashed, reload...
2024/09/26 09:42:51 ERROR: could not retrieve document root for F6CE9D59CEC78B31CBA088E4EBA45901: Target crashed (-32000)
briangann commented 1 month ago

From the chromedp repo it appears that error -32000 is caused by the sdk checking too quickly for fields (the page has not completely loaded).

I've added some additional debug and delays with this PR [#148] , can you try this build?

The build for the PR is here:

https://github.com/grafana/grafana-kiosk/actions/runs/11064699854

and the zip file is here:

https://github.com/grafana/grafana-kiosk/actions/runs/11064699854/artifacts/1985796630

I don't have a setup like this right now to test against. This PR [#148] updates the modules as well as inserting delays to give the kiosk time to load pages. The parameter --page-load-delay-ms can be used to pass in how long it will sleep, defaulting to 2 seconds (2000ms)

Thanks!

DennieDev commented 1 month ago

Hi Brian, that does seem to fix it for me, I can't replicate the original issue anymore!

Only issue I have left is that some heavier / bigger graphs stopped showing but that seems to be related to a chromium update.

Thanks!

DennieDev commented 1 month ago

Yes my other issue is something to do with chromium-browser 126.x, I reverted to 124.x and everything is working fine again.

briangann commented 1 month ago

that's great news, i'll merge it and release!