| b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 | [ ! -s /etc/dropbear/authorized_keys ] || exit 0 | 
 | 2 |  | 
 | 3 | . /usr/share/libubox/jshn.sh | 
 | 4 |  | 
 | 5 | json_init | 
 | 6 | json_load "$(cat /etc/board.json)" | 
 | 7 | json_select credentials | 
 | 8 | 	json_get_keys keys ssh_authorized_keys | 
 | 9 | 	[ -z "$keys" ] || { | 
 | 10 | 		touch /etc/dropbear/authorized_keys | 
 | 11 | 		uci set dropbear.@dropbear[-1].PasswordAuth='off' | 
 | 12 | 		uci set dropbear.@dropbear[-1].RootPasswordAuth='off' | 
 | 13 | 	} | 
 | 14 | 	json_select ssh_authorized_keys | 
 | 15 | 		for key in $keys; do | 
 | 16 | 	                json_get_var val "$key" | 
 | 17 | 	                echo "$val" >> /etc/dropbear/authorized_keys | 
 | 18 | 		done | 
 | 19 | 	json_select .. | 
 | 20 | json_select .. |