Skip to content
Formatting authored by Kim Carter's avatar Kim Carter
# Setting up for running slaves # Setting up for running slaves
* Make sure there is a firewall rule to allow the `app-scanner` container access to the host for `sam local` * Make sure there is a firewall rule to allow the app-scanner container access to the host for `sam local`
* Make sure host [IP forwarding](https://www.dedoimedo.com/computers/docker-networking.html#mozTocId387645) is [turned on](https://linuxconfig.org/how-to-turn-on-off-ip-forwarding-in-linux) * Make sure host [IP forwarding](https://www.dedoimedo.com/computers/docker-networking.html#mozTocId387645) is [turned on](https://linuxconfig.org/how-to-turn-on-off-ip-forwarding-in-linux)
# Emulating the AWS Lambda service # Emulating the AWS Lambda service
...@@ -203,8 +203,11 @@ Leaving `docker stats` running in a terminal is often useful to see which contai ...@@ -203,8 +203,11 @@ Leaving `docker stats` running in a terminal is often useful to see which contai
<!----> <!---->
2. Host Lambda functions: 2. Host Lambda functions:
~/Source/purpleteam-lambda [`sam local start-lambda`](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-cli-command-reference-sam-local-start-lambda.html) `--host 172.25.0.1 --docker-network compose_pt-net` From the `purpleteam-lambda/` root directory run the following [`sam local start-lambda`](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-cli-command-reference-sam-local-start-lambda.html) command:
The `--host [gateway IP address of compose_pt-net]` is required to bind sam local to the user-defined bridge network `compose_pt-net` in order for it to be reachable from the `app-scanner` container. ```shell
sam local start-lambda --host 172.25.0.1 --docker-network compose_pt-net
```
The `--host [gateway IP address of compose_pt-net]` is required to bind sam local to the user-defined bridge network `compose_pt-net` in order for it to be reachable from the app-scanner container.
The following are the links that were useful for working this out: [`host.docker.internal`, `extra_hosts` and other comments from here down](https://github.com/docker/for-linux/issues/264#issuecomment-410048049), [docker-host container](https://github.com/qoomon/docker-host/blob/master/entrypoint.sh), [`extra_hosts` reference](https://docs.docker.com/compose/compose-file/#extra_hosts), along with creating the firewall rule as mentioned above, and testing connectivity as mentioned in the [Docker](local/local-Docker#docker-cli) page with shelling into running container The following are the links that were useful for working this out: [`host.docker.internal`, `extra_hosts` and other comments from here down](https://github.com/docker/for-linux/issues/264#issuecomment-410048049), [docker-host container](https://github.com/qoomon/docker-host/blob/master/entrypoint.sh), [`extra_hosts` reference](https://docs.docker.com/compose/compose-file/#extra_hosts), along with creating the firewall rule as mentioned above, and testing connectivity as mentioned in the [Docker](local/local-Docker#docker-cli) page with shelling into running container
3. Start your SUT (NodeGoat in this example): 3. Start your SUT (NodeGoat in this example):
...@@ -214,12 +217,24 @@ Leaving `docker stats` running in a terminal is often useful to see which contai ...@@ -214,12 +217,24 @@ Leaving `docker stats` running in a terminal is often useful to see which contai
4. Run the docker-compose: 4. Run the docker-compose:
* Standard: * Standard:
1. ~/Source/purpleteam-orchestrator `npm run dc-build` (builds/rebuilds images after code changes) 1. To build/rebuild images after code changes, from the `purpleteam-orchestrator/` root directory, run the following command:
2. ~/Source/purpleteam-orchestrator `npm run dc-up` ```shell
* Debug (orchestrator or app-scanner. For this example we demo orchestrator, for app-scanner just swap the "orchestrator" with "app"): npm run dc-build
1. ~/Source/purpleteam-orchestrator `npm run dc-build-debug-orchestrator` (builds/rebuilds images after code changes) ```
2. ~/Source/purpleteam-orchestrator `npm run dc-up-debug-orchestrator` 2. From the `purpleteam-orchestrator/` root directory, run the following command:
* Now you can attach to `purpleteam-orchestrator`, or `purpleteam-app-scanner`. Further details in the [Debugging](#debugging) section ```shell
npm run dc-up
```
* Debug (orchestrator or app-scanner. For this example we demo orchestrator, for app-scanner just swap the `orchestrator` with `app`):
1. To build/rebuild images after code changes, from the `purpleteam-orchestrator/` root directory, run the following command:
```shell
npm run dc-build-debug-orchestrator
```
2. From the `purpleteam-orchestrator/` root directory, run the following command:
```shell
npm run dc-up-debug-orchestrator
```
* Now you can attach to the `purpleteam-orchestrator`, or `purpleteam-app-scanner` process within the container. Further details in the [Debugging](#debugging) section
<!----> <!---->
5. Start cli: 5. Start cli:
... ...
......