base-files: uci-defaults: allow setting default credentials and ssh keys
Introduce new uci-default functions:
- ucidef_set_root_password_hash [hash]
- ucidef_set_root_password_plain [plaintext]
- ucidef_set_ssh_authorized_key [ssh key]
Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
@@ -677,6 +677,29 @@ ucidef_set_country() {
|
|||||||
json_select ..
|
json_select ..
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ucidef_set_root_password_plain() {
|
||||||
|
local passwd="$1"
|
||||||
|
json_select_object credentials
|
||||||
|
json_add_string root_password_plain "$passwd"
|
||||||
|
json_select ..
|
||||||
|
}
|
||||||
|
|
||||||
|
ucidef_set_root_password_hash() {
|
||||||
|
local passwd="$1"
|
||||||
|
json_select_object credentials
|
||||||
|
json_add_string root_password_hash "$passwd"
|
||||||
|
json_select ..
|
||||||
|
}
|
||||||
|
|
||||||
|
ucidef_set_ssh_authorized_key() {
|
||||||
|
local ssh_key="$1"
|
||||||
|
json_select_object credentials
|
||||||
|
json_select_array ssh_authorized_keys
|
||||||
|
json_add_string "" "$ssh_key"
|
||||||
|
json_select ..
|
||||||
|
json_select ..
|
||||||
|
}
|
||||||
|
|
||||||
ucidef_set_ntpserver() {
|
ucidef_set_ntpserver() {
|
||||||
local server
|
local server
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user