What's new

Add new page or tab to the webUI

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Oracle

Regular Contributor
What does it take to add an extra page / tab to the router web UI?
Like the Diversion tab on "LAN" or the dn-vnstat page on Addons (user1.asp and user2.asp).
Could anyone share a basic template?
E.g. add a page user3.asp that reads Hello world out of a file and hook it up somewhere?

I want to add a textbox that allows preview and editing of files in user-specified path.
 
Just what I was looking for.
Now, before I reinvent hot water, is there such an addon already - one that allows users to set cron or edit scripts on the web UI?
I can't be the first person to think of it.
 
Just what I was looking for.
Now, before I reinvent hot water, is there such an addon already - one that allows users to set cron or edit scripts on the web UI?
I can't be the first person to think of it.
scMerlin lets you see cronjobs through the webUI, but doesn't allow you to edit them! Looking forward to seeing what you cook up! :)
 
Great.
I have a lousy page now which is hooked to Tools instead of Addons and I don't know how to move it.
And I can't see how to access the shell from the page. :(
 
And I can't see how to access the shell from the page. :(
I think these replies from RMerlin are still relevant (as alluded to by Dave).

 
I think these replies from RMerlin are still relevant (as alluded to by Dave).
...
That hurt.
Feels like I crashed into a wall.
So it's not possible to read and write to a file from the webUI. :(
Well, except the settings file in /jffs/addons that can't even display a value with a space in it.
 
That hurt.
Feels like I crashed into a wall.
So it's not possible to read and write to a file from the webUI. :(
Well, except the settings file in /jffs/addons that can't even display a value with a space in it.
base64 encode to write to custom_settings with your data from the webui and then decode it in your script which picks up on a service-event call from the webui
 
May I know what exactly is the security problem?
I've done pages on PHP before and I'm aware of the general injection risk but it doesn't mean there's no way to read and write files at all.
Of course, it's one thing if it's just a data file and another if it's executable script.

I guess I'm not happy working on scripts in a console with MS-DOS era interface. Feels like going back to the stone age.

Productivity-wise, it sucks.
 
May I know what exactly is the security problem?
It’s an internet-facing device, prone to attacks. Asus likely chooses to minimize the attack surface of the httpd daemon. Edit on your preferred machine with Unix line-endings and scp it back to the router, using ssh keys instead of password prompts.
 
May I know what exactly is the security problem?
httpd in the firmware runs as root (since it needs to be able to manage the router settings), while your typical Apache/nginx server runs as a restricted user. A buffer overrun exploit on an Apache server would only run the code as the apache (or nobody) user, while on your router it would run as root.
 
Interesting.
httpd has to run as root in order to allow configuring the router?
How so? Excuse me if I'm asking a very stupid question (I'm a rookie in this environment) but inquiring minds wanna know. :)
I've made solutions where the web interface is able to set params of the host OS and it doesn't run as root. That's through dedicated functions.
E.g., httpd has access to certain config files and the OS (root) can also read these config files and pick values, validate them and work accordingly.
So what is this configuration that the Asus webUI does which requires 'root'? You can start and stop services, you can change labels (names) and IP addresses and stuff like that without root.
 
Interesting.
httpd has to run as root in order to allow configuring the router?
How so? Excuse me if I'm asking a very stupid question (I'm a rookie in this environment) but inquiring minds wanna know. :)
I've made solutions where the web interface is able to set params of the host OS and it doesn't run as root. That's through dedicated functions.
E.g., httpd has access to certain config files and the OS (root) can also read these config files and pick values, validate them and work accordingly.
So what is this configuration that the Asus webUI does which requires 'root'? You can start and stop services, you can change labels (names) and IP addresses and stuff like that without root.
The router is not a Linux distro, it's a turnkey appliance. Almost everything on the router runs as root. It doesn't run as a traditional multi-user OS. It doesn't run a "real" httpd deamon (with all the associated security provisions) but a minimalist version called milli_httpd that's been modified by Asus. RMerlin has added the ability to customise a lot of the router's features but the underlying OS is the same.
 
Interesting.
httpd has to run as root in order to allow configuring the router?
How so? Excuse me if I'm asking a very stupid question (I'm a rookie in this environment) but inquiring minds wanna know. :)
I've made solutions where the web interface is able to set params of the host OS and it doesn't run as root. That's through dedicated functions.
E.g., httpd has access to certain config files and the OS (root) can also read these config files and pick values, validate them and work accordingly.
So what is this configuration that the Asus webUI does which requires 'root'? You can start and stop services, you can change labels (names) and IP addresses and stuff like that without root.
On almost all linux devices, making a network change(s) is deemed administrative & requires elevated privileges.
Most ROUTING changes to a network are "in-fact" important & any improper configurations can certainly cause issues.
 
The router is not a Linux distro, it's a turnkey appliance. Almost everything on the router runs as root. It doesn't run as a traditional multi-user OS. It doesn't run a "real" httpd deamon (with all the associated security provisions) but a minimalist version called milli_httpd that's been modified by Asus. RMerlin has added the ability to customise a lot of the router's features but the underlying OS is the same.
This statement definitely sums it up quite nicely. Thank you for that @ColinTaylor
 
Understood.
Looks like any knowledge and skill I may have is to a large extent useless here.

I somehow had the expectation that a dual-core 1.8 GHz CPU and 512 MB RAM provide a lot of opportunity.
Especially given that I was running quite a bit of stuff with the Optware extensions and some custom code on a DD-WRT flashed 32 MB Asus router many years ago. Turns out I was wrong. :)
 
Dual-core 1.8GHz CPUs and 512MB RAM are old news in 2017 and earlier. Today, they're just barely able to give enough performance for a full/symmetrical 1Gbps ISP connection with very simple scripts running.

What actual router do you have? What firmware is it running? There are some that need (almost all) that RAM just for themselves.

Even quad-core 1.8GHz models with 1GB of RAM are woefully underpowered today. If you want to use them past their routing/WiFi duties.
 
Even the latest SoCs are pretty pathetic, with a whole 200MHz boost to CPU power. :(



To put this in perspective, this was effectively launched (at least a flavor of it) back in 2016.

Broadcom Announces Volume Production of Quad-core 64-bit 2GHz ARMv8 SoCs | Broadcom Inc.
 
L&LD,
Decided to check what were you talking about - "quad-core 1.8GHz models with 1GB of RAM are woefully underpowered".
Well, I run an AC86U, considered it a beast when I ordered it. (Previous router in its place was TP-Link with 560 MHz CPU and 128 MB RAM.)
Not so impressed now and it seems like I already went too far with it. Swap is pretty efficient on a USB 3 SSD drive but that's a lot of it. The 2 CPU cores are also often maxed out. For some reason, reading / writing files to the SMB shared USB 3 drive just seems to hog the poor thing. Maybe I have to optimize the Samba somehow but that's for another topic.
 

Attachments

  • AsusAC86UMemory.png
    AsusAC86UMemory.png
    99.3 KB · Views: 90

Similar threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top