GET Writing a package for PFSense / Sudo Null IT News FREE

In this clause I will try to evince with a simple example how to create my own GUI box for pfSense . It is put on that the reader has experience with pfSense, has some noesis of PHP.

image

The pfSense router (supported FreeBSD) is used by many sysadmins due to, first off, managing the organization settings via the World Wide Web interface. Even a novice administrator can easily cope with many settings, which allows expanding the telescope of this router. At the same sentence, experienced colleagues can take fully advantage of access to the soothe to branch of knowledg and control the operation of the system.

In addition to the standard settings of the router, nearly of which lavatory represent done via the WEB interface, sometimes enterprise-specific tasks arise that require the organization decision maker to manage settings through the console. Next, I desire to show how to put together my best practices in code that allows you to manage system settings from the Entanglement port.

So, you have installed and designed psychometric test pfSense. To get moving, we need access to the soothe and pfSense files via SSH. Since I am a winuser, I will also habituate WinSCP + Putty for the tools for work.

Using WinSCP3 we connect to pfSense and wide-eyed the directory / usr / local / pkg. This pamphlet contains files lineal to GUI packages. Typically, these are XML and INC files, including configuration descriptions and PHP package handlers. The GUI bundle contour description is located in XML files, and contains:

  • service information;
  • header of the World Wide Web interface page;
  • WWW port page form;
  • information about PHP functions-handlers of events of the WEB interface.

Make two empty files mypkg.xml and mypkg.inc . The name mypkg is the make of our package, and the name of the XML file is the key to access the WEB user interface of the package. The name of the inc file can exist arbitrary, and the way to connect it leave be shown below.

We bod our XML file.

The service information contains the nominate, entitle, category, version of the GUI package and a list of connected INC files. In our case, there is only cardinal adjoining INC file, the flooded path to the connected file must beryllium specified.

                                    mypkg              My Premiere Package              Test              0.1              /usr/section/pkg/mypkg.INC                              

The WEB interface header contains the description of the GUI pages in the tabs node , and is displayed in the pilotage area. We will cause only ace paginate. The text element contains the name of the sailing item in the GUI. The url element contains the relative access path to our box paginate.

                                                    My Package                /pkg_edit.php?xml=mypkg.xml                                                            

The WEB interface conformation describes which controls for the parameters of our package will be getable to the drug user. First, create unitary single Enable field with the checkbox element :

                                                    Enable                enable                Check this for enable software.                checkbox                                            

Effect handlers The WEB interface is the concluding section of the XML file, and describes what functions leave be called at one sentence or another when the GUI form is running. Three commonly used handlers are conferred:

  • custom_php_command_before_form - called before the form is displayed;
  • custom_php_validation_command - called when checking the data of each form ingredient before saving its data;
  • custom_php_resync_config_command - called when saving variety data

                                                                                                

Using handlers, you can specify the names of php functions from the mypkg.inc charge that will be called on an case. Specific actions to change the configuration of the router are performed in the custom_php_resync_config_command handler , which is called both by clicking the Save button on the forms and when pfSense is loaded.

Here you can see the high schoolbook of the file:

Mypkg.xml file

                                                mypkg                  My Basic Package                  Try                  0.1                  /usr/local/pkg/mypkg.INC                                                            My Package                      /pkg_edit.php?xml=mypkg.xml                                                                                                                        Enable                      enable                      Check this for enable box.                      checkbox                                                                                                                                                                                                                                                                                  

We create the mypkg.Iraqi National Congress file empty, because our test box does nothing.

After saving the created files mypkg.xml and mypkg.inc in the / usr / local / pkg directory, you can check how our package bequeath look. To do this, attend the pfSense Vane interface and add the track /pkg_edit.php?xml=mypkg.xml in the address bar . If everything is done correctly and without errors, we will get such a picture.

image

As a leave, we received a very simple Graphical user interface software that does not do anything useful, does not save any data, and is not even documented in the Network port menu. Nevertheless, with the example of this package you can induce an idea of ​​the mechanism of operation of the pfSense GUI.

PS: For earlier, I apologize for possible shortcomings. This article is typewritten for an pay for.. If this topic will be of interest to the residential area, I will essa to talk in much detail about how to create a full-fledged GUI software for pfSense.

DOWNLOAD HERE

GET Writing a package for PFSense / Sudo Null IT News FREE

Posted by: wilsonconfor45.blogspot.com

0 Response to "GET Writing a package for PFSense / Sudo Null IT News FREE"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel