diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2019-11-17 19:04:38 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2019-11-17 19:04:38 +0100 |
commit | 521a0b336c7df8ad79efc7848c95a7b060beea27 (patch) | |
tree | c3fd7364aac44a308922108b68e82672bb8d1d4b /sys | |
parent | b31e965ea36f21cf4da91ae33d840999e10a76d4 (diff) |
bootrc: for wireless netbooting, set the WPA/WPA2 preshard key with wpapsk=password boot parameter
this allows automatic netbooting without password prompt
for the wirelss network.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/man/8/plan9.ini | 11 | ||||
-rwxr-xr-x | sys/src/9/boot/net.rc | 19 |
2 files changed, 24 insertions, 6 deletions
diff --git a/sys/man/8/plan9.ini b/sys/man/8/plan9.ini index a684860c9..296439feb 100644 --- a/sys/man/8/plan9.ini +++ b/sys/man/8/plan9.ini @@ -420,9 +420,6 @@ file and can be read out like: cat /net/ether1/ifstats .EE Ad-hoc mode or WEP encryption is currently not supported. -To enable WPA/WPA2 encryption, see -.IR wpa (8) -for details. .TP .B rt2860 Ralink Technology PCI/PCI-Express wireless adapters require @@ -443,6 +440,14 @@ to be present on attach in or .B /boot. See iwl section above for configuration details. +.SS \fLwpapsk\fI=password\fP +WPA/WPA2 encryption +is detected automatically and a prompt for the +.I password +will appear when using the WIFI interface for netbooting. +To avoid the prompt, the +.I password +can be specified with the boot parameter above. .SS \fLnora6= Disable automatic IPv6 configuration from incoming router advertisements. .SS DISKS, TAPES diff --git a/sys/src/9/boot/net.rc b/sys/src/9/boot/net.rc index 1a194dd84..54d108eed 100755 --- a/sys/src/9/boot/net.rc +++ b/sys/src/9/boot/net.rc @@ -9,10 +9,23 @@ fn confignet{ } # setup wifi encryption if any - if(~ $1 ether && ~ $service terminal && test -x /bin/aux/wpa){ - if(grep -s '^status: need authentication' $2/ifstats >[2]/dev/null){ - aux/wpa -p $2 + if(~ $1 ether && test -x /bin/aux/wpa){ + essid=`{grep '^essid: ' $2/ifstats | sed 's/^essid: //; q'} + if(! ~ $#essid 0){ + if(! ~ $#wpapsk 0 || grep -s '^status: need authentication' $2/ifstats >[2]/dev/null){ + x=(aux/wpa -s $"essid) + if(! ~ $#wpapsk 0){ + echo 'key proto=wpapsk' `{!password=$"wpapsk whatis essid !password} > /mnt/factotum/ctl + wpapsk=() + } + if not { + x=($x -p) + } + $x $2 + } + essid=() } + rm -f /env/^(essid wpapsk) } if(~ $1 ether gbe && ~ $#* 2) @{ |