GitPull: add support for ssh cloned GitHub repositories (#241)

* disabled StrictHostKeyChecking during ssh key validation

* adds support to (ssh cloned) github repositories on key validation

* update Changelog and config.json
This commit is contained in:
Rubens Panfili
2018-02-06 14:06:56 +01:00
committed by Pascal Vizeli
parent f22b2f5709
commit 17576219dc
3 changed files with 8 additions and 5 deletions

View File

@@ -1,5 +1,8 @@
# Changelog # Changelog
## 4.1
- Add support for key validation against ssh cloned GitHub repositories
## 4.0 ## 4.0
- Allow to use user/password authentication for GIT - Allow to use user/password authentication for GIT
- New options `deployment_user` and `deployment_password` - New options `deployment_user` and `deployment_password`

View File

@@ -1,6 +1,6 @@
{ {
"name": "Git pull", "name": "Git pull",
"version": "4.0", "version": "4.1",
"slug": "git_pull", "slug": "git_pull",
"description": "Simple git pull to update the local configuration", "description": "Simple git pull to update the local configuration",
"url": "https://home-assistant.io/addons/git_pull/", "url": "https://home-assistant.io/addons/git_pull/",

View File

@@ -60,11 +60,11 @@ if [ -n "$DEPLOYMENT_KEY" ]; then
echo "Check SSH connection" echo "Check SSH connection"
IFS=':' read -ra GIT_URL_PARTS <<< "$REPOSITORY" IFS=':' read -ra GIT_URL_PARTS <<< "$REPOSITORY"
# shellcheck disable=SC2029 # shellcheck disable=SC2029
if ! ssh -T -o "BatchMode=yes" "${GIT_URL_PARTS[0]}" DOMAIN="${GIT_URL_PARTS[0]}"
then if OUTPUT_CHECK=$(ssh -T -o "StrictHostKeyChecking=no" -o "BatchMode=yes" "$DOMAIN" 2>&1) || ([[ $DOMAIN = *"@github.com"* ]] && [[ $OUTPUT_CHECK = *"You've successfully authenticated"* ]]); then
echo "Valid SSH connection for ${GIT_URL_PARTS[0]}" echo "Valid SSH connection for $DOMAIN"
else else
echo "No valid SSH connection for ${GIT_URL_PARTS[0]}" echo "No valid SSH connection for $DOMAIN"
add-ssh-key add-ssh-key
fi fi
fi fi