I have a Linux based router that I’m trying to “control” with a home automation controller. On my automation controller I’m able to utilize a ‘two way strings’ driver to send a string to the Linux router upon the push of a button on the remote control. I’m wanting the string sent to be executed on the router.
I’m able to accomplish this by running the commands below while ssh’d into the router:
$ rm -f /tmp/f; mkfifo /tmp/f $ cat /tmp/f | /bin/sh -i 2>&1 | nc -l 127.0.0.1 1234 > /tmp/f
As long as I keep the terminal window open the automation controller is able to send strings that alter the iptables.
The problem I’m running into is that this does not persist after I close the ssh connection. Is there a way to have the router continue to listen and execute commands from the controller after ssh connection is closed?
Here is an example of the string I’m sending:
Basically my end goal is to be able to drop traffic to a particular device on the network at the push of a button.
Security is not a concern as this is a home lab environment.