2
0

dropbear.defaults 556 B

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