Commit Graph

150 Commits

Author SHA1 Message Date
dtucker@openbsd.org
5fc60e8246
upstream: Remove SUDO in proxy command wrapper. Anything that needs
sudo is already run by it, and it breaks if root isn't in sudoers.

OpenBSD-Regress-ID: 6cf22fda32a89c16915f31a6ed9bbdbef2a3bac9
2023-03-02 22:33:12 +11:00
dtucker@openbsd.org
0d514659b2
upstream: Fix breakage on dhgex test.
This was due to the sshd logs being written to the wrong log file.
While there, make save_debug_logs less verbose, write the name of the
tarball to regress.log and use $SUDO to remove the old symlinks (which
shouldn't be needed, but won't hurt).  Initial problem spotted by anton@.

OpenBSD-Regress-ID: 9c44fb9cd418e6ff31165e7a6c1f9f11a6d19f5b
2023-03-02 19:32:21 +11:00
dtucker@openbsd.org
13fe8f9785
upstream: Remove old log symlinks
before creating new ones. In -portable some platforms don't like
overwriting existing symlinks.

OpenBSD-Regress-ID: 7e7ddc0beb73e945e1c4c58d51c8a125b518120f
2023-03-02 17:43:00 +11:00
dtucker@openbsd.org
a6f4ac8a2b
upstream: Rework logging for the regression tests.
Previously we would log to ssh.log and sshd.log, but that is insufficient
for tests that have more than one concurent ssh/sshd.

Instead, we'll log to separate datestamped files in a $OBJ/log/ and
leave a symlink at the previous location pointing at the most recent
instance with an entry in regress.log showing which files were created
at each point.  This should be sufficient to reconstruct what happened
even for tests that use multiple instances of each program.  If the test
fails, tar up all of the logs for later analysis.

This will let us also capture the output from some of the other tools
which was previously sent to /dev/null although most of those will be
in future commits.

OpenBSD-Regress-ID: f802aa9e7fa51d1a01225c05fb0412d015c33e24
2023-03-01 22:02:47 +11:00
Darren Tucker
eb88d07c43
Revert explicit chmods on private keys.
This should no longer be needed on Cygwin test runners due to previous
commit.
2023-02-25 14:45:41 +11:00
Darren Tucker
0c5d4c843d
Explicitly set permissions on user and host keys.
On cygwin, the umask might not be sufficient.  Should fix tests on
Github runners.
2023-02-24 13:44:13 +11:00
Darren Tucker
ab69dda05d
Always use the openssl binary configure tells us.
This fixes tests on platforms that do not have the openssl tool
installed at all.
2023-02-20 20:01:29 +11:00
dtucker@openbsd.org
625f6bc398
upstream: Move scp path setting to a helper function. The previous
commit to add scp to the test sshd's path causes the t-envpass test to fail
when the test scp is given using a fully qualified path.  Put this in a
helper function and only call it from the scp tests.

OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4
2023-01-13 16:02:49 +11:00
dtucker@openbsd.org
6e6f886470
upstream: Add scp's path to test sshd's PATH.
If the scp we're testing is fully qualified (eg it's not in the system
PATH) then add its path to the under-test sshd's PATH so we can find
it. Prompted by bz#3518.

OpenBSD-Regress-ID: 7df4f5a0be3aa135495b7e5a6719d3cbc26cc4c0
2023-01-13 15:52:17 +11:00
dtucker@openbsd.org
5a4a9f7a96 upstream: Restore missing "!" in TEST_SSH_ELAPSED_TIMES test.
OpenBSD-Regress-ID: 38783f9676ec348c5a792caecee9a16e354b37b0
2022-07-25 17:33:44 +10:00
dtucker@openbsd.org
0ff886be13 upstream: Test TEST_SSH_ELAPSED_TIMES for empty string not
executable.  No-op on most platforms but should prevent warnings in -portable
on systems that don't have 'date %s'.

