diff --git a/README.md b/README.md index d9dbe05..9df2794 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ Tuoni is a cross-platform red teaming framework built for cyber defense exercise ## Prerequisites - **OS:** Debian, Ubuntu, or Kali Linux -- **Architecture:** x86\_64 or ARM64 +- **Architecture:** x86_64 or ARM64 - **Docker:** 25.0.0 or later — installed automatically if missing - **Network:** Outbound internet access for the initial image pull - `wget` or `curl` must be available @@ -76,17 +76,18 @@ curl https://tuoni.sh | bash ### Environment Variables -| Variable | Default | Description | -|---|---|---| -| `SILENT` | _(unset)_ | Set to `1` to skip all interactive prompts | -| `NO_UPDATE` | _(unset)_ | Set to `1` to skip updating the app on re-run | -| `TUONI_USERNAME` | `tuoni` | Initial admin username | -| `TUONI_PASSWORD` | _(autogenerated)_ | Initial admin password | -| `TUONI_DOCKER_IPV6_ENABLED` | `false` | Enable IPv6 on the Docker network | -| `TUONI_REPO` ⚗️ | `https://github.com/shell-dot/tuoni.git` | Source repository override | -| `TUONI_BRANCH` ⚗️ | `main` | Branch to install from | -| `TUONI_VERSION` ⚗️ | _(unset)_ | Pin a specific version | -| `TUONI_SUDO_COMMAND` ⚗️ | `sudo -E` | Override the sudo invocation | +| Variable | Default | Description | +| --------------------------- | ---------------------------------------- | ---------------------------------------------- | +| `SILENT` | _(unset)_ | Set to `1` to skip all interactive prompts | +| `NO_UPDATE` | _(unset)_ | Set to `1` to skip updating the app on re-run | +| `TUONI_USERNAME` | `tuoni` | Initial admin username | +| `TUONI_PASSWORD` | _(autogenerated)_ | Initial admin password | +| `TUONI_DOCKER_IPV6_ENABLED` | `false` | Enable IPv6 on the Docker network | +| `TUONI_REPO` ⚗️ | `https://github.com/shell-dot/tuoni.git` | Source repository override | +| `TUONI_BRANCH` ⚗️ | `main` | Branch to install from | +| `TUONI_VERSION` ⚗️ | _(unset)_ | Pin a specific version | +| `TUONI_SUDO_COMMAND` ⚗️ | `sudo -E` | Override the sudo invocation | +| `TUONI_CONTAINER_REPO` ⚗️ | `ghcr.io` | Container registry or proxy for pulling images | > ⚗️ Experimental — intended for development and testing only. diff --git a/docker-compose.yml b/docker-compose.yml index 3f09520..fe8b8e6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -28,7 +28,7 @@ services: profiles: ["app", "server"] container_name: tuoni-server hostname: tuoni-server - image: ghcr.io/shell-dot/tuoni/server:${VERSION} + image: ${TUONI_CONTAINER_REPO:-ghcr.io}/shell-dot/tuoni/server:${VERSION} volumes: - ./data/:/app/data/ - ./logs/server/:/app/logs/ @@ -45,7 +45,7 @@ services: profiles: ["app", "client"] container_name: tuoni-client hostname: tuoni-client - image: ghcr.io/shell-dot/tuoni/client:${VERSION} + image: ${TUONI_CONTAINER_REPO:-ghcr.io}/shell-dot/tuoni/client:${VERSION} user: 1000:100 environment: - TUONI_CLIENT_PORT @@ -58,7 +58,7 @@ services: - ./plugins/client:/srv/user-defined-plugins/:ro networks: - tuoni-network - + tuoni-client-nginx: <<: *defaults profiles: ["app", "client", "client-nginx"] @@ -82,15 +82,15 @@ services: profiles: ["app", "docs"] container_name: tuoni-docs hostname: tuoni-docs - image: ghcr.io/shell-dot/tuoni/docs:${VERSION} + image: ${TUONI_CONTAINER_REPO:-ghcr.io}/shell-dot/tuoni/docs:${VERSION} networks: - - tuoni-network + - tuoni-network tuoni-utility: <<: *defaults profiles: ["utility"] container_name: tuoni-utility hostname: tuoni-utility - image: ghcr.io/shell-dot/tuoni/utility:${VERSION} + image: ${TUONI_CONTAINER_REPO:-ghcr.io}/shell-dot/tuoni/utility:${VERSION} networks: - - tuoni-network \ No newline at end of file + - tuoni-network diff --git a/scripts/check-configuration.sh b/scripts/check-configuration.sh index 7b020c1..77e14ad 100755 --- a/scripts/check-configuration.sh +++ b/scripts/check-configuration.sh @@ -18,17 +18,27 @@ if [[ ! -z "${TUONI_VERSION+x}" ]]; then sed -i "s/VERSION=.*/VERSION=${TUONI_VERSION}/g" ${TUONI_ENV_FILE_PATH} fi +# Check if TUONI_CONTAINER_REPO variable is set, update tuoni.env file if it is +if [[ "${TUONI_CONTAINER_REPO}" ]]; then + echo "INFO | TUONI_CONTAINER_REPO variable is set, updating tuoni.env file ..." + # Checking if TUONI_CONTAINER_REPO already exists in the file + if grep -q "^TUONI_CONTAINER_REPO=" "$TUONI_ENV_FILE_PATH"; then + # Update existing entry + sed -i "s|^TUONI_CONTAINER_REPO=.*|TUONI_CONTAINER_REPO=${TUONI_CONTAINER_REPO}|g" "$TUONI_ENV_FILE_PATH" + else + echo -e "\nTUONI_CONTAINER_REPO=${TUONI_CONTAINER_REPO}" >> "$TUONI_ENV_FILE_PATH" + fi +fi + # Check if TUONI_DOCKER_IPV6_ENABLED variable is set -if [ "$TUONI_DOCKER_IPV6_ENABLED" ]; then +if [ "${TUONI_DOCKER_IPV6_ENABLED}" ]; then # Remove existing TUONI_DOCKER_IPV6_ENABLED entry - sed -i '/^TUONI_DOCKER_IPV6_ENABLED=/d' $TUONI_ENV_FILE_PATH - - # Ensure the file ends with a newline before appending, only if the file is non-empty - if [ -s "$TUONI_ENV_FILE_PATH" ] && [ "$(tail -c 1 "$TUONI_ENV_FILE_PATH")" != "" ]; then - echo "" >> "$TUONI_ENV_FILE_PATH" + if grep -q "^TUONI_DOCKER_IPV6_ENABLED=" "$TUONI_ENV_FILE_PATH"; then + # Update existing entry + sed -i "s/^TUONI_DOCKER_IPV6_ENABLED=.*/TUONI_DOCKER_IPV6_ENABLED=$TUONI_DOCKER_IPV6_ENABLED/g" "$TUONI_ENV_FILE_PATH" + else + echo -e "\nTUONI_DOCKER_IPV6_ENABLED=$TUONI_DOCKER_IPV6_ENABLED" >> "$TUONI_ENV_FILE_PATH" fi - - echo "TUONI_DOCKER_IPV6_ENABLED=$TUONI_DOCKER_IPV6_ENABLED" >> $TUONI_ENV_FILE_PATH fi # Check if tuoni.yml file exists, create if not @@ -66,7 +76,7 @@ fi # Check if 'client' attribute exists, pre 0.3.2 if [[ ! $($PROJECT_ROOT/scripts/tools/yq '.client.port' $TUONI_CONFIG_FILE_PATH) =~ ^[0-9]+$ ]]; then echo "INFO | 'client' attribute is missing or invalid in config, adding ..." - $PROJECT_ROOT/scripts/tools/yq '.client = load("'$TUONI_CONFIG_EXAMPLE_FILE_PATH'").client' --inplace $TUONI_CONFIG_FILE_PATH + $PROJECT_ROOT/scripts/tools/yq '.client = load("'$TUONI_CONFIG_EXAMPLE_FILE_PATH'").client' --inplace $TUONI_CONFIG_FILE_PATH fi # Ensure necessary directories exist @@ -92,7 +102,7 @@ fi # Ensure server keystore exists if [ ! -f "$PROJECT_ROOT/ssl/server/server-selfsigned.keystore" ]; then echo "INFO | ssl/server/server-selfsigned.keystore file not found, creating ..." - + if [ -d "$PROJECT_ROOT/ssl/server/hsperfdata_root" ]; then ${TUONI_SUDO_COMMAND} rmdir "${PROJECT_ROOT}/ssl/server/hsperfdata_root" fi