ubus call from web api?



  • Hello.

    Is there a way or a recommended way to interact with ubus from outside of the omega? I'd like to make some calls to ubus and report results from a web call. Is there a way in place right now to do that? If not, recommendations on how to do that?



  • Yes, there is 😉

    A bit of context: OpenWrt (on which OnionOS is built) is a network router OS, and as such it needs to have a web-UI which can access and modify system configuration and status. This OpenWrt Web-UI is called LuCI

    ubus (u=µ, micro bus) is one part of the infrastructure for that, as it allows to query and command various system parts. uci (the unified configuration interface) is another part, it allows to manage more static configuration in a standardized way, and is accessible via ubus.

    So in order for LuCI to use ubus to do stuff, including using uci, there needs to be a http-to-ubus bridge, which comes in the form of a uhttpd plugin called uhttpd-mod-ubus. There's documentation about this here.

    As I'm a user of stock OpenWrt on Omega2, I'm not absolutely sure about the exact state of OnionOS, but judging from the .config on github uhttpd-mod-ubus is installed by default and should be working.

    So I guess you need to start at creating a ACL and read on to understand how how to login and get a session id via http.


Log in to reply
 

Looks like your connection to Community was lost, please wait while we try to reconnect.