OpenBSD-Regress-ID: e39d79867b8065e33d0c5926fa1a31f85659d2a4
2022-07-25 11:05:27 +10:00
Darren Tucker
f69319ad8a Convert "have_prog" function into "which".
"which" and its behaviour is not standardized, so convert the existing
have_prog function into "which" so we can rely on it being available
and what its semantics are.  Add a have_prog wrapper that maintains the
existing behaviour.
2022-07-23 14:40:49 +10:00
dtucker@openbsd.org
35ef2b3b6e upstream: Add TEST_REGRESS_CACHE_DIR.
If set, it is used to cache regress test names that have succeeded and
skip those on a re-run.

OpenBSD-Regress-ID: a7570dd29a58df59f2cca647c3c2ec989b49f247
2022-07-04 19:41:06 +10:00
Damien Miller
b2aee35a1f find sk-dummy.so when build_dir != src_dir
spotted by Corinna Vinschen; feedback & ok dtucker@
2022-02-17 21:15:16 +11:00
Darren Tucker
2e5cfed513 Improve compatibility of early exit trap handling.
Dash (as used by the github runners) has some differences in its trap
builtin:
 - it doesn't have -p (which is fine, that's not in posix).
 - it doesn't work in a subshell (which turns out to be in compliance
   with posix, which means bash isn't).
 - it doesn't work in a pipeline, ie "trap|cat" produces no output.
2022-01-20 13:43:54 +11:00
Darren Tucker
20da6ed136 Invoke EXIT handler early when using Valgrind.
When using Valgrind, we need to wait for all invoked programs to
complete before checking their valgrind logs.  Some tests, notably
agent-restrict, set an EXIT trap handler to clean up things like
ssh-agent, but those do not get invoked until test-exec.sh exits.
This causes the Valgrind wait to deadlock, so if present invoke
the EXIT handler before checking the Valgrind logs.
2022-01-19 15:37:39 +11:00
Darren Tucker
c171879374 Remove sort wrapper.
agent-restrict now takes care of this itself.
2022-01-13 16:01:41 +11:00
Darren Tucker
6bf2efa267 Add "rev" command replacement if needed. 2022-01-12 18:25:06 +11:00
Darren Tucker
3ef403f351 Add wrapper for "sort" to set LC_ALL=C.
Found by djm, this should make sorts stable and reduce test flakiness.
2022-01-10 21:07:38 +11:00
dtucker@openbsd.org
dc38236ab6 upstream: Don't explicitly set HostbasedAuthentication in
sshd_config. It defaults to "no", and not explicitly setting it allows us to
enable it for the (optional) hostbased test.

OpenBSD-Regress-ID: aa8e3548eb5793721641d26e56c29f363b767c0c
2022-01-07 09:50:07 +11:00
dtucker@openbsd.org
8f3b180305 upstream: Log command invocation while debugging.
This will aid in manually reproducing failing commands.

OpenBSD-Regress-ID: b4aba8d5ac5675ceebeeeefa3261ce344e67333a
2022-01-05 11:51:04 +11:00
Darren Tucker
9b2ee74e3a Move the fgrep replacement to hostkey-rotate.sh.
The fgrep replacement for buggy greps doesn't work in the sftp-glob test
so move it to just where we know it's needed.
2021-09-24 11:08:03 +10:00
Darren Tucker
f703954157 Replacement function for buggy fgrep.
GNU (f)grep <=2.18, as shipped by FreeBSD<=12 and NetBSD<=9 will
occasionally fail to find ssh host keys in the hostkey-rotate test.
If we have those versions, use awk instead.
2021-09-24 08:06:48 +10:00
dtucker@openbsd.org
8b02ef0f28 upstream: Add a function to skip remaining tests.
Many tests skip tests for various reasons but not in a consistent way and
don't always clean up, so add that and switch the tests that do that over.

