diff options
author | djm@openbsd.org <djm@openbsd.org> | 2020-05-27 22:35:19 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2020-05-28 08:42:01 +1000 |
commit | 47adfdc07f4f8ea0064a1495500244de08d311ed (patch) | |
tree | 343ff6c57b4bf6934beb55d71078682990f149f9 /regress | |
parent | 47faad8f794516c33864d866aa1b55d88416f94c (diff) |
upstream: two new tests for Include in sshd_config, checking whether
Port directives are processed correctly and handling of Include directives
that appear before Match. Both tests currently fail. bz#3122 and bz#3169 -
patch from Jakub Jelen
OpenBSD-Regress-ID: 8ad5a4a385a63f0a1c59c59c763ff029b45715df
Diffstat (limited to 'regress')
-rw-r--r-- | regress/servcfginclude.sh | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/regress/servcfginclude.sh b/regress/servcfginclude.sh index b25c8faa8..b6a9a248f 100644 --- a/regress/servcfginclude.sh +++ b/regress/servcfginclude.sh | |||
@@ -146,9 +146,43 @@ Include | |||
146 | _EOF | 146 | _EOF |
147 | 147 | ||
148 | trace "disallow invalid with no argument" | 148 | trace "disallow invalid with no argument" |
149 | ${SUDO} ${REAL_SSHD} -f $OBJ/sshd_config.i.x \ | 149 | ${SUDO} ${REAL_SSHD} -f $OBJ/sshd_config.i.x -T \ |
150 | -C "host=x,user=test,addr=127.0.0.1" 2>/dev/null && \ | 150 | -C "host=x,user=test,addr=127.0.0.1" 2>/dev/null && \ |
151 | fail "sshd allowed Include with no argument" | 151 | fail "sshd allowed Include with no argument" |
152 | 152 | ||
153 | # Ensure the Include before any Match block works as expected (bug #3122) | ||
154 | cat > $OBJ/sshd_config.i << _EOF | ||
155 | Banner /xx | ||
156 | HostKey $OBJ/host.ssh-ed25519 | ||
157 | Include $OBJ/sshd_config.i.2 | ||
158 | Match host a | ||
159 | Banner /aaaa | ||
160 | _EOF | ||
161 | cat > $OBJ/sshd_config.i.2 << _EOF | ||
162 | Match host a | ||
163 | Banner /aa | ||
164 | _EOF | ||
165 | |||
166 | trace "Include before match blocks" | ||
167 | trial a /aa "included file before match blocks is properly evaluated" | ||
168 | |||
169 | # Port in included file is correctly interpretted (bug #3169) | ||
170 | cat > $OBJ/sshd_config.i << _EOF | ||
171 | Include $OBJ/sshd_config.i.2 | ||
172 | Port 7722 | ||
173 | _EOF | ||
174 | cat > $OBJ/sshd_config.i.2 << _EOF | ||
175 | HostKey $OBJ/host.ssh-ed25519 | ||
176 | _EOF | ||
177 | |||
178 | trace "Port after included files" | ||
179 | ${SUDO} ${REAL_SSHD} -f $OBJ/sshd_config.i -T \ | ||
180 | -C "host=x,user=test,addr=127.0.0.1" > $OBJ/sshd_config.out || \ | ||
181 | fail "failed to parse Port after included files" | ||
182 | _port=`grep -i '^port ' $OBJ/sshd_config.out | awk '{print $2}'` | ||
183 | if test "x7722" != "x$_port" ; then | ||
184 | fail "The Port in included file was intertepretted wrongly. Expected 7722, got $_port" | ||
185 | fi | ||
186 | |||
153 | # cleanup | 187 | # cleanup |
154 | rm -f $OBJ/sshd_config.i $OBJ/sshd_config.i.* $OBJ/sshd_config.out | 188 | rm -f $OBJ/sshd_config.i $OBJ/sshd_config.i.* $OBJ/sshd_config.out |