Wannabe php scripter / contributer



  • Hello,

    I'd like to make a couple of extra pages for my pfsense web gui. If I get it working well then i'll see if you want to include them.

    I looked at some of the php by viewing the web cvs which was very inefficient but I think I can do what I want.

    How do i get a development pfsense which I can work on? By that I mean I want a decent gui environment and text editor so I can modify the php pages. I installed pfsense in vmware for testing but can't see a sensible way to modify it?

    What is the developer iso, what do i do - do i need a dedicated system to develop on?

    I'm not really a developer - more of a scripter but I don't mind learning how to do thinks the right way.



  • @tetrisplayer:

    How do i get a development pfsense which I can work on? By that I mean I want a decent gui environment and text editor so I can modify the php pages. I installed pfsense in vmware for testing but can't see a sensible way to modify it?

    I am not sure if this is the "best" method but it is the only method I am aware of (and I am sure others will correct me if I am wrong :) )

    Go to this link and download the developer iso:

    http://snapshots.pfsense.org/FreeBSD6/RELENG_1_2/iso/Developers/

    You need to burn it to a CD then load it into a machine - it can be either a physical machine or a vmware virtual machine (using vmware server), just be sure to specify FreeBSD as the filesystem when you configure the virtual machine and have two network interfaces.  If you are using a physical machine then make sure you have two NIC cards (interfaces) in it.  You don't need to worry about formatting the hard drive as the pfSense system loader will do that for you when you go to install the pfSense system.

    The first NIC interface should be setup as a NAT and will be defined as the WAN interface on the virtual machine, the second can be setup as a private NIC interface and will be the LAN interface on the virtual machine.  You need to have the WAN interface defined as a NAT interface so the pfSense software can connect to the internet to perform the development system updates properly…  The second interface is required so the pfSense system does not "hang" not having a second interface - it also is used to connect to the webgui when you have the system running.  Be sure to set the LAN interface IP subnet to one NOT used on the local lan!  The WAN interface will take care of itself as it will use DHCP to obtain it's IP address from the NAT side.

    Once you startup the developer CD you will go through the steps to define the interfaces then be presented with the pfSense menu.  You want to use the last menu item - install to hard drive (in the case of the virtual machine it will install on the virtual drive you created for the system - the default 8-gig drive size is fine but you can increase it if you want to - I have mine setup to 20-gig but then I have a terabyte of disk storage too ).

    Once the system installs to the drive and is rebooted (just follow the prompts and take all the defaults) the system will startup a script to update the system to the latest development environment.  The only issues I have run into in installing a development system are:

    1. For some reason the system seems to have issues with downloading and installing curl - you can do this manually by exiting out of the update script (using control-c) if you run into the system seeming to "hang" at the installing curl point.  The command is:

    pkg_add -r curl

    on the command line - the system will go to the FreeBSD site and download the curl package and install it in the development system.

    One other "hang" point seems to be installing the rsync package (seems to be the same issue as curl).  You can manually install that package the same way buy using the command:

    pkg_add -r rsync

    Once the two packages are added to the system exit back to the pfSense menu and reboot the system - this time the development updates should complete correctly and the system will build a pfsense iso when it completes (that is how the software determines the development system is loaded correctly).

    At this point you will have a development system to work with.

    I hope this all makes some sense!

    As a nice feature you can setup a second virtual machine and load Windows or Linux - then run either Internet Explorer or you favarate web browser on the virtual machine to act as a host machine on the LAN side of the pfSense system for testing changes and what not.
    Just make sure you have the interface defined as a private one on the same private network as the pfsense LAN interface is configured - also, you want to make sure you setup the pfSense machine to pass private IP's through it otherwise your second virtual machine will not be able to access the internet through the pfSense machine (a small gotcha if you don't think about it :) )

    gm...



  • Thanks for replying!

    I'm very comfortable setting up vmware etc as I've already done this with stock pfsense etc.

    1. What IS the developer iso? Is it easier to modify than the installed pfsense I already have?
    Why does it want to build an iso - i don't want an iso I want to modify the installed pfsense php scripts and that's about all for now?

    2. I'll have to try to get this thing to work behind a proxy. I think I know how to do this by setting environment variables [http_proxy etc] but how do i make it permanent?

    e.g. I can manually run:
    export http_proxy=xyz
    export ftp_proxy=xzy

    pkg_add -r curl
    pkg_add -r rsync

    How do i make it active for when the system reboots and tries to get the updates?
    I can probably figure this out though.



  • @tetrisplayer:

    1. What IS the developer iso? Is it easier to modify than the installed pfsense I already have?

    Basically the developer system allows you to build your own versions of the pfSense system.  If you don't want to "add" packages to the pfSense system and build them into an iso (either for CD, PC hard drive or embedded applications) then the developer system probably is more than you need for what you want to do.

    If all you are looking to do is modify aspects of the web gui then you can use a standard pc install from a pfSense iso and make the modifications to the php code itself.  In order to make those changes and additions a permanent part of pfSense you will need to create a patch file with the changes/additions and submit them to the core developers and if they deem the changes as relevant to the pfSense project I am pretty sure they will include them.

    2. I'll have to try to get this thing to work behind a proxy. I think I know how to do this by setting environment variables [http_proxy etc] but how do i make it permanent?

    Setting up the development system is basically the same as doing a hard drive install of pfSense - the development system is pretty much automatic on updating itself once installed to a hard drive with the caviats I mentioned earlier - once curl and rsync have been installed on the hard drive you don't have to install them again :)

    gm…



  • OK…..

    So this doesn't seem like a good way to modify the php pages to me. I have a tiny console screen and hardly any applications to work with? Am i limited to vi only cos I'm not that hardcore.....

    I can't even get scp working so I can upload edited files?

    There must be a better way?

    I was hoping that I could have a full freebsd install with pfsense on-top [or at least the web gui stuff] then i could work with it like that?



  • Take a look at the webgui. There is this nice little feature to download and upload files (right below the execute shell command line) :)



  • This is how I have gotten to the files.
    1. Enable SSH: go to 'Advanced' and then check 'Enable Secure Shell'.
    2. Now open an ftp client and use SFTP from inside the LAN.
    3. The username and password will be the same you use for the web GUI.
    3. Set the root directory of the ftp client to / and you will have access to all files.

    If you are using windows you might want to try one of the following:
    http://www.webdrive.com/
    http://www.sftpdrive.com/

    These programs map the sftp to a drive letter and then you can access the files as if they are local.


Log in to reply