summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--regress/keygen-knownhosts.sh22
1 files changed, 11 insertions, 11 deletions
diff --git a/regress/keygen-knownhosts.sh b/regress/keygen-knownhosts.sh
index 085aac650..693cd0e75 100644
--- a/regress/keygen-knownhosts.sh
+++ b/regress/keygen-knownhosts.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: keygen-knownhosts.sh,v 1.2 2015/01/27 12:01:36 djm Exp $ 1# $OpenBSD: keygen-knownhosts.sh,v 1.3 2015/07/17 03:34:27 djm Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="ssh-keygen known_hosts" 4tid="ssh-keygen known_hosts"
@@ -57,7 +57,7 @@ check_find() {
57 _name=$2 57 _name=$2
58 _keygenopt=$3 58 _keygenopt=$3
59 ${SSHKEYGEN} $_keygenopt -f $OBJ/kh.invalid -F $_host > $OBJ/kh.result 59 ${SSHKEYGEN} $_keygenopt -f $OBJ/kh.invalid -F $_host > $OBJ/kh.result
60 if ! diff -uw $OBJ/kh.expect $OBJ/kh.result ; then 60 if ! diff -w $OBJ/kh.expect $OBJ/kh.result ; then
61 fail "didn't find $_name" 61 fail "didn't find $_name"
62 fi 62 fi
63} 63}
@@ -95,7 +95,7 @@ check_hashed_find() {
95 test "x$_file" = "x" && _file=$OBJ/kh.invalid 95 test "x$_file" = "x" && _file=$OBJ/kh.invalid
96 ${SSHKEYGEN} -f $_file -HF $_host | grep '|1|' | \ 96 ${SSHKEYGEN} -f $_file -HF $_host | grep '|1|' | \
97 sed "s/^[^ ]*/$_host/" > $OBJ/kh.result 97 sed "s/^[^ ]*/$_host/" > $OBJ/kh.result
98 if ! diff -uw $OBJ/kh.expect $OBJ/kh.result ; then 98 if ! diff -w $OBJ/kh.expect $OBJ/kh.result ; then
99 fail "didn't find $_name" 99 fail "didn't find $_name"
100 fi 100 fi
101} 101}
@@ -135,47 +135,47 @@ check_hashed_find host-h "find multiple hosts"
135# Attempt remove key on invalid file. 135# Attempt remove key on invalid file.
136cp $OBJ/kh.invalid.orig $OBJ/kh.invalid 136cp $OBJ/kh.invalid.orig $OBJ/kh.invalid
137${SSHKEYGEN} -qf $OBJ/kh.invalid -R host-a 2>/dev/null 137${SSHKEYGEN} -qf $OBJ/kh.invalid -R host-a 2>/dev/null
138diff -u $OBJ/kh.invalid $OBJ/kh.invalid.orig || fail "remove on invalid succeeded" 138diff $OBJ/kh.invalid $OBJ/kh.invalid.orig || fail "remove on invalid succeeded"
139 139
140# Remove key 140# Remove key
141cp $OBJ/kh.hosts.orig $OBJ/kh.hosts 141cp $OBJ/kh.hosts.orig $OBJ/kh.hosts
142${SSHKEYGEN} -qf $OBJ/kh.hosts -R host-a 2>/dev/null 142${SSHKEYGEN} -qf $OBJ/kh.hosts -R host-a 2>/dev/null
143grep -v "^host-a " $OBJ/kh.hosts.orig > $OBJ/kh.expect 143grep -v "^host-a " $OBJ/kh.hosts.orig > $OBJ/kh.expect
144diff -u $OBJ/kh.hosts $OBJ/kh.expect || fail "remove simple" 144diff $OBJ/kh.hosts $OBJ/kh.expect || fail "remove simple"
145 145
146# Remove CA key 146# Remove CA key
147cp $OBJ/kh.hosts.orig $OBJ/kh.hosts 147cp $OBJ/kh.hosts.orig $OBJ/kh.hosts
148${SSHKEYGEN} -qf $OBJ/kh.hosts -R host-c 2>/dev/null 148${SSHKEYGEN} -qf $OBJ/kh.hosts -R host-c 2>/dev/null
149# CA key should not be removed. 149# CA key should not be removed.
150diff -u $OBJ/kh.hosts $OBJ/kh.hosts.orig || fail "remove CA" 150diff $OBJ/kh.hosts $OBJ/kh.hosts.orig || fail "remove CA"
151 151
152# Remove revoked key 152# Remove revoked key
153cp $OBJ/kh.hosts.orig $OBJ/kh.hosts 153cp $OBJ/kh.hosts.orig $OBJ/kh.hosts
154${SSHKEYGEN} -qf $OBJ/kh.hosts -R host-d 2>/dev/null 154${SSHKEYGEN} -qf $OBJ/kh.hosts -R host-d 2>/dev/null
155# revoked key should not be removed. 155# revoked key should not be removed.
156diff -u $OBJ/kh.hosts $OBJ/kh.hosts.orig || fail "remove revoked" 156diff $OBJ/kh.hosts $OBJ/kh.hosts.orig || fail "remove revoked"
157 157
158# Remove wildcard 158# Remove wildcard
159cp $OBJ/kh.hosts.orig $OBJ/kh.hosts 159cp $OBJ/kh.hosts.orig $OBJ/kh.hosts
160${SSHKEYGEN} -qf $OBJ/kh.hosts -R host-e.blahblah 2>/dev/null 160${SSHKEYGEN} -qf $OBJ/kh.hosts -R host-e.blahblah 2>/dev/null
161grep -v "^host-e[*] " $OBJ/kh.hosts.orig > $OBJ/kh.expect 161grep -v "^host-e[*] " $OBJ/kh.hosts.orig > $OBJ/kh.expect
162diff -u $OBJ/kh.hosts $OBJ/kh.expect || fail "remove wildcard" 162diff $OBJ/kh.hosts $OBJ/kh.expect || fail "remove wildcard"
163 163
164# Remove multiple 164# Remove multiple
165cp $OBJ/kh.hosts.orig $OBJ/kh.hosts 165cp $OBJ/kh.hosts.orig $OBJ/kh.hosts
166${SSHKEYGEN} -qf $OBJ/kh.hosts -R host-h 2>/dev/null 166${SSHKEYGEN} -qf $OBJ/kh.hosts -R host-h 2>/dev/null
167grep -v "^host-f," $OBJ/kh.hosts.orig > $OBJ/kh.expect 167grep -v "^host-f," $OBJ/kh.hosts.orig > $OBJ/kh.expect
168diff -u $OBJ/kh.hosts $OBJ/kh.expect || fail "remove wildcard" 168diff $OBJ/kh.hosts $OBJ/kh.expect || fail "remove wildcard"
169 169
170# Attempt hash on invalid file 170# Attempt hash on invalid file
171cp $OBJ/kh.invalid.orig $OBJ/kh.invalid 171cp $OBJ/kh.invalid.orig $OBJ/kh.invalid
172${SSHKEYGEN} -qf $OBJ/kh.invalid -H 2>/dev/null && fail "hash invalid succeeded" 172${SSHKEYGEN} -qf $OBJ/kh.invalid -H 2>/dev/null && fail "hash invalid succeeded"
173diff -u $OBJ/kh.invalid $OBJ/kh.invalid.orig || fail "invalid file modified" 173diff $OBJ/kh.invalid $OBJ/kh.invalid.orig || fail "invalid file modified"
174 174
175# Hash valid file 175# Hash valid file
176cp $OBJ/kh.hosts.orig $OBJ/kh.hosts 176cp $OBJ/kh.hosts.orig $OBJ/kh.hosts
177${SSHKEYGEN} -qf $OBJ/kh.hosts -H 2>/dev/null || fail "hash failed" 177${SSHKEYGEN} -qf $OBJ/kh.hosts -H 2>/dev/null || fail "hash failed"
178diff -u $OBJ/kh.hosts.old $OBJ/kh.hosts.orig || fail "backup differs" 178diff $OBJ/kh.hosts.old $OBJ/kh.hosts.orig || fail "backup differs"
179grep "^host-[abfgh]" $OBJ/kh.hosts && fail "original hostnames persist" 179grep "^host-[abfgh]" $OBJ/kh.hosts && fail "original hostnames persist"
180 180
181cp $OBJ/kh.hosts $OBJ/kh.hashed.orig 181cp $OBJ/kh.hosts $OBJ/kh.hashed.orig