This should cause the ttpforge run command (cmd/run.go) to check if superuser: true was specified and if so check user is root/sudo based on EUID (can add windows equivalent support later) - if the user isn't a superuser, error out early before running the TTP.
Basic Example
See above
Drawbacks
You could just hardcode sudo into the TTP, but that's suboptimal - the TTP might run several steps and
put the system into a dirty state, before prompting you for a sudo password that you don't have, forcing you
to CTRL-C out. Or you might not want to use sudo at all for telemetry reasons - maybe sudo is loud on the surface you are targeting, but you have the capability to run a TTP as root via other means. Having sudo hardcoded in your script
would be a negative in that case.
Using superuser: true will force ALL the steps of your TTP to run as root, but that's probably ok - you can always just not use this feature and fall back to using sudo explicitly if you want different steps to happen at different privilege levels.
Implementation PR
No response
Reference Issues
No response
Summary
We should support the following syntax:
This should cause the
ttpforge run
command (cmd/run.go
) to check ifsuperuser: true
was specified and if so check user is root/sudo based on EUID (can add windows equivalent support later) - if the user isn't a superuser, error out early before running the TTP.Basic Example
See above
Drawbacks
You could just hardcode sudo into the TTP, but that's suboptimal - the TTP might run several steps and put the system into a dirty state, before prompting you for a sudo password that you don't have, forcing you to CTRL-C out. Or you might not want to use sudo at all for telemetry reasons - maybe sudo is loud on the surface you are targeting, but you have the capability to run a TTP as root via other means. Having sudo hardcoded in your script would be a negative in that case.
Using
superuser: true
will force ALL the steps of your TTP to run as root, but that's probably ok - you can always just not use this feature and fall back to usingsudo
explicitly if you want different steps to happen at different privilege levels.Unresolved questions
No response