From 1204e244b2ffe705db0930e8e8d319e1bc34f3b2 Mon Sep 17 00:00:00 2001 From: Florent Gluck <florent.gluck@hesge.ch> Date: Tue, 16 Jul 2024 16:04:33 +0200 Subject: [PATCH] WIP new live-exam-os --- live_exam_os/Dockerfile | 2 ++ live_exam_os/build_live_exam_iso | 2 +- live_exam_os/config/live-exam-hook | 18 ++++++++++++++---- live_exam_os/config/packages.list.chroot | 1 + 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/live_exam_os/Dockerfile b/live_exam_os/Dockerfile index 72aaa8f8..620dfeae 100644 --- a/live_exam_os/Dockerfile +++ b/live_exam_os/Dockerfile @@ -6,6 +6,7 @@ RUN apt-get update && apt-get install -y \ && rm -rf /var/lib/apt/lists/* ARG server_ip +ARG server_port ARG config_dir #ARG nexus_cert @@ -52,6 +53,7 @@ ADD ${config_dir}/isolinux_stdmenu.cfg config/includes.binary/isolinux/stdmenu.c 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 sed s,_SERVER_PORT_,${server_port},g config/includes.chroot/lib/live/config/9999-custom > config/includes.chroot/lib/live/config/9999-custom.new && mv config/includes.chroot/lib/live/config/9999-custom.new 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/build_live_exam_iso b/live_exam_os/build_live_exam_iso index 0d703d2f..844324f8 100755 --- a/live_exam_os/build_live_exam_iso +++ b/live_exam_os/build_live_exam_iso @@ -18,7 +18,7 @@ usage () { } build_docker_image () { - if docker buildx build . -t "$DOCKER_IMG" --build-arg config_dir=$CONFIG_DIR --build-arg server_ip=$SERVER_IP ; then + if docker buildx build . -t "$DOCKER_IMG" --build-arg config_dir=$CONFIG_DIR --build-arg server_ip=$SERVER_IP --build-arg server_port=$SERVER_PORT ; then echo "Docker image \"$DOCKER_IMG\" sucessfully built" else echo "FAILED building docker image!" && abort diff --git a/live_exam_os/config/live-exam-hook b/live_exam_os/config/live-exam-hook index adfad835..acabcf69 100755 --- a/live_exam_os/config/live-exam-hook +++ b/live_exam_os/config/live-exam-hook @@ -22,19 +22,29 @@ add_nexus_certs () disable_screen_blanking() { - echo "xset s off" > /etc/X11/Xsession.d/99xsetoff + echo "xset s off" >> /home/nexus/.xsession +} + +max_screen_brightness() +{ + brightnessctl set 100% } firewall () { -ufw default deny incoming + 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 from any to any port 80 + ufw allow from any to any port 443 + ufw allow from any to any port _SERVER_PORT_ 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 allow from any to any port 22 ufw enable } #add_nexus_certs -disable_screen_blanking + +#max_screen_brightness +#disable_screen_blanking diff --git a/live_exam_os/config/packages.list.chroot b/live_exam_os/config/packages.list.chroot index 00810d2c..0350e41c 100644 --- a/live_exam_os/config/packages.list.chroot +++ b/live_exam_os/config/packages.list.chroot @@ -11,3 +11,4 @@ virt-viewer firmware-iwlwifi network-manager network-manager-gnome +brightnessctl -- GitLab