From f59b67a6af1a0d86f691ea19931d10beb7828a6d Mon Sep 17 00:00:00 2001
From: Florent Gluck <florent.gluck@hesge.ch>
Date: Tue, 30 Jul 2024 00:18:04 +0200
Subject: [PATCH] live-exam-os: completed wifi configuration

---
 live_exam_os/Dockerfile                       |  7 ++--
 .../wifi/SOME_SSID.nmconnection.example       | 33 -------------------
 .../config/wifi/wifi.nmconnection.example1    | 32 ++++++++++++++++++
 .../config/wifi/wifi.nmconnection.example2    | 29 ++++++++++++++++
 4 files changed, 64 insertions(+), 37 deletions(-)
 delete mode 100644 live_exam_os/config/wifi/SOME_SSID.nmconnection.example
 create mode 100644 live_exam_os/config/wifi/wifi.nmconnection.example1
 create mode 100644 live_exam_os/config/wifi/wifi.nmconnection.example2

diff --git a/live_exam_os/Dockerfile b/live_exam_os/Dockerfile
index 82e368dd..158476e2 100644
--- a/live_exam_os/Dockerfile
+++ b/live_exam_os/Dockerfile
@@ -67,10 +67,9 @@ ADD ${config_dir}/ntp/timesyncd.conf config/includes.chroot/etc/systemd/
 ADD ${config_dir}/boot_hooks/firewall config/includes.chroot/lib/live/config/9999-firewall
 RUN echo "firewall ${server_ip} ${server_port}\n" >> config/includes.chroot/lib/live/config/9999-firewall
 
-# Install wifi connections.
-# The prefix (here *) must match wifi SSIDs.
-ADD ${config_dir}/wifi/*.nmconnection config/includes.chroot/etc/NetworkManager/system-connections/
-RUN chmod 0600 config/includes.chroot/etc/NetworkManager/system-connections/*.nmconnection
+# Install wifi connection
+ADD ${config_dir}/wifi/wifi.nmconnection config/includes.chroot/etc/NetworkManager/system-connections/
+RUN chmod 0600 config/includes.chroot/etc/NetworkManager/system-connections/wifi.nmconnection
 
 # script hook to set password for nexus user (pwd is "pipo")
 # pwd is the crypt's perl function's first argument. Second arg is salt.
diff --git a/live_exam_os/config/wifi/SOME_SSID.nmconnection.example b/live_exam_os/config/wifi/SOME_SSID.nmconnection.example
deleted file mode 100644
index 123ca387..00000000
--- a/live_exam_os/config/wifi/SOME_SSID.nmconnection.example
+++ /dev/null
@@ -1,33 +0,0 @@
-; The various WIFI connection files can be found in:
-; /etc/NetworkManager/system-connections
-
-[connection]
-; Name of the connection as shown by Network Manager
-id=example
-; A random UUID referencing the connection
-uuid=8a065b14-beb3-4f28-97b5-f560c368ae12
-type=wifi
-
-[wifi]
-; Whether the SSID is hidden or not (true/false)
-hidden=false
-; Name of your WIFI SSID
-ssid=example
-
-[wifi-security]
-key-mgmt=wpa-eap
-
-[802-1x]
-eap=peap;
-identity=janedoe
-password=my_super_strong_password
-phase2-auth=mschapv2
-
-[ipv4]
-method=auto
-
-[ipv6]
-addr-gen-mode=stable-privacy
-method=auto
-
-[proxy]
diff --git a/live_exam_os/config/wifi/wifi.nmconnection.example1 b/live_exam_os/config/wifi/wifi.nmconnection.example1
new file mode 100644
index 00000000..2cfd7e74
--- /dev/null
+++ b/live_exam_os/config/wifi/wifi.nmconnection.example1
@@ -0,0 +1,32 @@
+# On a Debian/Ubuntu system, NetworkManager's WIFI connection files are located in /etc/NetworkManager/system-connections
+
+[connection]
+# Name of the connection as shown by Network Manager
+id=example1
+# Random UUID referencing the connection
+uuid=8a065b14-beb3-4f28-97b5-f560c368ae12
+type=wifi
+
+[wifi]
+# Whether the SSID is hidden or not (true/false)
+hidden=false
+# Name of the WIFI SSID
+ssid=the_empire_strickes_back
+
+[wifi-security]
+key-mgmt=wpa-eap
+
+[802-1x]
+eap=peap;
+identity=luke_skywalker
+password=you_are_not_ready_young_padawan
+phase2-auth=mschapv2
+
+[ipv4]
+method=auto
+
+[ipv6]
+addr-gen-mode=stable-privacy
+method=auto
+
+[proxy]
diff --git a/live_exam_os/config/wifi/wifi.nmconnection.example2 b/live_exam_os/config/wifi/wifi.nmconnection.example2
new file mode 100644
index 00000000..cf6462be
--- /dev/null
+++ b/live_exam_os/config/wifi/wifi.nmconnection.example2
@@ -0,0 +1,29 @@
+# On a Debian/Ubuntu system, NetworkManager's WIFI connection files are located in /etc/NetworkManager/system-connections
+
+[connection]
+# Name of the connection as shown by Network Manager
+id=example2
+# Random UUID referencing the connection
+uuid=8a065b14-beb3-4f28-97b5-f560c368ae12
+type=wifi
+
+[wifi]
+# Whether the SSID is hidden or not (true/false)
+hidden=true
+# Name of the WIFI SSID
+ssid=return_of_the_jedi
+mode=infrastructure
+
+[wifi-security]
+auth-alg=open
+key-mgmt=wpa-psk
+psk=may_the_force_be_with_you
+
+[ipv4]
+method=auto
+
+[ipv6]
+addr-gen-mode=stable-privacy
+method=auto
+
+[proxy]
-- 
GitLab