summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2019-09-16 07:49:05 +0200
committerJo-Philipp Wich <jo@mein.io>2019-09-16 07:49:05 +0200
commit3e1cf14ad16147ef749ef77e86470a6d83df50ff (patch)
tree8e44f0de445f14f2e499d027e03cb130b1464771
parent9ecfe33edd835672226279b7c77fbfe4e2b6034b (diff)
luci-base: add luci/setPassword rpc method, dropbear feature flag
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rwxr-xr-xmodules/luci-base/root/usr/libexec/rpcd/luci15
1 files changed, 15 insertions, 0 deletions
diff --git a/modules/luci-base/root/usr/libexec/rpcd/luci b/modules/luci-base/root/usr/libexec/rpcd/luci
index 99c172a96..fb15dab6a 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
}
}