forked from aws-samples/aws-iot-securetunneling-localproxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix aws-samples#45 Allowing localproxy source port exposure via docker
Motivation: To forward traffic from the host machine to the docker container, we need to expose the listening port, and bind the localproxy listener to 0.0.0.0 address since "localhost" address is only accessible from within the container. Modification: Updated the instructions to use the correct localproxy option to bind to 0.0.0.0 if the user needs to access localproxy from outside the container, And updated the docker-run.sh script to accept a port as an argument. Test: 1. Ran the localproxy using docker, confirmed it's binding to 0.0.0.0 and that I can SSH from outside the container (the host). 2. Ran the localproxy natively, confirmed it's binding to localhost and that I can SSH from the host.
- Loading branch information
Showing
2 changed files
with
16 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,16 @@ | ||
#!/bin/bash | ||
|
||
docker run --name localproxy --rm -it aws-iot-securetunneling-localproxy:latest bash | ||
while getopts p: flag | ||
do | ||
case "${flag}" in | ||
p) port=${OPTARG};; | ||
esac | ||
done | ||
|
||
if [ -z $port ]; then | ||
docker run --name localproxy --rm -it aws-iot-securetunneling-localproxy:latest bash; | ||
else | ||
echo Running the container with exposed port: $port | ||
docker run --name localproxy --expose=$port -p $port:$port --rm -it aws-iot-securetunneling-localproxy:latest bash; | ||
fi | ||
|