Fix manila-ssh element
This commit is contained in:
parent
6105509863
commit
58ebef302c
@ -1,8 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -x
|
set -x
|
||||||
set -eu
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
MANILA_USER="manila"
|
MANILA_USER="manila"
|
||||||
MANILA_USER_HOME="/home/$MANILA_USER"
|
MANILA_USER_HOME="/home/$MANILA_USER"
|
||||||
@ -11,6 +9,7 @@ MANILA_USER_SSH_DIR="$MANILA_USER_HOME/.ssh"
|
|||||||
if [ ! -d $MANILA_USER_SSH_DIR ]; then
|
if [ ! -d $MANILA_USER_SSH_DIR ]; then
|
||||||
mkdir -p $MANILA_USER_SSH_DIR
|
mkdir -p $MANILA_USER_SSH_DIR
|
||||||
chmod 700 $MANILA_USER_SSH_DIR
|
chmod 700 $MANILA_USER_SSH_DIR
|
||||||
|
chown -R $MANILA_USER $MANILA_USER_SSH_DIR
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Fetch public key using HTTP
|
# Fetch public key using HTTP
|
||||||
@ -21,6 +20,7 @@ while [ ! -f $MANILA_USER_SSH_DIR/authorized_keys ]; do
|
|||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
cat /tmp/metadata-key >> $MANILA_USER_SSH_DIR/authorized_keys
|
cat /tmp/metadata-key >> $MANILA_USER_SSH_DIR/authorized_keys
|
||||||
chmod 0600 $MANILA_USER_SSH_DIR/authorized_keys
|
chmod 0600 $MANILA_USER_SSH_DIR/authorized_keys
|
||||||
|
chown $MANILA_USER $MANILA_USER_SSH_DIR/authorized_keys
|
||||||
rm -f /tmp/metadata-key
|
rm -f /tmp/metadata-key
|
||||||
echo "Successfully retrieved public key from instance metadata"
|
echo "Successfully retrieved public key from instance metadata"
|
||||||
echo "*****************"
|
echo "*****************"
|
||||||
@ -37,6 +37,4 @@ while [ ! -f $MANILA_USER_SSH_DIR/authorized_keys ]; do
|
|||||||
echo "Could not retrieve public key from instance metadata (attempt #$FAILED/$ATTEMPTS), retrying in 5 seconds..."
|
echo "Could not retrieve public key from instance metadata (attempt #$FAILED/$ATTEMPTS), retrying in 5 seconds..."
|
||||||
sleep 5
|
sleep 5
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
chown -R $MANILA_USER $MANILA_USER_SSH_DIR
|
|
1
elements/manila-ssh/package-installs.yaml
Normal file
1
elements/manila-ssh/package-installs.yaml
Normal file
@ -0,0 +1 @@
|
|||||||
|
curl:
|
Loading…
Reference in New Issue
Block a user