Merge pull request #332 from errordeveloper/password_env_var

Allow password to be specified in WEAVE_PASSWORD, pass that securely, and thus elminate the need for `-passwordfile`.

Closes #330.
This commit is contained in:
rade committed 2015-01-09 10:05:12 +00:00
commit 5a12c4cf28
2 files changed
+12 -16

No files matched your search

+8 -8
View File
@@ -131,23 +131,23 @@ sharing it between applications:
### <a name="security"></a>Security
In order to connect containers across untrusted networks, weave peers
can be told to encrypt traffic by supplying a `-password` or
`-passwordfile` option when launching weave, e.g.
can be told to encrypt traffic by supplying a `-password` option or
`WEAVE_PASSWORD` environment variable when launching weave, e.g.
host1# weave launch -password wEaVe
or
host1# weave launch -passwordfile /path/to/file
host1# export WEAVE_PASSWORD=wEaVe
host1# weave launch
where the file must contain a single line like this:
WEAVE_PASSWORD=wEaVe
_NOTE: The command line option takes precedence over the environment
variable._
The same password must be specified for all weave peers; it is a
component in the creation of ephemeral session keys for connections
between peers. See the
[crypto documentation](how-it-works.html#crypto) for more details.
between peers. See the [crypto documentation](how-it-works.html#crypto)
for more details.
### <a name="host-network-integration"></a>Host network integration
+4 -8
View File
@@ -6,7 +6,7 @@ SCRIPT_VERSION="(unreleased version)"
usage() {
echo "Usage:"
echo "weave setup"
echo "weave launch [-password <password> | -passwordfile <path>] <peer> ..."
echo "weave launch [-password <password>] <peer> ..."
echo "weave launch-dns <cidr>"
echo "weave connect <peer>"
echo "weave run [--with-dns] <cidr> <docker run args> ..."
@@ -471,19 +471,15 @@ case "$COMMAND" in
fi
if [ "$1" = "-password" ] ; then
[ $# -gt 1 ] || usage
PASSWORD=$2
shift 2
elif [ "$1" = "-passwordfile" ] ; then
[ $# -gt 1 ] || usage
PASSWORDFILE=$2
WEAVE_PASSWORD="$2"
export WEAVE_PASSWORD
shift 2
fi
# Set WEAVE_DOCKER_ARGS in the environment in order to supply
# additional parameters, such as resource limits, to docker
# when launching the weave container.
CONTAINER=$(docker run --privileged -d --name=$CONTAINER_NAME \
-p $PORT:$PORT/tcp -p $PORT:$PORT/udp \
${PASSWORD:+-e WEAVE_PASSWORD="$PASSWORD"} ${PASSWORDFILE:+--env-file="$PASSWORDFILE"} \
-p $PORT:$PORT/tcp -p $PORT:$PORT/udp -e WEAVE_PASSWORD \
$WEAVE_DOCKER_ARGS $IMAGE -name $MACADDR -iface $CONTAINER_IFNAME "$@")
with_container_netns $CONTAINER launch >/dev/null
echo $CONTAINER