- This topic is empty.
April 23, 2015 at 5:55 pm #44273
I’m experimenting some personal tools that I will add to my ZS box.
For instance: partial backups and syncs (the DNS zone notably)…
Here I face the problem to run such a tool easily (once logged as admin of course). I could connect via SSH and type a command, but why not rather from the GUI ?
I could add commands, some commented, in the script TEST from section SETUP, tab “scripts/cron”, but this is messy.
Let’s figure a “Custom” tab in the GUI, opening a specific page built from a HTML source for instance, written by the admin,
…showing a form with a priori buttons, maybe edits for arguments,
…and on action, launching a local master script with all the posted data passed as arguments. This script provided initially empty.
Then the admin is responsible for defining a robust GUI page and processing the commands properly in the master script…
I guess that all the Users wanting to add things to their ZS would like to have such a custom control panel to run them.
Best regards.July 12, 2015 at 10:08 am #53786
https://www.zeroshell.org/forum/viewtopic.php?t=5061May 7, 2016 at 2:07 pm #53787
Back on this topic.
The next challenge is to create a small Web interface in the LAN to display the state of stations and send them directives like Wake-on-LAN, shutdown etc.
Naturally it must be provided by the LAN Master, that is: the ZS box (Alix in my case).
Looking at the insides, we have:
root@janus1> ll /cdrom/usr/local/apache2/htdocs
lr-xr-xr-x 1 root root 43 Mar 3 06:19 bwd -> /var/register/system/bandwidthd/work/htdocs
lr-xr-xr-x 1 root root 46 Mar 3 06:19 cp_image -> /var/register/system/cp/Auth/Custom/Image/File
-r--r--r-- 1 root root 1.1K Mar 3 06:15 default.css
lr-xr-xr-x 1 root root 12 Mar 3 06:19 img.tpl -> /tmp/img.tpl
-r-xr-xr-x 1 root root 867 Mar 3 06:15 index.html
dr-xr-xr-x 2 root root 2.0K Mar 3 06:15 kerbynet
-r--r--r-- 1 root root 26 Mar 3 06:15 robots.txt
root@janus1> ll /cdrom/usr/local/apache2/cgi-bin
-r--r--r-- 1 root root 1.0K Mar 3 06:15 .rnd
-r-xr-xr-x 1 root root 1.9M Mar 3 06:15 kerbynet
All that in read-only.
It is possible to create a file /tmp/img.tpl/index.html and it will show at URL https:///img.tpl/…
Then what command can it trigger ?
None of course ! 😆
By looking at the URLs from various pages of the ZS GUI, I tried variants of such a thing:
…but Mr kerbynet refuses to cooperate 😛 and I understand that…
What to do then ?
The custom (set of) pages must be located in a subfolder of htdocs/ and they must invoke a different CGI script written under full responsibility of the people doing that, of course.
Actually they must be located somewhere else, typically under /opt, and linked to htdocs/ and cgi-bin/ with “optional in case of” links like the existing img.tpl/.
The challenge now is to modify the iso9660 then reinsert it into the CF card to make these 2 links appear there 😡
Logically the request is for such a new feature: 2 “in case of” soft links that could be set this way (the word ‘tools’ looks generic enough to fit any need):
/cdrom/usr/local/apache2/htdocs/tools -> /opt/webtools/htdocs
/cdrom/usr/local/apache2/cgi-bin/tools -> /opt/webtools/cgi-bin
Nothing more, the User will be responsible for creating or not the 2 pointed directories and, if it does it, to secure what he will put inside.
Your positions ? An idea to do it another way ?
Thanks, Best regards.May 28, 2016 at 3:11 pm #53788
This is a temporary patch since any regular update of Zeroshell’s core will crush it.
I will start experimenting the solutions with that framework.July 21, 2016 at 3:48 pm #53789
Bad news, the 2 softlinks are not part of Zeroshell in v.3.6.0.
I will have to patch this one again.July 21, 2016 at 11:37 pm #53790iulybMember
You can have kerbynet.cgi do a lot of things as long as you have a template and a script into /root/kerbynet.cgi/scripts and /root/kerbynet.cgi/template
I created pages (views) and script actions.August 11, 2016 at 3:47 pm #53791
Sorry for the delay…
I downloaded and explored your code. It shows how to interface cleanly with the Kerbynet, with the session key etc. and how to plug new pages into the existing GUI.
It is certainly much better and cleaner than what I’m trying to do with an extra path in the URL.
I will try to redo my thing this way asap and tell.
The first goal is to have a panel with buttons to trigger a Wake on Lan on the machines of the LAN.
Maybe also a status active/sleeping, not sure it is useful…
I need it because it is safer than a kind of “Wake on Internet”, and the feature is necessary with a VPN.
Thanks & Best regards.September 2, 2016 at 5:26 pm #53792iulybMember
I think the best way is first to decide if your feature is global / useful enough to be included under the main interface or it should live separate as an independent addon.
To include a directory link under apache you can look at apache alias directive:
For this you will require to change http.conf. http.conf lives here:
Keep in mind that altered http.conf will not survive a reboot so you need to change it every time you reboot. For this you will need to add something on the preboot script. ex:
echo "Alias /dir1/ >> "/var/register/register/somedir1"
To add a new item under ZS menu we need to change the template, but first we need to find it. It lives under /root/kerbynet.cgi/template and grep is our friend:
grep "Net Balancer" ./*
root@zs template> grep "Net Balancer" ./*
Autostart the connection : NoYesOn Net Balancer Fault
Note: Autostart the connection [On Net Balancer Fault] works if the 3G interface belongs to the Gateway Pool configured in the Net Balancer.
Autostart the connection : NoYesOn Net Balancer Fault
Note: Autostart the connection [On Net Balancer Fault] works if the PPPoE interface belongs to the Gateway Pool configured in the Net Balancer.
Net Balancer Manager
Net Balancer Statistics
If you look closer sx is the template that generate the left menu in ZS 😉
Same thing we can guess with a different approach. In Firefox if we right click click under menu and pick show this frame only will discover the url of the frame:
Based on my other discoveries I can tell the action render will look for a template sx under templates
- You must be logged in to reply to this topic.