Macro/Gcode that would run commands on SBC
-
I would consider this a security vulnerability, but as there is no way to add macros or write gcode to the Duet2/3 without being on a PC or directly on the PanelDue, I can't see it being a big deal unless someone ran gcode someone else gave them, or the slicer put malicious gcode into the sliced file....
This could be resolved or limited with only allowing approved commands to be sent to the SBC....
I digress.
Using DuetPi, would it be possible to send/run commands on the SBC? Say I run a script/gcode to tell the DuetPi to run a linux command or open a console to be accessed from the PanelDue.
I am asking as I would like to run updates from the PanelDue, or possibly by running a macro/ simple push of a push of the button on PanelDue. BUT only if I could see the feedback on the screen/console (PanelDue or DWC) to understand status.
BUT I do not mind running updates from the command line via SSH (not at all - I just do it far to often than needed as it is a easy command to run), and as mentioned above, see the security implications of this....
Unless someone else can think of other use cases to run linux commands from the Duet, I don't expect a plug in to do enable this.Would like opinions/feedback. First to understand if this would be possible, and Second, other use cases to even cause someone to spend the time to make such a plugin.
-
You mean... something like this? https://github.com/wilriker/execonmcode
https://forum.duet3d.com/topic/13194/dsf-extension-exec-on-mcode-was-shutdown-sbc?_=1605720604780
-
@Phaedrux
Yes. I was thinking of being able to use any command, and not just turn off the DuetPi. But turning off one the DuetPi would have been one of those things I would want to do if this was possible. -
@BlueDust said in Macro/Gcode that would run commands on SBC:
I was thinking of being able to use any command, and not just turn off the DuetPi.
Originally it was just to power off, but now it can run any arbitrary commands on the pi. Read a little deeper.
-
@BlueDust said in Macro/Gcode that would run commands on SBC:
I am asking as I would like to run updates from the PanelDue, or possibly by running a macro/ simple push of a push of the button on PanelDue. BUT only if I could see the feedback on the screen/console (PanelDue or DWC) to understand status.
should be doable to use wilriker's extension to start a script that runs apt to update and along the way uses gcode like m117/m118/m291 to send messages back to the user tracking the progress / status.
-
@bearer @Phaedrux
Thank You. Will look into!
-
rough workflow would be to either start a process and parts its output, run the update with a log and parse the log; the latter being simpler and you might be able to just do
sudo apt upgrade && echo M117 done! | sudo /opt/dsf/bin/CodeConsole
if the error code of apt is usable. -
@bearer
Thanks!
I am going to wait to play with this until after 3.2 comes out. Printer build is not finished yet, and want to stick to stable releases until I have it well tuned and reliable.Thanks again for the head start!