ThePorgs / Exegol

Fully featured and community-driven hacking environment
https://exegol.readthedocs.io/
GNU General Public License v3.0
1.95k stars 191 forks source link

Request to add a --run-script option for post install setup #186

Closed M-Davies closed 1 year ago

M-Davies commented 1 year ago

The needs

I would like a command line option for exegol start (possibly called --run-script, --run, etc) where you can specifiy a list of shell commands (or a .sh file) that will run on the container once it has booted up. This would help with setting up additional users, tooling, environments, etc.

Description

Long time user (thanks for this project 🙂), I would defintely find this useful in the more hardened environments I test on.

Cause of the hardened environments, I usually need to transfer CA certificates across to the container, install them, set up users and firewall rules, etc which is a pain to do everytime. I would like a command line option that allows you to specify a script file and/or list of commands that does this setup for me. It could look something like this:

/my/workspace/path/script.sh

#!/bin/bash
useradd -m myuser
usermod -aG sudo myuser
apt-get install sshuttle

And then:

exegol start -w /my/workspace/path --run-script /my/workspace/path/script.sh myexegolcontainer full

Alternatives

Simply putting a .sh file in the specified workspace directory and running that. This also works but it would be nice if the container would have it all installed once it's started up and I can just get going with testing.

Additional context

No response

ShutdownRepo commented 1 year ago

Hey there, take a look at my-resources' user setup, I think it answers 100% your need https://exegol.readthedocs.io/en/latest/exegol-image/my-resources.html#user-setup

M-Davies commented 1 year ago

Ah cheers, this is perfect for my needs