Skip to content

Commit

Permalink
Update code to use the "docker compose" syntax vice "docker-compose"
Browse files Browse the repository at this point in the history
The "docker compose" syntax is the preferred (and only correct) syntax
after the changes in cisagov/ansible-role-docker#60.
  • Loading branch information
jsf9k committed Jun 7, 2022
1 parent 3000f5f commit 6ea4877
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Creates a Docker composition containing instances of:
A sample [docker composition](docker-compose.yml) is included
in this repository.

To start the composition use the command: `docker-compose up`
To start the composition use the command: `docker compose up`

It's normal for the `gophish-tools` container to exit shortly after startup;
it is included in this composition as a convenience for phishing operators.
Expand Down
4 changes: 2 additions & 2 deletions gophish-tools/complete_campaign.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ source "$SCRIPTS_DIR/gophish_common.sh"
CAMPAIGN_ID=$1

# Disable errexit to allow error-handling within get_gophish_api_key
# and for the subsequent docker-compose call to gophish-complete
# and for the subsequent docker compose call to gophish-complete
set +o errexit

# Fetch GoPhish API key
API_KEY=$(get_gophish_api_key)

# Run gophish-complete in the Docker composition
docker-compose -f "$GOPHISH_COMPOSITION" run --rm \
docker compose -f "$GOPHISH_COMPOSITION" run --rm \
gophish-tools gophish-complete "--campaign=$CAMPAIGN_ID" \
"$GOPHISH_URL" "$API_KEY"
complete_rc="$?"
Expand Down
4 changes: 2 additions & 2 deletions gophish-tools/export_assessment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ ASSESSMENT_ID=$1
GOPHISH_WRITABLE_DIR="/var/pca/pca-gophish-composition/data"

# Disable errexit to allow error-handling within get_gophish_api_key
# and for the subsequent docker-compose call to gophish-export
# and for the subsequent docker compose call to gophish-export
set +o errexit

# Fetch GoPhish API key
API_KEY=$(get_gophish_api_key)

# Run gophish-export in the Docker composition
docker-compose -f "$GOPHISH_COMPOSITION" run --rm \
docker compose -f "$GOPHISH_COMPOSITION" run --rm \
--volume "$GOPHISH_WRITABLE_DIR":/home/cisa \
gophish-tools gophish-export "$ASSESSMENT_ID" "$GOPHISH_URL" "$API_KEY"
export_rc="$?"
Expand Down
2 changes: 1 addition & 1 deletion gophish-tools/gophish_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ GOPHISH_URL="https://gophish:3333"

function get_gophish_api_key {
# Fetch GoPhish API key
API_KEY=$(docker-compose -f "$GOPHISH_COMPOSITION" exec -T gophish get-api-key)
API_KEY=$(docker compose -f "$GOPHISH_COMPOSITION" exec -T gophish get-api-key)
api_key_rc="$?"
if [ "$api_key_rc" -ne 0 ]; then
echo "ERROR: Failed to obtain GoPhish API key from Docker composition."
Expand Down
4 changes: 2 additions & 2 deletions gophish-tools/import_assessment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ ASSESSMENT_FILE_BASE=$(basename "$ASSESSMENT_FILE")
ASSESSMENT_FILE_DIR=$(readlink -f "$ASSESSMENT_FILE" | xargs dirname)

# Disable errexit to allow error-handling within get_gophish_api_key
# and for the subsequent docker-compose call to gophish-import
# and for the subsequent docker compose call to gophish-import
set +o errexit

# Fetch GoPhish API key
API_KEY=$(get_gophish_api_key)

# Run gophish-import in the Docker composition
docker-compose -f "$GOPHISH_COMPOSITION" run --rm \
docker compose -f "$GOPHISH_COMPOSITION" run --rm \
--volume "$ASSESSMENT_FILE_DIR":/home/cisa gophish-tools \
gophish-import "$ASSESSMENT_FILE_BASE" "$GOPHISH_URL" "$API_KEY"
import_rc="$?"
Expand Down
4 changes: 2 additions & 2 deletions gophish-tools/test_assessment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ source "$SCRIPTS_DIR/gophish_common.sh"
ASSESSMENT_ID=$1

# Disable errexit to allow error-handling within get_gophish_api_key
# and for the subsequent docker-compose call to gophish-test
# and for the subsequent docker compose call to gophish-test
set +o errexit

# Fetch GoPhish API key
API_KEY=$(get_gophish_api_key)

# Run gophish-test in the Docker composition
docker-compose -f "$GOPHISH_COMPOSITION" run --rm \
docker compose -f "$GOPHISH_COMPOSITION" run --rm \
gophish-tools gophish-test "$ASSESSMENT_ID" "$GOPHISH_URL" "$API_KEY"
test_rc="$?"
if [ "$test_rc" -eq 0 ]; then
Expand Down

0 comments on commit 6ea4877

Please sign in to comment.