From 5b0557b8d0ffef9f813c15cea19323a5120b648f Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 22 Jul 2021 13:50:09 +0200 Subject: [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. --- .../opt/openslx/scripts/kiosk-launch.d/00-chromium | 24 ++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'core/modules/kiosk-chromium') 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 -- cgit v1.2.3-55-g7522