From c84d685312b9d01ef87c313ddac41fa66010655d Mon Sep 17 00:00:00 2001
From: Florent Gluck <florent.gluck@hesge.ch>
Date: Tue, 16 Jul 2024 11:48:18 +0200
Subject: [PATCH] Fix live_exam_os starting script issue

---
 live_exam_os/Dockerfile            |  2 +-
 live_exam_os/config/live-exam-hook | 29 ++++++++++++++++-------------
 2 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/live_exam_os/Dockerfile b/live_exam_os/Dockerfile
index 7a44d267..72aaa8f8 100644
--- a/live_exam_os/Dockerfile
+++ b/live_exam_os/Dockerfile
@@ -51,7 +51,7 @@ ADD ${config_dir}/isolinux_stdmenu.cfg config/includes.binary/isolinux/stdmenu.c
 # script hook ran at boot time (install system wide cert and firewall)
 ADD ${config_dir}/live-exam-hook config/includes.chroot/lib/live/config/9999-custom
 # update server destination from docker's variable (all others IP are banned)
-RUN echo "Firewall ${server_ip}\n" >> config/includes.chroot/lib/live/config/9999-custom
+RUN echo "firewall ${server_ip}\n" >> config/includes.chroot/lib/live/config/9999-custom
 
 # install wifi template
 ADD ${config_dir}/WIFI.nmconnection config/includes.chroot/etc/NetworkManager/system-connections/
diff --git a/live_exam_os/config/live-exam-hook b/live_exam_os/config/live-exam-hook
index 1a6d9978..adfad835 100755
--- a/live_exam_os/config/live-exam-hook
+++ b/live_exam_os/config/live-exam-hook
@@ -10,11 +10,8 @@
 ## This is free software, and you are welcome to redistribute it
 ## under certain conditions; see COPYING for details.
 
-
-#set -e
-
 # This function is here just for reference as it is not used.
-Config ()
+add_nexus_certs ()
 {
     if [ ! -e /etc/ssl/certs/nexus-server.pem ] && [ -e /usr/share/ca-certificates/nexus-server/nexus-server.crt ]
     then
@@ -23,15 +20,21 @@ Config ()
     fi
 }
 
-Firewall ()
+disable_screen_blanking()
+{
+    echo "xset s off" > /etc/X11/Xsession.d/99xsetoff
+}
+
+firewall ()
 {
-  ufw default deny incoming
-  ufw default deny outgoing
-#  ufw allow in from any port 68 to any port 67 proto udp
-#  ufw allow from any to any port 22
-  ufw allow out from any to $1 port 1025:65535 proto tcp
-  ufw allow out from any to $1 port 1025:65535 proto udp
-  ufw enable
+ufw default deny incoming
+    ufw default deny outgoing
+    ufw allow in from any port 68 to any port 67 proto udp
+    # ufw allow from any to any port 22
+    ufw allow out from any to $1 port 1025:65535 proto tcp
+    ufw allow out from any to $1 port 1025:65535 proto udp
+    ufw enable
 }
 
-#Config
+#add_nexus_certs
+disable_screen_blanking
-- 
GitLab