summaryrefslogtreecommitdiffstats
path: root/regress/knownhosts.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 19:49:46 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 19:49:46 +0000
commit0b6b94e6b6152f15cf4c2247c5974f539aae28cd (patch)
treea7698198a1f527ede17a929af46e456e03d50600 /regress/knownhosts.sh
parentInitial commit. (diff)
downloadopenssh-0b6b94e6b6152f15cf4c2247c5974f539aae28cd.tar.xz
openssh-0b6b94e6b6152f15cf4c2247c5974f539aae28cd.zip
Adding upstream version 1:9.6p1.upstream/1%9.6p1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'regress/knownhosts.sh')
-rw-r--r--regress/knownhosts.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/regress/knownhosts.sh b/regress/knownhosts.sh
new file mode 100644
index 0000000..7a9da5b
--- /dev/null
+++ b/regress/knownhosts.sh
@@ -0,0 +1,35 @@
+# $OpenBSD: knownhosts.sh,v 1.2 2023/02/09 09:55:33 dtucker Exp $
+# Placed in the Public Domain.
+
+tid="known hosts"
+
+opts="-F $OBJ/ssh_proxy"
+
+trace "test initial connection"
+${SSH} $opts somehost true || fail "initial connection"
+
+trace "learn hashed known host"
+>$OBJ/known_hosts
+${SSH} -ohashknownhosts=yes -o stricthostkeychecking=no $opts somehost true \
+ || fail "learn hashed known_hosts"
+
+trace "test hashed known hosts"
+${SSH} $opts somehost true || fail "reconnect with hashed known hosts"
+
+trace "no newline at end of known_hosts"
+printf "something" >$OBJ/known_hosts
+${SSH} $opts -ostricthostkeychecking=no somehost true \
+ || fail "hostkey update, missing newline, no strict"
+${SSH} $opts -ostricthostkeychecking=yes somehost true \
+ || fail "reconnect after adding with missing newline"
+
+trace "newline at end of known_hosts"
+printf "something\n" >$OBJ/known_hosts
+${SSH} $opts -ostricthostkeychecking=no somehost true \
+ || fail "hostkey update, newline, no strict"
+${SSH} $opts -ostricthostkeychecking=yes somehost true \
+ || fail "reconnect after adding without missing newline"
+lines=`wc -l <$OBJ/known_hosts`
+if [ $lines -ne 2 ]; then
+ fail "expected 2 lines in known_hosts, found $lines"
+fi