11#! /bin/bash
22
3- SHARED_DIR=${CISA_HOME} /shared
3+ SHARED_DIR=" ${CISA_HOME} " /shared
44
5- echo " Creating artifacts folder..."
6- mkdir -p " ${SHARED_DIR} /artifacts/"
5+ echo Creating artifacts folder...
6+ mkdir -p " ${SHARED_DIR} " /artifacts/
77
8- echo " Waiting for gatherer"
8+ echo Waiting for gatherer
99while [ " $( redis-cli -h redis get gathering_complete) " != " true" ]; do
1010 sleep 5
1111done
12- echo " Gatherer finished"
12+ echo Gatherer finished
1313
1414# No longer needed
1515redis-cli -h orchestrator_redis_1 del gathering_complete
1616
1717# Run the https-scan scan
18- echo " Running domain-scan scan"
19- cd " ${SHARED_DIR} /artifacts/" || exit
18+ echo Running domain-scan scan
19+ cd " ${SHARED_DIR} " /artifacts/ || exit
2020# We run the three scans separately because we want to reduce the
2121# concurrency for trustymail scans. This is to avoid a situation
2222# where DNS queries are too high a rate (more than 1024
@@ -30,7 +30,7 @@ cd "${SHARED_DIR}/artifacts/" || exit
3030# See this link for an explanation as to why the VPC DNS limitation
3131# was not initially a concern:
3232# https://aws.amazon.com/blogs/compute/announcing-improved-vpc-networking-for-aws-lambda-functions/
33- " ${CISA_HOME} /domain-scan/scan" " ${SHARED_DIR} /artifacts/scanme.csv" \
33+ " ${CISA_HOME} " /domain-scan/scan " ${SHARED_DIR} " /artifacts/scanme.csv \
3434 --scan=pshtt \
3535 --lambda \
3636 --lambda-retries=1 \
@@ -40,8 +40,8 @@ cd "${SHARED_DIR}/artifacts/" || exit
4040 --workers=40
4141# This file would get deleted when we rerun domain-scan/scan if it
4242# stayed where it is
43- mv " ${SHARED_DIR} /artifacts/results/pshtt.csv" " ${SHARED_DIR} /artifacts"
44- " ${CISA_HOME} /domain-scan/scan" " ${SHARED_DIR} /artifacts/scanme.csv" \
43+ mv " ${SHARED_DIR} " /artifacts/results/pshtt.csv " ${SHARED_DIR} " /artifacts
44+ " ${CISA_HOME} " /domain-scan/scan " ${SHARED_DIR} " /artifacts/scanme.csv \
4545 --scan=trustymail \
4646 --lambda \
4747 --lambda-retries=1 \
@@ -52,8 +52,8 @@ mv "${SHARED_DIR}/artifacts/results/pshtt.csv" "${SHARED_DIR}/artifacts"
5252 --smtp-localhost=ec2-100-27-42-254.compute-1.amazonaws.com
5353# This file would get deleted when we rerun domain-scan/scan if it
5454# stayed where it is
55- mv " ${SHARED_DIR} /artifacts/results/trustymail.csv" " ${SHARED_DIR} /artifacts"
56- " ${CISA_HOME} /domain-scan/scan" " ${SHARED_DIR} /artifacts/scanme.csv" \
55+ mv " ${SHARED_DIR} " /artifacts/results/trustymail.csv " ${SHARED_DIR} " /artifacts
56+ " ${CISA_HOME} " /domain-scan/scan " ${SHARED_DIR} " /artifacts/scanme.csv \
5757 --scan=sslyze \
5858 --lambda \
5959 --lambda-retries=1 \
@@ -62,7 +62,10 @@ mv "${SHARED_DIR}/artifacts/results/trustymail.csv" "${SHARED_DIR}/artifacts"
6262 --cache \
6363 --workers=40
6464# Restore the files that we had temporarily copied to a safe place
65- mv " ${SHARED_DIR} /artifacts/{pshtt,trustymail}.csv" " ${SHARED_DIR} /artifacts/results"
65+ #
66+ # Note that we cannot wrap {pshtt,trustymail} in double quotes, since
67+ # that would force the braces to be interpreted as literals.
68+ mv " ${SHARED_DIR} " /artifacts/{pshtt,trustymail}.csv " ${SHARED_DIR} " /artifacts/results
6669
6770# Let redis know we're done
6871redis-cli -h redis set scanning_complete true
0 commit comments