Adding a field to the WebGUI config screen



  • ISPs in South Africa provide static IP addresses using L2TP that is authenticated with a shared secret.  pfSense can not set the shared secret on the PPP interfaces add screen.

    pfSense uses MPD5 for L2TP, and MPD has supported shared secrets since 4.1.  It seems that simply adding a field to the config file will work.

    Is there an easy way for me to edit the webgui that manages the l2tp interface to add the field, get the secret to be stored in the xml file, and then fix the scripts that turns the xml into the config file?

    Alternately, would it not be best to add a generic section to the config section where you can add what additional parameters you want passed to mpd?

    Thanks in advance for the help, and a final note - ALL ISPs in South Africa do this for static IPs over DSL.  Every person who uses pfSense in South Africa is potentially affected by this problem.

    Regards,

    Jason



  • The code for all that is just PHP. It is all in GitHub at https://github.com/pfsense/pfsense and in your pfSense box (Diagnostics->Edit File). Copy the relevant files, edit them, save them on a system you can play with, get it working…

    /usr/local/www/interfaces.php - has some stuff for entering directly PPTP/L2TP username password...
    /usr/local/www/interfaces_ppps_edit.php - entering username password... for L2TP on PPP (I think that is what you want)

    It sounds like you understand what is needed, so have a look at that code and you can add an extra field for the shared secret.

    Then look in
    /etc/inc/interfaces.inc function interface_ppps_configure($interface)

    That writes the config file/s for that stuff.

    Lines like:

    set auth authname "{$ppp['username']}"
    

    Put the parameters in the config file.
    Add your new parameter there somewhere.

    When it is working, make a pull request online in GitHub (just make the few edits in the GitHub webGUI is easy).

    Then everyone in South Africa and elsewhere gets the benefit.