OpenBSD-Regress-ID: 72d2ec90a3ee8849486956a808811734281af735
2021-09-01 11:40:43 +10:00
dtucker@openbsd.org
86b4cb3a88 upstream: Although it's POSIX, not all shells used in Portable support
the implicit 'in "$@"' after 'for i'.

OpenBSD-Regress-ID: 3c9aec6bca4868f85d2742b6ba5223fce110bdbc
2021-08-08 18:43:41 +10:00
Darren Tucker
f2ccf6c9f3 Move portable specific settings down.
This brings the top hunk of the file back in sync with OpenBSD
so patches to the CVS Id should apply instead of always being
rejected.
2021-08-08 17:39:56 +10:00
dtucker@openbsd.org
71b0eb997e upstream: Move setting of USER further down the startup In portable
we have to change this and having it in the same hunk as the CVS Id string
means applying changes fails every. single. time.

OpenBSD-Regress-ID: 87cd603eb6db58c9b430bf90adacb7f90864429b
2021-08-08 17:35:45 +10:00
dtucker@openbsd.org
f0aca2706c upstream: Drop -q in ssh-log-wrapper.sh to preserve logs.
scp and sftp like to add -q to the command line passed to ssh which
overrides the LogLevel we set in the config files and suppresses output
to the debug logs so drop any "-q" from the invoked ssh.  In the one
case where we actually want to use -q in the banner test, call the ssh
binary directly bypassing the logging wrapper.

OpenBSD-Regress-ID: e2c97d3c964bda33a751374c56f65cdb29755b75
2021-08-08 17:19:56 +10:00
dtucker@openbsd.org
727ce36c8c upstream: Replace OPENSSL as the variable that points to the
openssl binary with OPENSSL_BIN.  This will allow us to use the OPENSSL
variable from mk.conf or the make(1) command line indicating if we're
building with our without OpenSSL, and ultimately get the regress tests
working in the OPENSSL=no configuration.

OpenBSD-Regress-ID: 2d788fade3264d7803e5b54cae8875963f688c4e
2021-07-25 22:35:24 +10:00
dtucker@openbsd.org
249ad4ae51 upstream: Set umask when creating hostkeys to prevent excessive
permissions warning.

OpenBSD-Regress-ID: 382841db0ee28dfef7f7bffbd511803e1b8ab0ef
2021-06-10 20:13:09 +10:00
Darren Tucker
5de0867b82 Check for $OPENSSL in md5 fallback too. 2021-06-02 11:22:12 +10:00
dtucker@openbsd.org
9d482295c9 upstream: Use a default value for $OPENSSL,
allowing it to be overridden. Do the same in the PuTTY tests since it's
needed there and not exported by test-exec.sh.

OpenBSD-Regress-ID: c49dcd6aa7602a8606b7afa192196ca1fa65de16
2021-06-02 10:11:25 +10:00
dtucker@openbsd.org
07660b3c99 upstream: Find openssl binary via environment variable. This
allows overriding if necessary (eg in -portable where we're testing against a
specific version of OpenSSL).

OpenBSD-Regress-ID: 491f39cae9e762c71aa4bf045803d077139815c5
2021-06-01 14:38:41 +10:00
Darren Tucker
d1bd184046 Remove only use of warn().
The warn() function is only used in one place in portable and does not
exist upstream.  Upgrade the only instance it's used to fail()
(the privsep/sandbox+proxyconnect, from back when that was new) and
remove the now-unused function.
2021-04-07 17:02:51 +10:00
Darren Tucker
fea8f4b1aa Move make_tmpdir() into portable-specific area.
Reduces diff vs OpenBSD and makes it more likely diffs will apply
cleanly.
2021-04-07 17:02:51 +10:00
dtucker@openbsd.org
13e5fa2acf upstream: Add TEST_SSH_ELAPSED_TIMES environment variable to print the
elapsed time in seconds of each test.  This depends on "date +%s" which is
not specified by POSIX but is commonly implemented.

