diff options
Diffstat (limited to 'regress/keygen-knownhosts.sh')
-rw-r--r-- | regress/keygen-knownhosts.sh | 22 |
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 | ||
4 | tid="ssh-keygen known_hosts" | 4 | tid="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. |
136 | cp $OBJ/kh.invalid.orig $OBJ/kh.invalid | 136 | cp $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 |
138 | diff -u $OBJ/kh.invalid $OBJ/kh.invalid.orig || fail "remove on invalid succeeded" | 138 | diff $OBJ/kh.invalid $OBJ/kh.invalid.orig || fail "remove on invalid succeeded" |
139 | 139 | ||
140 | # Remove key | 140 | # Remove key |
141 | cp $OBJ/kh.hosts.orig $OBJ/kh.hosts | 141 | cp $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 |
143 | grep -v "^host-a " $OBJ/kh.hosts.orig > $OBJ/kh.expect | 143 | grep -v "^host-a " $OBJ/kh.hosts.orig > $OBJ/kh.expect |
144 | diff -u $OBJ/kh.hosts $OBJ/kh.expect || fail "remove simple" | 144 | diff $OBJ/kh.hosts $OBJ/kh.expect || fail "remove simple" |
145 | 145 | ||
146 | # Remove CA key | 146 | # Remove CA key |
147 | cp $OBJ/kh.hosts.orig $OBJ/kh.hosts | 147 | cp $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. |
150 | diff -u $OBJ/kh.hosts $OBJ/kh.hosts.orig || fail "remove CA" | 150 | diff $OBJ/kh.hosts $OBJ/kh.hosts.orig || fail "remove CA" |
151 | 151 | ||
152 | # Remove revoked key | 152 | # Remove revoked key |
153 | cp $OBJ/kh.hosts.orig $OBJ/kh.hosts | 153 | cp $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. |
156 | diff -u $OBJ/kh.hosts $OBJ/kh.hosts.orig || fail "remove revoked" | 156 | diff $OBJ/kh.hosts $OBJ/kh.hosts.orig || fail "remove revoked" |
157 | 157 | ||
158 | # Remove wildcard | 158 | # Remove wildcard |
159 | cp $OBJ/kh.hosts.orig $OBJ/kh.hosts | 159 | cp $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 |
161 | grep -v "^host-e[*] " $OBJ/kh.hosts.orig > $OBJ/kh.expect | 161 | grep -v "^host-e[*] " $OBJ/kh.hosts.orig > $OBJ/kh.expect |
162 | diff -u $OBJ/kh.hosts $OBJ/kh.expect || fail "remove wildcard" | 162 | diff $OBJ/kh.hosts $OBJ/kh.expect || fail "remove wildcard" |
163 | 163 | ||
164 | # Remove multiple | 164 | # Remove multiple |
165 | cp $OBJ/kh.hosts.orig $OBJ/kh.hosts | 165 | cp $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 |
167 | grep -v "^host-f," $OBJ/kh.hosts.orig > $OBJ/kh.expect | 167 | grep -v "^host-f," $OBJ/kh.hosts.orig > $OBJ/kh.expect |
168 | diff -u $OBJ/kh.hosts $OBJ/kh.expect || fail "remove wildcard" | 168 | diff $OBJ/kh.hosts $OBJ/kh.expect || fail "remove wildcard" |
169 | 169 | ||
170 | # Attempt hash on invalid file | 170 | # Attempt hash on invalid file |
171 | cp $OBJ/kh.invalid.orig $OBJ/kh.invalid | 171 | cp $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" |
173 | diff -u $OBJ/kh.invalid $OBJ/kh.invalid.orig || fail "invalid file modified" | 173 | diff $OBJ/kh.invalid $OBJ/kh.invalid.orig || fail "invalid file modified" |
174 | 174 | ||
175 | # Hash valid file | 175 | # Hash valid file |
176 | cp $OBJ/kh.hosts.orig $OBJ/kh.hosts | 176 | cp $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" |
178 | diff -u $OBJ/kh.hosts.old $OBJ/kh.hosts.orig || fail "backup differs" | 178 | diff $OBJ/kh.hosts.old $OBJ/kh.hosts.orig || fail "backup differs" |
179 | grep "^host-[abfgh]" $OBJ/kh.hosts && fail "original hostnames persist" | 179 | grep "^host-[abfgh]" $OBJ/kh.hosts && fail "original hostnames persist" |
180 | 180 | ||
181 | cp $OBJ/kh.hosts $OBJ/kh.hashed.orig | 181 | cp $OBJ/kh.hosts $OBJ/kh.hashed.orig |