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