pfSense apache



  • Is there a way for me to execute easyrule in apache? i tried using php shell_exec to run the easyrule code but it only returns "Host Added Successfully" but it does not reflect on the firewall rules in pfSense. Thank you


  • Netgate Administrator

    Probably going to need more detail here.

    Where exactly are you executing this code? In what circumstances? What is your objective here?

    Steve



  • This post is deleted!


  • @stephenw10

    Thank you for replying

    im running the php script in an apache hosted web server after they submitted a form. My objective here is to run the easyrule with the user inputs. Im trying to make a separate UI for non-admins to be able to edit the firewall rules without accessing the pfsense main webgui. Thank you

    My index.html has the sample form then when the user submits the form it runs try.php which contains

    <?php
    shell.exec('<easyrule command>');
    ?>


  • Rebel Alliance Developer Netgate

    There is no apache on pfSense. Perhaps you meant nginx?

    You shouldn't call the shell exec programs indirectly like that. It isn't going to work. You're telling PHP to spawn a subshell and then run more PHP code from there.

    If you are looking to make your own page, just copy the contents of the easyrule script and adjust it to suit your needs. Though odds are, whatever you end up making will be less secure than granting users rights to edit firewall rules in the GUI directly.


Log in to reply