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

    How to Interact with the PHP shell indirectly?

    Scheduled Pinned Locked Moved General pfSense Questions
    3 Posts 2 Posters 2.5k Views
    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.
    • S
      sparkvilla
      last edited by

      Hi all. My ultimate goal is to interact with the pfsense PHP shell through Ansible. Because at the moment I am unable to do that I am proceeding step by step. Next is some background and my questions.

      I have changed my privileges on the pfsense user management (through web-interface) in a way that when I ssh the pfsense box I am not prompt with the starting menu but I am already inside the shell (that would be option 8 at the start menu). From here I run "/usr/local/sbin/pfSsh.php" which starts the PHP shell with which I can directly interact with.

      Question 1 : Is there a way to run PHP commands from the shell (not the PHP shell)?  For example using "/usr/local/sbin/pfSsh.php" + "command"
      Question 2 : Is there a way to redirect the output of a potential "/usr/local/sbin/pfSsh.php" + "command" to a file?

      PS. That is the way I am taking to interact with the PHP shell through Ansible. If you have some other idea or suggestion I would be glad to hear that.

      Thank you

      1 Reply Last reply Reply Quote 0
      • H
        heper
        last edited by

        this is what i do when i want to use the dev shell from console:

        -create a file that has the required php code inside
        -place the file in /etc/phpshellsessions
        -use the playback argument of pfSsh to run your code

        see post below for an example (it includes writing to a file)
        https://forum.pfsense.org/index.php?topic=109206.msg608279#msg608279

        I must say, i'm not an expert in these things, but i find it to be the easiest way to use the devshell from console .
        for quick hacking, you can also echo & pipe commands towards the devshell.

        1 Reply Last reply Reply Quote 0
        • S
          sparkvilla
          last edited by

          @heper Thank you for your reply. I am following the example of the link you posted. Question:  Since I cannot use sudo to write my test file, how else can I create a file under /etc/phpshellsessions?

          –------

          I actually found the way by installing the sudo package through pfsense web-interface..

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.