-
Notifications
You must be signed in to change notification settings - Fork 0
/
eduroam_setup.py
45 lines (37 loc) · 1.18 KB
/
eduroam_setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import os
import subprocess
def setup_eduroam():
# Download the certificate
os.system(
"sudo wget -O /usr/share/ca-certificates/uob-net-ca.crt https://www.wireless.bris.ac.uk/certs/eaproot/uob-net-ca.crt"
)
os.system("sudo update-ca-certificates")
# Ask the user for their eduroam credentials
identity = input("Please enter your UoB username (e.g., [email protected]): ")
password = input("Please enter your UoB password: ")
# Create the wpa_supplicant.conf content
wpa_content = f"""
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=GB
network={{
ssid="eduroam"
key_mgmt=WPA-EAP
auth_alg=OPEN
eap=PEAP TTLS
identity="{identity}"
anonymous_identity="[email protected]"
password="{password}"
ca_cert="/usr/share/ca-certificates/uob-net-ca.crt"
phase1="peaplabel=0"
phase2="auth=MSCHAPV2"
priority=999
proactive_key_caching=1
}}
"""
with open("/etc/wpa_supplicant/wpa_supplicant.conf", "w") as f:
f.write(wpa_content)
setup_eduroam()
# Restart the network and then reboot the Raspberry Pi
os.system("sudo wpa_cli -i wlan0 reconfigure")
os.system("sudo reboot")