summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/root
diff options
context:
space:
mode:
Diffstat (limited to 'modules/luci-base/root')
-rwxr-xr-xmodules/luci-base/root/usr/libexec/rpcd/luci15
-rw-r--r--modules/luci-base/root/usr/share/rpcd/acl.d/luci-base.json4
2 files changed, 18 insertions, 1 deletions
diff --git a/modules/luci-base/root/usr/libexec/rpcd/luci b/modules/luci-base/root/usr/libexec/rpcd/luci
index 99c172a96b..fb15dab6a5 100755
--- a/modules/luci-base/root/usr/libexec/rpcd/luci
+++ b/modules/luci-base/root/usr/libexec/rpcd/luci
@@ -396,6 +396,7 @@ local methods = {
rv.zram = fs.access("/sys/class/zram-control")
rv.sysntpd = fs.readlink("/usr/sbin/ntpd") and true
rv.ipv6 = fs.access("/proc/net/ipv6_route")
+ rv.dropbear = fs.access("/usr/sbin/dropbear")
local wifi_features = { "eap", "11n", "11ac", "11r", "11w", "acs", "sae", "owe", "suiteb192" }
@@ -575,6 +576,20 @@ local methods = {
return { error = err }
end
end
+ },
+
+ setPassword = {
+ args = { username = "root", password = "password" },
+ call = function(args)
+ local util = require "luci.util"
+ return {
+ result = (os.execute("(echo %s; sleep 1; echo %s) | passwd %s >/dev/null 2>&1" %{
+ luci.util.shellquote(args.password),
+ luci.util.shellquote(args.password),
+ luci.util.shellquote(args.username)
+ }) == 0)
+ }
+ end
}
}
diff --git a/modules/luci-base/root/usr/share/rpcd/acl.d/luci-base.json b/modules/luci-base/root/usr/share/rpcd/acl.d/luci-base.json
index d364508c27..32cb10596b 100644
--- a/modules/luci-base/root/usr/share/rpcd/acl.d/luci-base.json
+++ b/modules/luci-base/root/usr/share/rpcd/acl.d/luci-base.json
@@ -24,6 +24,7 @@
"/": [ "list" ],
"/*": [ "list" ],
"/etc/crontabs/root": [ "read" ],
+ "/etc/dropbear/authorized_keys": [ "read" ],
"/etc/rc.local": [ "read" ],
"/proc/sys/kernel/hostname": [ "read" ]
},
@@ -42,13 +43,14 @@
"cgi-io": [ "upload", "/etc/luci-uploads/*" ],
"file": {
"/etc/crontabs/root": [ "write" ],
+ "/etc/dropbear/authorized_keys": [ "write" ],
"/etc/luci-uploads/*": [ "write" ],
"/etc/rc.local": [ "write" ]
},
"ubus": {
"file": [ "write", "remove" ],
"iwinfo": [ "scan" ],
- "luci": [ "setInitAction", "setLocaltime" ],
+ "luci": [ "setInitAction", "setLocaltime", "setPassword" ],
"uci": [ "add", "apply", "confirm", "delete", "order", "set", "rename" ]
},
"uci": [ "*" ]