Skip to content

Commit bc72a71

Browse files
committed
Merge branch 'bezda-master'
2 parents 6ef406f + 80a3a71 commit bc72a71

File tree

4 files changed

+26
-13
lines changed

4 files changed

+26
-13
lines changed

autossh/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- Security addition: Recommend an extended public key setup on the remote server that disallows anything other than port forwarding.
66
**Existing users** should consider implementing this in their setup. Thanks to @karlbeecken (https://github.com/ThomDietrich/home-assistant-addons/issues/26, https://github.com/ThomDietrich/home-assistant-addons/pull/31)
7+
- Add an option to skip remote host checks
78

89
## 1.3.4
910

autossh/DOCS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,3 +175,7 @@ This is optional and for testing purposes a verbose output enabled by `-v` can b
175175

176176
A key pair is generated when the container is first initialized in your environment.
177177
Set this to `true` if you even need to urge to regenerate a key.
178+
179+
### Option: `skip_remote_host_checks`
180+
181+
Set this to `true` to disable remote host checks. This option is useful for SSH servers that rate-limit incoming connections.

autossh/config.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: SSH Tunnel & Forwarding
2-
version: 1.3.4
2+
version: 1.4.0
33
slug: autossh
44
description: >-
55
Permanent HA forwarding and domain linking through an SSH tunnel
@@ -25,6 +25,7 @@ options:
2525
remote_port: 8123
2626
other_ssh_options: '-v -N'
2727
force_keygen: false
28+
skip_remote_host_checks: false
2829
schema:
2930
hostname: str
3031
ssh_port: int
@@ -37,3 +38,4 @@ schema:
3738
- str
3839
other_ssh_options: str
3940
force_keygen: bool
41+
skip_remote_host_checks: bool

autossh/run.sh

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ fi
3131

3232
OTHER_SSH_OPTIONS=$(jq --raw-output ".other_ssh_options" $CONFIG_PATH)
3333
FORCE_GENERATION=$(jq --raw-output ".force_keygen" $CONFIG_PATH)
34-
AUTHORIZED_KEYS_RESTRICTION="command=\"\",restrict,port-forwarding,permitopen=\"$FORWARD_REMOTE_IP_ADDRESS:$FORWARD_REMOTE_PORT\""
34+
AUTHORIZED_KEYS_RESTRICTION="command=\"\",restrict,port-forwarding,permitopen=\"${FORWARD_REMOTE_IP_ADDRESS}:${FORWARD_REMOTE_PORT}\""
35+
SKIP_REMOTE_HOST_CHECKS=$(jq --raw-output ".skip_remote_host_checks" $CONFIG_PATH)
3536

3637
#
3738

@@ -102,20 +103,25 @@ TEST_COMMAND="/usr/bin/ssh "\
102103
"${USERNAME}@${HOSTNAME} "\
103104
"2>&1 || true"
104105

105-
echo ""
106-
if eval "${TEST_COMMAND}" | grep -q "Permission denied"; then
107-
bashio::log.info "Testing SSH service on '${HOSTNAME}:${SSH_PORT}'... SSH service reachable on remote server"
106+
if [ "$SKIP_REMOTE_HOST_CHECKS" != "true" ]; then
107+
echo ""
108+
if eval "${TEST_COMMAND}" | grep -q "Permission denied"; then
109+
bashio::log.info "Testing SSH service on '${HOSTNAME}:${SSH_PORT}'... SSH service reachable on remote server"
110+
else
111+
eval "${TEST_COMMAND}"
112+
bashio::log.error "Testing SSH service on '${HOSTNAME}:${SSH_PORT}'... Failed to reach the SSH service on the remote server. "\
113+
"Please check your config and consult the addon documentation."
114+
exit 1
115+
fi
116+
117+
echo ""
118+
bashio::log.info "Remote server host keys:"
119+
ssh-keyscan -p $SSH_PORT $HOSTNAME || true
108120
else
109-
eval "${TEST_COMMAND}"
110-
bashio::log.error "Testing SSH service on '${HOSTNAME}:${SSH_PORT}'... Failed to reach the SSH service on the remote server. "\
111-
"Please check your config and consult the addon documentation."
112-
exit 1
121+
echo ""
122+
bashio::log.info "Skipped Remote host checks"
113123
fi
114124

115-
echo ""
116-
bashio::log.info "Remote server host keys:"
117-
ssh-keyscan -p $SSH_PORT $HOSTNAME || true
118-
119125
COMMAND="/usr/bin/autossh "\
120126
"-M 0 "\
121127
"-o ServerAliveInterval=30 "\

0 commit comments

Comments
 (0)