Navigation

    Netgate Discussion Forum
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search

    How is web GUI linked to freebsd and how does it work ?

    webGUI
    3
    11
    155
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      Meijink last edited by

      Hey everyone i'm new here. I'm currently studying pfsense source code and i were wondering how the web GUI was made (i noticed it has been done with php). What i wan't is to find out and understand how it's linked to the freebsd OS, how it is set to the address and can be reached through the browser etc... If someone can help me it would be very appreciated. Best regards

      PS : sry for my bad english ^^

      Gertjan 1 Reply Last reply Reply Quote 0
      • Gertjan
        Gertjan @Meijink last edited by

        @Meijink said in How is web GUI linked to freebsd and how does it work ?:

        I'm currently studying pfsense source code

        Continue studying.
        The GUI is a classic web server, nginx, rooted in /usr/local/www/ - and lots of code in /etc/inc/.
        Basically, when you validate a GUI page with settings, the usual FreeBSD shell command line commands are executed, or configuration files are reconstructed, and the belonging process is restarted so the new settings are taken in account.

        Just like your .... coffee machine, acces point, ISP router, your DSM from Syno, Plex, etc etc etc.

        1 Reply Last reply Reply Quote 0
        • M
          Meijink last edited by

          Thanks for your reply i understood a lot now especially about how the GUI is developed. And how can the GUI made with php execute the BSD commands ? is there a particular way ? i looked for it in the files but coudn't guess how and where it was done.

          1 Reply Last reply Reply Quote 0
          • Gertjan
            Gertjan last edited by

            PHP can do anything.

            Open a console/ssh connection, use option 8 and :

            cd /etc/inc/
            grep 'mwexec' *
                and
            grep ' exec(' *
            

            This is just an example.

            1 Reply Last reply Reply Quote 0
            • M
              Meijink last edited by

              Good morning ^^, thanks again for your help. I made a tons of research and i got what were explaining. One last thing : would you recommend python for this ? (i assume it's possible with python so tell me if i'm wrong)

              1 Reply Last reply Reply Quote 0
              • Gertjan
                Gertjan last edited by

                Using Python to study the pfSense source code ?
                I would use my eyes and brains.

                pfSense could get rewritten in Python some day.
                PHP has become, like BASIC in the past, too basic.
                If it was me, it would be C and or C++.

                Take note that pfSense isn't only PHP - the GUI is for 99% PHP, but pfSense is more then that.
                A modified FreeBSD kernel, a boatload of FreeBSD packages, some C code, a sniff of Python, a modified layout of the FreeBSD file system.

                1 Reply Last reply Reply Quote 0
                • M
                  Meijink last edited by

                  I were meaning if you would recommend python to write the GUI instead of php or another language but i get your point there. I were actually just wondering why they would use php instead of another language. Thank for your help on this topic. Best regards.

                  JeGr 1 Reply Last reply Reply Quote 0
                  • Gertjan
                    Gertjan last edited by

                    @Meijink said in How is web GUI linked to freebsd and how does it work ?:

                    they would use php instead of another language

                    Check out where pfSense came from. That will fill in the why part.
                    Back then, in the darker ages, everybody that could read and write, could 'code' PHP - as BASIC in the ancient period.
                    In the past, pfSense was close to be rommable, with a minimal RAM needed as a scratch pad.

                    And believe it or not, PHP code was easily maintainable (in the past).
                    The other known web language was ASP but that needed an IIS server thus no very 'free'.

                    1 Reply Last reply Reply Quote 0
                    • JeGr
                      JeGr LAYER 8 Moderator @Meijink last edited by

                      @Meijink said in How is web GUI linked to freebsd and how does it work ?:

                      I were meaning if you would recommend python to write the GUI instead of php or another language but i get your point there. I were actually just wondering why they would use php instead of another language. Thank for your help on this topic. Best regards.

                      Would they do it in Python? No.
                      Why? Because nowadays that's not what you would do to create a flexible webUI. If the UI will be redone I sincerely hope it will be the same way as in TNSR and use an API as ground layer (RESTCONF) and put a cli and UI on top of that. No playing around with a webstack but using a tiered architecture that can be expanded in multiple ways.

                      Gertjan M 2 Replies Last reply Reply Quote 1
                      • Gertjan
                        Gertjan @JeGr last edited by

                        @JeGr said in How is web GUI linked to freebsd and how does it work ?:

                        use an API as ground layer (RESTCONF) and put a cli and UI on top of that.

                        Totally agree with that.
                        It will be a huge task, and thus I'll doubt it's economically feasible.

                        1 Reply Last reply Reply Quote 1
                        • M
                          Meijink @JeGr last edited by

                          @JeGr thanks for this intervention i didn't get everything about the technology you mentionned but i will try to find informations about it.
                          @Gertjan thanks again for your support through this topic it helped me a lot.

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post

                          Products

                          • Platform Overview
                          • TNSR
                          • pfSense Plus
                          • Appliances

                          Services

                          • Training
                          • Professional Services

                          Support

                          • Subscription Plans
                          • Contact Support
                          • Product Lifecycle
                          • Documentation

                          News

                          • Media Coverage
                          • Press
                          • Events

                          Resources

                          • Blog
                          • FAQ
                          • Find a Partner
                          • Resource Library
                          • Security Information

                          Company

                          • About Us
                          • Careers
                          • Partners
                          • Contact Us
                          • Legal
                          Our Mission

                          We provide leading-edge network security at a fair price - regardless of organizational size or network sophistication. We believe that an open-source security model offers disruptive pricing along with the agility required to quickly address emerging threats.

                          Subscribe to our Newsletter

                          Product information, software announcements, and special offers. See our newsletter archive to sign up for future newsletters and to read past announcements.

                          © 2021 Rubicon Communications, LLC | Privacy Policy