diff options
author | Simon Rettberg | 2021-07-22 13:50:09 +0200 |
---|---|---|
committer | Simon Rettberg | 2021-07-22 13:50:09 +0200 |
commit | 5b0557b8d0ffef9f813c15cea19323a5120b648f (patch) | |
tree | cc636e2590b066644d16a4bc0a1411829a702ac1 /core/modules/kiosk-chromium | |
parent | [kiosk-chromium] Simplify the awk (diff) | |
download | mltk-5b0557b8d0ffef9f813c15cea19323a5120b648f.tar.gz mltk-5b0557b8d0ffef9f813c15cea19323a5120b648f.tar.xz mltk-5b0557b8d0ffef9f813c15cea19323a5120b648f.zip |
[kiosk-chromium] if interactive mode and user was active, reload -> exit
If a user was active (measured by idle timer) and chromium is running in
interactive mode, i.e. with full UI and tabs, exit the session if the
reload timeout is reached. This is a security measure, since we assume
that the browser in interactive mode enables the user to log into
websites etc., and might not log out everywhere when leaving.
Diffstat (limited to 'core/modules/kiosk-chromium')
-rw-r--r-- | core/modules/kiosk-chromium/data/opt/openslx/scripts/kiosk-launch.d/00-chromium | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/core/modules/kiosk-chromium/data/opt/openslx/scripts/kiosk-launch.d/00-chromium b/core/modules/kiosk-chromium/data/opt/openslx/scripts/kiosk-launch.d/00-chromium index d94b30df..32eb7eb4 100644 --- a/core/modules/kiosk-chromium/data/opt/openslx/scripts/kiosk-launch.d/00-chromium +++ b/core/modules/kiosk-chromium/data/opt/openslx/scripts/kiosk-launch.d/00-chromium @@ -81,6 +81,7 @@ if [ -n "$SLX_BROWSER_RELOAD_SECS" ] && [ "$SLX_BROWSER_RELOAD_SECS" -gt 0 ]; th ( wid= wpid= + activity=init while true; do if [ -z "$wid" ]; then wid="$(xdotool search --onlyvisible --class browser)" @@ -101,13 +102,24 @@ if [ -n "$SLX_BROWSER_RELOAD_SECS" ] && [ "$SLX_BROWSER_RELOAD_SECS" -gt 0 ]; th exit 0 fi current_idle="$(idle-daemon --send 'get :0' | grep -oP '(?<=idleSeconds=)[0-9]+')" - if [ "$current_idle" -ge "$SLX_BROWSER_RELOAD_SECS" ]; then - xdotool windowactivate "$wid" - xdotool key Alt+Home - sleep 10 - continue + if (( current_idle >= SLX_BROWSER_RELOAD_SECS )); then + if [ "$activity" = "yes" ] && [ -n "$SLX_BROWSER_INTERACTIVE" ]; then + # activity was seen, interactive browser (UI) -> kill session + killall chromium-browser + loginctl terminate-user demo + else + xdotool windowactivate "$wid" + xdotool key Alt+Home + sleep 3 + activity=init + continue + fi + elif [ "$activity" = "init" ]; then + activity=no + else + activity=yes fi - sleep "$(( SLX_BROWSER_RELOAD_SECS - current_idle ))" + sleep "$(( 1 + SLX_BROWSER_RELOAD_SECS - current_idle ))" done ) & fi |