Languages used in pfsense



  • Hi,
    sorry if this seem dumb, or inappropriate, but I'm really confused, I asked everywhere but I don’t seem to get the Answer.. what are the languages used to create Pfsense, or Is there a Developer documentation for Pfsense.. it might be the wrong way, but I want to learn how pfsense web interface was created.. I am asking because I want to learn more about creating such interfaces for specific applications..

    I come from more of Networking/VoIP background, with fair knowledge of Linux OS.. I believe the best way to expand this knowledge is hard-dirty work.

    This might be very silly asking this question here, but i believe that Open Source Projects are one of the best ways to enhance your knowledge..

    Sorry again for this question, i hope i don’t violate any forum rules..

    Thanks for this project.





  • Thanks for the reply.
    Pls bare with me,
    1- so basically we are using php to edit the config files which usually edited using vi/vim editor.
    2- we are also passing some commands using php too.
    3- what are the software packages used to create pfsense (e.g. Apache web-server, DB Server, etc)
    4- are there specific scripting languages used..

    Thanks again,



  • The webGUI is essentially a front-end editor and controller for the (XML-based) config. The config is stored in /conf/config.xml There are PHP utility routines that read and write the config XML format - in a sense that is the "database". The back-end code reads the config and generates individual config files for the various utilities as needed (e.g. conf for DHCP, conf for DNS server, conf for pf and so on), sets up the interfaces as per the settings in the config and starts all the various back-end daemons.

    2.3 is using nginx for serving the webGUI.

    The vast majority of the code is in PHP (front and back-end). There are some compiled binaries that are custom to pfSense or customized by pfSense - the source code of those is in whatever compiled language was being used, you can find it in the repos on GitHub. There is a plan for the future to change to Python for a lot of the back-end scripting.



  • Hi,
    Thanks again, this was really useful..

    1- Why are you planning to change from php to Python?

    The back-end code reads the config and generates individual config files for the various utilities as needed (e.g. conf for DHCP, conf for DNS server, conf for pf and so on), sets up the interfaces as per the settings in the config and starts all the various back-end daemons

    2- Does that mean every time a change in made on the front-end, a new file's generated, for example, i have created a DHCP scope, after sometime i created another DHCP scope, does it mean the back-end code "script" edits  dhcp.conf (just example!) or it creates a new one with entries of both scopes..etc.

    Thanks again for the help..
    I know this might not be the appropriate place to ask, but the info you guys shared is great and gives a clear idea where to start.



  • 2- Does that mean every time a change in made on the front-end, a new file's generated, for example, i have created a DHCP scope, after sometime i created another DHCP scope, does it mean the back-end code "script" edits  dhcp.conf (just example!) or it creates a new one with entries of both scopes..etc.

    Yes, for example when you change any DHCP settings in the front-end webGUI, it calls the back-end routines and they write a new dhcpd.conf based on the new settings in config.xml and then restart dhcpd. The same general flow happens for all interface settings, daemons etc.



  • Thanks for the reply,
    Why choose Python?
    Thanks