[key-manager] remove default master key (#5998)

When initializing, we should use randomly generated network parameters
instead of default ones, to eliminate the possibility of unintentional
use of default credentials.
This commit is contained in:
Moandor
2020-12-30 11:25:48 -08:00
committed by GitHub
parent 263084baef
commit 069e26b51e
13 changed files with 87 additions and 124 deletions
+34 -23
View File
@@ -29,50 +29,61 @@
source "tests/scripts/expect/_common.exp"
proc setup_two_nodes {{childmode {r}} {should_spawn_node true}} {
set JOINER_PSK "J01NME"
proc setup_two_nodes {{childmode "r"} {should_spawn_node true}} {
# Sets up a Thread network with 2 nodes, spawn_1 as the leader and spawn_2
# as a child.
set psk "J01NME"
if {$should_spawn_node} {
spawn_node 2
} else {
switch_node 2
}
send "eui64\n"
expect -re {([0-9a-f]{16})}
set eui64 $expect_out(1,string)
expect "Done"
# Sets up a Thread network with node 1 as the leader.
if {$should_spawn_node} {
spawn_node 1
} else {
switch_node 1
}
setup_leader
setup_node 2 $childmode "child"
}
send "commissioner start\n"
proc setup_node {node {mode "r"} {role "child"}} {
switch_node $node
send "eui64\n"
expect "eui64"
expect -re {([0-9a-f]{16})}
set eui64 $expect_out(1,string)
expect "Done"
expect "Commissioner: active"
send "commissioner joiner add $eui64 $psk\n"
switch_node 1
send "commissioner state\n"
expect {
"disabled" {
expect "Done"
send "commissioner start\n"
expect "Done"
expect "Commissioner: active"
}
"active" {
expect "Done"
}
}
send "commissioner joiner add $eui64 $::JOINER_PSK\n"
expect "Done"
wait_for "netdata steeringdata check $eui64" "Done"
send "channel\n"
expect -re {(\d+)}
set channel $expect_out(1,string)
expect "Done"
switch_node 2
send "mode $childmode\n"
switch_node $node
send "mode $mode\n"
expect "Done"
send "ifconfig up\n"
expect "Done"
send "joiner start $psk\n"
send "joiner start $::JOINER_PSK\n"
expect "Done"
wait_for "" "Join success"
send "thread start\n"
expect "Done"
wait_for "state" "child"
wait_for "state" $role
expect "Done"
switch_node 1
send "commissioner joiner remove $eui64\n"
expect "Done"
}