Ubus file list returns error code 6

In the new firmware the ubus call file list action doesn’t work via rpc.
It works perfectly file via ssh cli.

It doesn’t seem to matter what file path I set, I always get back ubus error code 6.

I’ve tried /root, /etc/config, /etc/vuci-uploads, /tmp

I’ve also tried multiple devices with different models and firmware:
RUT956 in the new fw RUT9M_R_00.07.04.5 (fails)
RUT300 in the new fw RUT30X_R_00.07.06.10 (fails)
RUT240 in the new fw RUT2_R_00.07.06.3 (fails)

RUT955 in the old fw RUT9XX_R_00.06.08.6 (works)
RUT240 in the old fw RUT2XX_R_00.01.14.7 (works)

curl --silent 10.2.1.4/ubus -d '{
    "jsonrpc":"2.0", "id":1, "method":"call", "params":
    [
        "00000000000000000000000000000000", "session", "login",
        {
            "username":"admin", "password":"pw"
        }
    ]
}'
curl --silent 10.2.1.4/ubus -d '{
    "jsonrpc":"2.0", "id":1, "method":"call", "params":
    [
        "402bbbd69e5bf9c0c110a7ee0beda937", "file", "list",
        {
            "path": "/etc/config",
        }
    ]
}'
{"jsonrpc":"2.0","id":1,"result":[6]}

I’ve noticed that the new firmware returns this acl in the response:

 [file] => Array
                        (
                            [*] => Array
                                (
                                    [0] => read
                                    [1] => write
                                    [2] => exec
                                )

                            [/usr/lib/opkg/info/pam.control] => Array
                                (
                                    [0] => list
                                )

                        )

The list action is not the same as the read, write, exec actions, it mentions pam.control

why is this different and what can I do to make it behave properly?

The reason for it not working is probably that there is no ACLs for file list. Since there needs to be explicitly defined allowed commands for JSON RPC interface, you can read more about it here [OpenWrt Wiki] ubus (OpenWrt micro bus architecture).

Also I suggest to not use JSON RPC as Teltonika has moved away from it in their web interface there might be more limitations, instead use the API, documentation can be found at https://developers.teltonika-networks.com/.

This topic was automatically closed after 15 days. New replies are no longer allowed.