Ubus Api Call error 500 ns-redirect

NethServer Version: NethSecurity 8-23.05.5-ns.1.4.1
Module: Ubus/nethsecurity-api

Hey all,
Last week i changed something on my router and since then i can not remove a firewall rule. I have checked with other objects, i.e. a tesuser. These can be removed.
I wanted to forward port 443 to an internal server but i still got the forward to /cgi-bin/luci, so i tried a netstat on the server and saw that uci.conf -g da was listening on 443.

So i checked ns-ui
uci show ns-ui
ns-ui.config=main
ns-ui.config.luci_enable=‘1’
ns-ui.config.nsui_enable=‘1’
ns-ui.config.nsui_extra_port=‘9090’
ns-ui.config.nsui_extra_enable=‘1’

And found a related article to check nginx, so i checked.
nginx._lan.listen=‘443 ssl default_server’ ‘[::]:443 ssl default_server’

after i messed up the above setting, i tried a restore of the server ( i could not fix it) with ns-download -l and a sysupdate.
All was fine after the reboot (i was able to setup a port forward and remove it) , but when i restored my backup the issue was again present.

So the error is: (on removal of a firewall port forward)
Cannot delete port forward
Server error
AxiosError: Request failed with status code 500

in /var/log/messages:
nethsecurity-api[4433]: nethsecurity_api 2025/03/17 08:30:16 middleware.go:169: [INFO][AUTH] authorization success for user root. POST /api/ubus/call {“path”:“ns.redirects”,“method”:“delete-redirect”,“payload”:{“id”:“ns_ef04e7a9”}}
Mar 17 08:30:16 $server nginx: 192.168.86.71 - - [17/Mar/2025:08:30:16 +0100] “POST /api/ubus/call HTTP/1.1” 500 84 “https://192.168.86.1:9090/

Any Idea?
Help i smuch appreciated without having to rebuild my router!

Hi,

and welcome to NethServer community.

I got a similar error when changing IPSEC tunnels.
The issue is already solved and the fix will be released with the next updates, see also IPsec tunnel: error when modifying or deleting a tunnel · Issue #1134 · NethServer/nethsecurity · GitHub

After moving the file templates-opkg.backup to /root (as backup, in case it’s needed) it should work to delete port forwards.

mv /etc/config/templates-opkg.backup ~

Hey thanks for the reply.
I see in my backup file that the templates-opkg.backup is present.
When i factory reset the device the file is not present. So your solution could be working.
I will give it a try.

Any idea what this file does? I see a bunch of predefined ports and services , but no relation to my nginx.

1 Like

As it’s a confirmed bug it should work. I also tested it.

It’s just a backup file of templates-opkg that is wrongly read as firewall config on firewall initialization which throws an error.
There’s no relation to nginx.

It works! I first did a ns-download -l and a factory reset. Then forced my incorrect backup again. Error was there. After mv /etc/config/templates-opkg.backup ~ The error was gone.

1 Like