
This changeset - removes executable bits from README.md - adds executable bits to shell scripts These changes are largely symbolic, except for osbash.sh which users are expected to run without having to change permissions or passing it as an argument to bash. Partial-Bug: 1312764 Implements: blueprint openstack-training-labs Change-Id: I91cce85862171a360c31e1e7628a708dfefd70f1
38 lines
1.1 KiB
Bash
Executable File
38 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# This script installs the unsecure Vagrant ssh keys. This allows users to
|
|
# log into the VMs using these keys instead of a password.
|
|
|
|
TOP_DIR=$(cd $(dirname "$0")/.. && pwd)
|
|
source "$TOP_DIR/config/paths"
|
|
source "$LIB_DIR/functions.guest"
|
|
|
|
indicate_current_auto
|
|
|
|
exec_logfile
|
|
|
|
function install_vagrant_public_key {
|
|
local VAGRANT_KEY_NAME="vagrant.pub"
|
|
local KEY_URL=https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/$VAGRANT_KEY_NAME
|
|
local VAGRANT_KEY_DIR=$LIB_DIR/vagrant-ssh-keys
|
|
|
|
if [ ! -f "$VAGRANT_KEY_DIR/$VAGRANT_KEY_NAME" ]; then
|
|
wget --output-document "$VAGRANT_KEY_DIR/$VAGRANT_KEY_NAME" "$KEY_URL"
|
|
if [ $? -ne 0 ]; then
|
|
echo >&2 "Error when downloading $KEY_URL"
|
|
return 1
|
|
fi
|
|
fi
|
|
|
|
mkdir -p "$HOME/.ssh"
|
|
chmod 700 "$HOME/.ssh"
|
|
cat "$VAGRANT_KEY_DIR/$VAGRANT_KEY_NAME" >> "$HOME/.ssh/authorized_keys"
|
|
chmod 400 "$HOME/.ssh/authorized_keys"
|
|
}
|
|
|
|
if grep -qs "vagrant insecure public key" "$HOME/.ssh/authorized_keys"; then
|
|
echo "Vagrant insecure public key already installed"
|
|
else
|
|
install_vagrant_public_key
|
|
fi
|