OpenBSD-Regress-ID: ec3c8c19ff49b2192116a0a646ee7c9b944e8a9c
2021-04-07 17:02:51 +10:00
Darren Tucker
ef4f46ab43 Move the TEST_SSH_PORT section down a bit.
This groups the portable-specific changes together and makes it a
little more likely that patches will apply cleanly.
2021-04-07 17:02:51 +10:00
dtucker@openbsd.org
721948e674 upstream: Add TEST_SSH_MODULI_FILE variable to allow overriding of the
moduli file used during the test run.

OpenBSD-Regress-ID: be10f785263120edb64fc87db0e0d6570a10220a
2021-03-13 13:02:51 +11:00
dtucker@openbsd.org
64bbd7444d upstream: Make sure puttygen is new enough to successfully run the
PuTTY interop tests, otherwise skip them.

OpenBSD-Regress-ID: 34565bb50b8aec58331ed02a5e9e0a9a929bef51
2021-02-17 15:08:29 +11:00
Darren Tucker
f88a7a4312 Add a hostname function for systems that don't have it.
Some systems don't have a hostname command (it's not required by POSIX).
The do have uname -n (which is), but as found by tim@ some others (eg
UnixWare) do not report the FQDN from uname -n.
2021-02-06 09:37:01 +11:00
Damien Miller
3e9811e57b ensure $LOGNAME is set in tests 2020-12-22 18:31:50 +11:00
Darren Tucker
c13403e55d Skip security key tests if ENABLE_SK not set. 2020-05-05 11:32:43 +10:00
Darren Tucker
300c4322b9 Pass configure's egrep through to test-exec.sh.
Use it to create a wrapper function to call it from tests.  Fixes the
keygen-comment test on platforms with impoverished default egrep (eg
Solaris).
2020-04-22 11:35:49 +10:00
dtucker@openbsd.org
d1d5f72851 upstream: Indicate if we're using a cached key in trace output.
OpenBSD-Regress-ID: 409a7b0e59d1272890fda507651c0c3d2d3c0d89
2020-04-05 10:58:53 +10:00
djm@openbsd.org
677d0ece67 upstream: regress test for sshd_config Include directive; from Jakub
Jelen

OpenBSD-Regress-ID: 0d9224de3297c7a5f51ba68d6e3725a2a9345fa4
2020-02-01 10:28:33 +11:00
dtucker@openbsd.org
a0c81d2402 upstream: Move setting $NC into test-exec since it's now used by
multiple tests, and in -portable we use our own local copy to avoid
portability problems.

OpenBSD-Regress-ID: ceb78445fcaac317bec2fc51b3f0d9589048c114
2020-01-25 14:33:53 +11:00
dtucker@openbsd.org
0585b56972 upstream: Do not warn about permissions on symlinks.
OpenBSD-Regress-ID: 339d4cbae224bd8743ffad9c3afb0cf3cb66c357
2020-01-24 14:23:06 +11:00
dtucker@openbsd.org
ba247af8e9 upstream: When checking for unsafe directories, ignore non-directories
(ie symlinks, where permissions are not relevant).

OpenBSD-Regress-ID: fb6cfc8b022becb62b2dcb99ed3f072b3326e501
2020-01-23 22:20:53 +11:00
dtucker@openbsd.org
7e1323102b upstream: Check for and warn about StrictModes permission problems. ok tb@
OpenBSD-Regress-ID: 4841704ccdee50ee7efc6035bc686695c6ac2991
2020-01-23 15:49:09 +11:00
djm@openbsd.org
f8c11461aa upstream: pass SSH_SK_HELPER explicitly past $SUDO to avoid it getting
cleared; with dtucker@

OpenBSD-Regress-ID: 03178a0580324bf0dff28f7eac6c3edbc5407f8e
2020-01-21 19:08:37 +11:00