aboutsummaryrefslogtreecommitdiff
path: root/net/cgi-io/Makefile
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2019-12-13 09:08:51 +0100
committerJohn Crispin <john@phrozen.org>2019-12-13 10:38:35 +0100
commitb2a890f6adb9014a6db38c0b4231c42598a8512d (patch)
treeb7500d9ab5a3409fc7a91a0000793d29cc79e9f4 /net/cgi-io/Makefile
parent06d36ca794ef4f67dd1a3be6ccb6ddc075437fd2 (diff)
cgi-io: implement exec action
Implement a new "cgi-exec" applet which allows to invoke remote commands and stream their stdandard output back to the client via HTTP. This is needed in cases where large amounts of data or binary encoded contents such as tar archives need to be transferred, which are unsuitable to be transported via ubus directly. The exec call is guarded by the same ACL semantics as rpcd's file plugin, means in order to be able to execute a command remotely, the ubus session identified by the given session ID must have read access to the "exec" function of the "cgi-io" scope and an explicit "exec" permission rule for the invoked command in the "file" scope. In order to initiate a transfer, a POST request in x-www-form-urlencoded format must be sent to the applet, with one field "sessionid" holding the login session and another field "command" specifiying the commandline to invoke. Further optional fields are "filename" which - if present - will cause the download applet to set a Content-Dispostition header and "mimetype" which allows to let the applet respond with a specific type instead of the default "application/octet-stream". Below is an example for the required ACL rules to grant exec access to both the "date" and "iptables" commands. The "date" rule specifies the base name of the executable and thus allows invocation with arbitrary parameters while the latter "iptables" rule merely allows one specific set of arguments which must appear exactly in the given order. ubus call session grant '{ "ubus_rpc_session": "...", "scope": "cgi-io", "objects": [ [ "exec", "read" ] ] }' ubus call session grant '{ "ubus_rpc_session": "...", "scope": "file", "objects": [ [ "/bin/date", "exec" ], [ "/usr/sbin/iptables -n -v -L", "exec" ] ] }' Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'net/cgi-io/Makefile')
-rw-r--r--net/cgi-io/Makefile3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/cgi-io/Makefile b/net/cgi-io/Makefile
index 92cca4fa0..5107cd61c 100644
--- a/net/cgi-io/Makefile
+++ b/net/cgi-io/Makefile
@@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=cgi-io
-PKG_RELEASE:=14
+PKG_RELEASE:=15
PKG_LICENSE:=GPL-2.0-or-later
@@ -40,6 +40,7 @@ define Package/cgi-io/install
$(LN) ../../usr/libexec/cgi-io $(1)/www/cgi-bin/cgi-upload
$(LN) ../../usr/libexec/cgi-io $(1)/www/cgi-bin/cgi-download
$(LN) ../../usr/libexec/cgi-io $(1)/www/cgi-bin/cgi-backup
+ $(LN) ../../usr/libexec/cgi-io $(1)/www/cgi-bin/cgi-exec
endef
$(eval $(call BuildPackage,cgi-io))