Ok So in Webmin there is a terminal utility. My Question is Can you build new Modules which make use of existing Webmin components.
So Ive created a module called GEM.
I want GEM to show a few buttons like the config buttons, and I want the buttons to execute a command inside a lets say 200px x 100% wide terminal screen.
Yes, you can! Use Webmin’s UI module framework—create your buttons in ui_form() and call your terminal command via system() or embed a textarea with the output.
Is the command interactive? If it’s not you should definitely not use the huge resources the terminal requires to just run a command and print the output (you can find many examples of how to do that…or you can just use Custom Commands to run a command with optional arguments and print the output).
Hi guys. First I am hoping to be a serious webmin developer as I have worked on the product for many moons. I followed your instructions for building a new module first by just installing your foo webserver then customizing it. I got the module looking like I want it to look.
#1 What would be helpful if you could improve the FOO Webserver demo to have a few buttons which make system calls to the operating system. For example a Button which might run netstat -ntla in a terminal command. Another button which might run uname -a… (And yes I know this is available in the Webmin Dashboard).
#2 I am running a VS Controller on the platform, and I want Webmin to user perl calls to the controller to do different things and If I compile binaries in some language I need the buttons to simply make perl system calls to the controller and present the result. this could be done inside a terminal window. The controller is a standard REST controller and presents JSONs in return.
#3 I am interested in having one Webmin Peer talk to another webmin peer. IE Node 1 makes a call to node2 to create a user. Is this possible without custom code? It doesnt appear that Webmin has an Enterprise Scope where it knows about other Webmin Instances on the same network. (this might be something I might like to add). (OR alternatively webmin1 makes a call to Virtualmin2 to create a user via a command line process).
I suppose the Foo webserver demo is cool, but I need something which explains how to do a basic form layout as if you were building an HTML screen/form.
Have you looked at Custom Commands? If you just want to run a command and show output, you don’t need to write code and you don’t need examples, you just go to Custom Commands and create a custom command.
You seem fixated on Terminal, but nothing you’ve described in the following items seems well-suited to putting it in a Terminal. That’s a very heavy-weight way to show output from commands! Terminal is one of the most resource-intensive things a user can do in Webmin, and it’s not easy to work with (because it’s a non-native thing…it’s firing up a WebSocket server and shell and then connecting the JavaScript xterm.js in the browser to the server and doing all the mess that a terminal does…it’s not how web apps should work, it’s very uncomfortable for a web browser to be a terminal with many layers of mess to make it act like something it’s not).
If you want to run a command, get JSON output, and show it to the user, you should just do that and forget about the danged Terminal!
All of the source code is open, so literally everything is an example. I encourage you to find things in Webmin that do something similar to what you’re after, and just read the code. ui-lib.pl is how the UI gets drawn, mostly.
In virtual-server (Virtualmin), check.cgi is a pretty simple example of “run some Perl and show the results”. It just calls a bunch of Perl functions and prints their results to the page, basically all plain text, like what you’d get out of a terminal. (But, again, keep the danged Terminal out of it, you’re just asking for trouble trying to munge it into a simple problem like this.)
Duly noted…i like the foo example…just wanted to request a few extra buttons. I am actually hoping to use webmin frontend to orchestrate cloud actions as well as local actions as you do today… i will see if i can get through the api documentation and the tips you added…
As always cheers…only wishes for the product are to add mssql and oracle modules like mysql and postgres…and to support ufw as a firewall in base.
it sort of has look at this UncomplicatedFirewall - Ubuntu Wiki.
as there is an iptables module within webmin which will, perhaps, display your ufw rules. Personally I ditched firewalld & fail2ban in favour of something I code myself, here is an example of the iptables module display
input rules
We don’t usually try to address proprietary software, however, unless someone is paying us to do so (someone paid Jamie to add Oracle support years ago, and when they stopped paying, we stopped working on it). You, of course, are free to work on anything you like and we’ll try to answer questions.
We already support so many different firewalls, I’ve been kind of opposed to adding more. It’s just so many options for no good reason. ufw isn’t better than all the other options available, it’s just different, and mostly only used on Ubuntu (I understand it can be used elsewhere, but it’s not packages on most other distros, whereas the other firewalls we support are widely available).
so what options are available ? when you install virtualmin there is no option to view/install any of these options instead of the default firewalld, perhaps if ufw is already installed (ubuntu perhaps) just use that rather than installing firewalld. However this may need extra development/modules in order to make this seamless to the end user
There are no firewall options during Virtualmin install. Virtualmin configures firewalld. It is available in the OS repos of all of our supported distros, it works well with fail2ban (though apparently the package is buggy on some distros and needs tweaking), and has a Webmin module for managing the basics. If you’re thinking about firewalls in a Virtualmin system, you’re probably not focused on really useful stuff. A firewall on a world-facing server is close to useless. Any ports you want to close shouldn’t have any services running on them, and thus the firewall isn’t doing anything…fail2ban (or other active firewall management tool) makes a firewall in this context useful, by actively blocking abusive looking traffic, but if you’re manually fiddling with rules, you’re probably spending time you should be spending on other security details.
Webmin (which this thread is about) has several firewall modules, including iptables, CSF, Firewalld, ipfw (a BSD thing), ipfilter (another BSD thing).
If you want to talk about firewalls in Virtualmin, a new topic would be appropriate, though. This thread is about development of Webmin modules (and already too broad…I’d rather it get focused on a specific problem or question). I mentioned Virtualmin in the context of examples of code OP can look at, related to what they’re trying to do (e.g. there is no Webmin Oracle module, but if one wanted to make an Oracle module for Webmin, you can still find some useful details in the old Virtualmin Oracle module).
Where did I mention virtualmin except from the point that it should ask ‘what do want to use’ perhaps my reply was badly written, but as the topic title indicates webmin development I would assume that we are talking about other things, rather than defending the options that are available currently