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.
This commit is contained in:
cinap_lenrek 2019-11-17 19:04:38 +01:00
parent b31e965ea3
commit 521a0b336c
2 changed files with 24 additions and 6 deletions

View file

@ -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

View file

@ -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) @{