mirror of
https://github.com/Telecominfraproject/wlan-ucentral-schema.git
synced 2026-01-27 02:23:33 +00:00
Add system-password to the schema
With this addition, a desired password can be configured through ucentral config Signed-off-by: Venkat Chimata <venkata@shasta.cloud>
This commit is contained in:
committed by
John Crispin
parent
8b3701bf2e
commit
42e59d5524
@@ -996,6 +996,14 @@ let shell = {
|
||||
}
|
||||
system("(echo " + passwd + "; sleep 1; echo " + passwd + ") | passwd root");
|
||||
conn.call("ucentral", "password", { passwd });
|
||||
},
|
||||
|
||||
/**
|
||||
* Set system password
|
||||
*/
|
||||
system_password: function(passwd) {
|
||||
system("(echo " + passwd + "; sleep 1; echo " + passwd + ") | passwd root");
|
||||
conn.call("ucentral", "password", { passwd });
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -14,6 +14,9 @@ set system.@system[-1].timezone={{ s(unit.timezone) }}
|
||||
{% endif %}
|
||||
set system.@system[-1].leds_off={{ b(!unit.leds_active) }}
|
||||
{%
|
||||
shell.password(unit.random_password);
|
||||
if (unit.system_password)
|
||||
shell.system_password(unit.system_password);
|
||||
else
|
||||
shell.password(unit.random_password);
|
||||
services.set_enabled("led", true);
|
||||
%}
|
||||
|
||||
@@ -37,6 +37,10 @@ properties:
|
||||
The device shall create a random root password and tell the gateway about it.
|
||||
type: boolean
|
||||
default: false
|
||||
system-password:
|
||||
description:
|
||||
System-config string that holds the password for main (root / admin) user to apply.
|
||||
type: string
|
||||
beacon-advertisement:
|
||||
description:
|
||||
The TIP vendor IEs that shall be added to beacons
|
||||
|
||||
@@ -164,6 +164,17 @@ function instantiateUnit(location, value, errors) {
|
||||
obj.random_password = false;
|
||||
}
|
||||
|
||||
function parseSystemPassword(location, value, errors) {
|
||||
if (type(value) != "string")
|
||||
push(errors, [ location, "must be of type string" ]);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
if (exists(value, "system-password")) {
|
||||
obj.system_password = parseSystemPassword(location + "/system-password", value["system-password"], errors);
|
||||
}
|
||||
|
||||
function parseBeaconAdvertisement(location, value, errors) {
|
||||
if (type(value) == "object") {
|
||||
let obj = {};
|
||||
|
||||
@@ -49,6 +49,10 @@
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"system-password": {
|
||||
"description": "System-config string that holds the password for main (root / admin) user to apply.",
|
||||
"type": "string"
|
||||
},
|
||||
"beacon-advertisement": {
|
||||
"description": "The TIP vendor IEs that shall be added to beacons",
|
||||
"type": "object",
|
||||
|
||||
@@ -84,6 +84,9 @@
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"system-password": {
|
||||
"type": "string"
|
||||
},
|
||||
"beacon-advertisement": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@@ -94,6 +94,10 @@
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"system-password": {
|
||||
"description": "System-config string that holds the password for main (root / admin) user to apply.",
|
||||
"type": "string"
|
||||
},
|
||||
"beacon-advertisement": {
|
||||
"description": "The TIP vendor IEs that shall be added to beacons",
|
||||
"type": "object",
|
||||
|
||||
Reference in New Issue
Block a user