Add contest WiFi connection

This commit is contained in:
Jan Schär 2024-05-13 22:59:31 +02:00
parent a60638d63b
commit aab293ac19
7 changed files with 33 additions and 2 deletions

View File

@ -3,7 +3,7 @@
set -ex set -ex
# Disable WiFi. # Disable WiFi.
parallel-ssh -x "-F local.ssh_config" -h hostlist nmcli radio wifi off # parallel-ssh -x "-F local.ssh_config" -h hostlist nmcli radio wifi off
# Create hosts file so we don't need DNS. # Create hosts file so we don't need DNS.
parallel-scp -x "-F local.ssh_config" -h hostlist ./config-hosts /etc/hosts parallel-scp -x "-F local.ssh_config" -h hostlist ./config-hosts /etc/hosts

View File

@ -174,6 +174,9 @@ def main():
mkdir("config/includes.chroot/root/.ssh") mkdir("config/includes.chroot/root/.ssh")
run(["cp", f"{script_dir}/config/contestant_authorized_keys", "config/includes.chroot/root/.ssh/authorized_keys"]) run(["cp", f"{script_dir}/config/contestant_authorized_keys", "config/includes.chroot/root/.ssh/authorized_keys"])
edit_file("config/includes.chroot/etc/NetworkManager/system-connections/contest.nmconnection",
lambda s: s.replace("@wifi_password@", config["contestant_wifi_password"]))
# Configure boot options. # Configure boot options.
grub_boot_options = '\n'.join( grub_boot_options = '\n'.join(
f'menuentry "{option["label"]}" {{\n' f'menuentry "{option["label"]}" {{\n'

View File

@ -4,3 +4,6 @@ install_admin_password = "$y$j9T$h5VhMd4KkdmbxdZD1gO0N/$1hvwZgO8pQw13Xd6jaNXbtkb
# Example password: soi # Example password: soi
contestant_root_password = "$y$j9T$h5VhMd4KkdmbxdZD1gO0N/$1hvwZgO8pQw13Xd6jaNXbtkbqVOC4W/ia/KXOcCGYvB" contestant_root_password = "$y$j9T$h5VhMd4KkdmbxdZD1gO0N/$1hvwZgO8pQw13Xd6jaNXbtkbqVOC4W/ia/KXOcCGYvB"
# WiFi passwords must be at least 8 characters
contestant_wifi_password = "12345678"

View File

@ -25,3 +25,6 @@ $DISABLE_DESKTOP /usr/share/applications/gnome-sharing-panel.desktop
# We want to load kexec manually, and execution of kexec is already done by systemd. # We want to load kexec manually, and execution of kexec is already done by systemd.
systemctl disable kexec-load.service systemctl disable kexec-load.service
systemctl disable kexec.service systemctl disable kexec.service
# Restrict access to the config which contains the WiFi password.
chmod og= /etc/NetworkManager/system-connections/contest.nmconnection

View File

@ -0,0 +1,20 @@
[connection]
id=contest
uuid=b4b09615-f7b9-4777-baa0-7812d58a01dd
type=wifi
[wifi]
mode=infrastructure
ssid=contest
[wifi-security]
auth-alg=open
key-mgmt=wpa-psk
psk=@wifi_password@
[ipv4]
method=auto
[ipv6]
addr-gen-mode=default
method=auto

View File

@ -7,7 +7,8 @@
polkit.addRule(function (action, subject) { polkit.addRule(function (action, subject) {
if ( if (
action.id.indexOf("org.freedesktop.ModemManager1.") === 0 || action.id.indexOf("org.freedesktop.ModemManager1.") === 0 ||
action.id.indexOf("org.freedesktop.NetworkManager.") === 0 || (action.id.indexOf("org.freedesktop.NetworkManager.") === 0 &&
action.id !== "org.freedesktop.NetworkManager.wifi.scan") ||
action.id === "org.freedesktop.login1.hibernate" || action.id === "org.freedesktop.login1.hibernate" ||
action.id === "org.freedesktop.packagekit.system-network-proxy-configure" || action.id === "org.freedesktop.packagekit.system-network-proxy-configure" ||
action.id.indexOf("org.freedesktop.udisks2.") === 0 action.id.indexOf("org.freedesktop.udisks2.") === 0

View File

@ -119,6 +119,7 @@ Here is a list of features.
- install and configure ssh server - install and configure ssh server
- set root password - set root password
- set `authorized_keys` for root - set `authorized_keys` for root
- contest WiFi connection
- automatic login - automatic login
- set browser homepage and bookmarks to https://contest.soi.ch - set browser homepage and bookmarks to https://contest.soi.ch
- Gnome Shell extension which displays the user name in the top bar - Gnome Shell extension which displays the user name in the top bar