Disabled display of commands as they risk leaking Travis OpenSSL key and IV, fixed typo

This commit is contained in:
Georges Dupéron 2018-07-01 11:15:39 +02:00
parent 9a26a0a9b1
commit e1f0ba5228
2 changed files with 2 additions and 7 deletions

Binary file not shown.

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
set -e set -e
set +x set +x # do not display any command, as they could contain the Travis openssl key and IV.
usage() { usage() {
echo "Usage: $0 official_repo deploy_repo deploy_branch deploy_base_commit key_iv_id deploy_directory" echo "Usage: $0 official_repo deploy_repo deploy_branch deploy_base_commit key_iv_id deploy_directory"
@ -27,7 +27,7 @@ deploy_base_commit="$4" # branch name or tag
key_iv_id="$5" # 123456789abc, part of encrypted_123456789abc_key and encrypted_123456789abc_iv key_iv_id="$5" # 123456789abc, part of encrypted_123456789abc_key and encrypted_123456789abc_iv
deploy_directory="$6" # directory to copy on top of deploy_base_commit deploy_directory="$6" # directory to copy on top of deploy_base_commit
key_env_var_name="encrypted_${key_iv_id}_key" key_env_var_name="encrypted_${key_iv_id}_key"
iv_env_var_name="encrypted_${key_iv_id}_key" iv_env_var_name="encrypted_${key_iv_id}_iv"
key="$(sh -c 'echo "${'"$key_env_var_name"'}"')" key="$(sh -c 'echo "${'"$key_env_var_name"'}"')"
iv="$(sh -c 'echo "${'"$iv_env_var_name"'}"')" iv="$(sh -c 'echo "${'"$iv_env_var_name"'}"')"
@ -42,7 +42,6 @@ elif test -z "${key:-}" -o -z "${iv:-}"; then
elif test ! -e travis-deploy-key-id_rsa.enc; then elif test ! -e travis-deploy-key-id_rsa.enc; then
echo "travis-deploy-key-id_rsa.enc not present, will not deploy to ${deploy_repo}:${deploy_branch}." echo "travis-deploy-key-id_rsa.enc not present, will not deploy to ${deploy_repo}:${deploy_branch}."
else else
set -x
echo "Automatic push to ${deploy_repo}:${deploy_branch}" echo "Automatic push to ${deploy_repo}:${deploy_branch}"
# Git configuration: # Git configuration:
@ -52,7 +51,6 @@ else
# SSH configuration # SSH configuration
mkdir -p ~/.ssh mkdir -p ~/.ssh
chmod 700 ~/.ssh chmod 700 ~/.ssh
set +x
if openssl aes-256-cbc -K "$key" -iv "$iv" -in travis-deploy-key-id_rsa.enc -out travis-deploy-key-id_rsa -d >/dev/null 2>&1; then if openssl aes-256-cbc -K "$key" -iv "$iv" -in travis-deploy-key-id_rsa.enc -out travis-deploy-key-id_rsa -d >/dev/null 2>&1; then
echo "Decrypted key successfully." echo "Decrypted key successfully."
else else
@ -60,11 +58,8 @@ else
exit 1 exit 1
fi fi
mv travis-deploy-key-id_rsa ~/.ssh/travis-deploy-key-id_rsa mv travis-deploy-key-id_rsa ~/.ssh/travis-deploy-key-id_rsa
set -x
chmod 600 ~/.ssh/travis-deploy-key-id_rsa chmod 600 ~/.ssh/travis-deploy-key-id_rsa
set +x
eval `ssh-agent -s` eval `ssh-agent -s`
set -x
ssh-add ~/.ssh/travis-deploy-key-id_rsa ssh-add ~/.ssh/travis-deploy-key-id_rsa
TRAVIS_GH_PAGES_DIR="$HOME/travis-temp-auto-push-$(date +%s)" TRAVIS_GH_PAGES_DIR="$HOME/travis-temp-auto-push-$(date +%s)"