Commit Graph

12004 Commits

Author SHA1 Message Date
djm@openbsd.org d888de06c5
upstream: rewrite this test to use a multiplexed ssh session so we can
control its lifecycle without risk of race conditions; fixes some of the
Github integration tests for openssh-portable

OpenBSD-Regress-ID: 5451cad59ba0d43ae9eeda48ec80f54405fee969
2023-01-11 11:54:13 +11:00
Damien Miller 4bcc737a35
remove buffer len workaround for NetBSD 4.x
Switching to from pipes to a socketpair for communicating with the
ssh process avoids the (kernel bug?) problem.
2023-01-11 11:45:17 +11:00
Damien Miller f5154d2aac
add back use of pipes in scp.c under USE_PIPES
This matches sftp.c which prefers socketpair but uses pipes on
some older platforms.
2023-01-11 11:44:19 +11:00
millert@openbsd.org eec737b59c
upstream: Switch scp from using pipes to a socketpair for
communication with it's ssh sub-processes.  We no longer need to reserve two
descriptors to ensure that we don't end up using fd 0-2 unexpectedly, that is
handled by sanitise_stdfd() in main(). Based on an original diff from djm@.
OK deraadt@ djm@

OpenBSD-Commit-ID: b80c372faac462471e955ddeab9480d668a2e48d
2023-01-11 11:43:17 +11:00
jmc@openbsd.org d213d126a4
upstream: tweak previous; ok djm
OpenBSD-Commit-ID: 229c493452766d70a78b0f02f6ff9894f9028858
2023-01-11 11:43:17 +11:00
Damien Miller 4a5590a5ee
try to improve logging for dynamic-forward test
previously the logs from the ssh used to exercise the forwarding
channel would clobber the logs from the ssh actually doing the
forwarding
2023-01-09 16:33:56 +11:00
Darren Tucker 715bc25dcf
Skip dynamic-forward test on minix3.
This test relies on loopback addresses which minix does not have.
Previously the test would not run at all since it also doesn't have
netcat, but now we use our own netcat it tries and fails.
2023-01-08 18:13:03 +11:00
Damien Miller dd1249bd5c
don't test IPv6 addresses if platform lacks support 2023-01-08 12:11:25 +11:00
dtucker@openbsd.org d77fc611a6
upstream: When OpenSSL is not available, skip parts of percent test
that require it. Based on github pr#368 from ren mingshuai.

OpenBSD-Regress-ID: 49a375b2cf61ccb95b52e75e2e025cd10988ebb2
2023-01-08 12:11:03 +11:00
Darren Tucker 1cd2aac312
Use our own netcat for dynamic-forward test.
That way we can be surer about its behaviour rather than trying to
second-guess the behaviour of various netcat implementations.
2023-01-07 23:01:11 +11:00
Darren Tucker 26cab41c05
Use autoconf to find openssl binary.
It's possible to install an OpenSSL in a path not in the system's
default library search path.  OpenSSH can still use this (eg if you
specify an rpath) but the openssl binary there may not work.  If one is
available on the system path just use that.
2023-01-07 14:30:43 +11:00
Darren Tucker 5532e010a0
Check openssl_bin path is executable before using. 2023-01-07 10:34:18 +11:00
Darren Tucker 5d7b16cff4
Set OPENSSL_BIN from OpenSSL directory. 2023-01-06 23:19:07 +11:00
dtucker@openbsd.org 344a0e8240
upstream: Save debug logs from ssh for debugging purposes.
OpenBSD-Regress-ID: 109e40b06de1c006a3b8e0d8745b790b2c5870a0
2023-01-06 21:37:40 +11:00
djm@openbsd.org e1ef172646
upstream: regression test for ChannelTimeout
OpenBSD-Regress-ID: 280bfbefcfa415428ad744e43f69a8dede8ad685
2023-01-06 21:37:40 +11:00
djm@openbsd.org 2393ea8daf
upstream: fix typo in verbose logging
OpenBSD-Regress-ID: 0497cdb66e003b2f50ed77291a9104fba2e017e9
2023-01-06 21:37:40 +11:00
djm@openbsd.org 161a5378a3
upstream: unit tests for misc.c:ptimeout_* API
OpenBSD-Regress-ID: 01f8fb12d08e5aaadd4bd4e71f456b6588be9a94
2023-01-06 21:37:40 +11:00
tb@openbsd.org 018d671d78
upstream: Copy bytes from the_banana[] rather than banana()
Fixes test failure due to segfault seen on arm64 with xonly snap.

ok djm

OpenBSD-Regress-ID: 86e2aa4bbd1dff1bc4ebb2969c0d6474485be046
2023-01-06 20:25:14 +11:00
Damien Miller ab6bb69e25
unbreak scp on NetBSD 4.x
e555d5cad5 effectively increased the default copy buffer size for SFTP
transfers. This caused NetBSD 4.x to hang during the "copy local file to
remote file in place" scp.sh regression test.

This puts back the original 32KB copy buffer size until we can properly
figure out why.

lots of debugging assistance from dtucker@
2023-01-06 19:13:36 +11:00
djm@openbsd.org 2d1ff2b943
upstream: Implement channel inactivity timeouts
This adds a sshd_config ChannelTimeouts directive that allows channels that
have not seen traffic in a configurable interval to be automatically closed.
Different timeouts may be applied to session, X11, agent and TCP forwarding
channels.

Note: this only affects channels over an opened SSH connection and not
the connection itself. Most clients close the connection when their channels
go away, with a notable exception being ssh(1) in multiplexing mode.

ok markus dtucker

OpenBSD-Commit-ID: ae8bba3ed9d9f95ff2e2dc8dcadfa36b48e6c0b8
2023-01-06 16:23:16 +11:00
djm@openbsd.org 0e34348d0b
upstream: Add channel_set_xtype()
This sets an "extended" channel type after channel creation (e.g.
"session:subsystem:sftp") that will be used for setting channel inactivity
timeouts.

ok markus dtucker

OpenBSD-Commit-ID: 42564aa92345045b4a74300528f960416a15d4ca
2023-01-06 16:21:40 +11:00
djm@openbsd.org ceedf09b29
upstream: tweak channel ctype names
These are now used by sshd_config:ChannelTimeouts to specify timeouts by
channel type, so force them all to use a similar format without whitespace.

ok dtucker markus

OpenBSD-Commit-ID: 66834765bb4ae14f96d2bb981ac98a7dae361b65
2023-01-06 16:21:40 +11:00
djm@openbsd.org c60438158a
upstream: Add channel_force_close()
This will forcibly close an open channel by simulating read/write errors,
draining the IO buffers and calling the detach function.

Previously the detach function was only ever called during channel garbage
collection, but there was no way to signal the user of a channel (e.g.
session.c) that its channel was being closed deliberately (vs. by the
usual state-machine logic). So this adds an extra "force" argument to the
channel cleanup callback to indicate this condition.

ok markus dtucker

OpenBSD-Commit-ID: 23052707a42bdc62fda2508636e624afd466324b
2023-01-06 16:21:39 +11:00
djm@openbsd.org d478cdc7ad
upstream: replace manual poll/ppoll timeout math with ptimeout API
feedback markus / ok markus dtucker

OpenBSD-Commit-ID: c5ec4f2d52684cdb788cd9cbc1bcf89464014be2
2023-01-06 16:21:39 +11:00
djm@openbsd.org 4adf3817a2
upstream: add ptimeout API for keeping track of poll/ppoll
timeouts; ok dtucker markus

OpenBSD-Commit-ID: 3335268ca135b3ec15a947547d7cfbb8ff929ead
2023-01-06 16:21:38 +11:00
djm@openbsd.org 8c7c69d323
upstream: suppress "Connection closed" message when in quiet mode
OpenBSD-Commit-ID: 8a3ab7176764da55f60bfacfeae9b82d84e3908f
2023-01-06 16:21:38 +11:00
djm@openbsd.org 845ceecea2
upstream: regression test for PermitRemoteOpen
OpenBSD-Regress-ID: 8271aafbf5c21950cd5bf966f08e585cebfe630c
2023-01-03 17:53:05 +11:00
djm@openbsd.org b3daa8dc58
upstream: fix bug in PermitRemoteOpen which caused it to ignore its
first argument unless it was one of the special keywords "any" or "none".

Reported by Georges Chaudy in bz3515; ok dtucker@

OpenBSD-Commit-ID: c5678a39f1ff79993d5ae3cfac5746a4ae148ea5
2023-01-03 17:53:05 +11:00
jmc@openbsd.org 0872663a7b
upstream: spelling fixes; from paul tagliamonte amendments to his
diff are noted on tech

OpenBSD-Commit-ID: d776dd03d0b882ca9c83b84f6b384f6f9bd7de4a
2023-01-03 17:53:05 +11:00
djm@openbsd.org 797da2812a
upstream: Mention that scp uses the SFTP protocol and remove
reference to legacy flag. Spotted by, feedback and ok jmc@

OpenBSD-Commit-ID: 9dfe04966f52e941966b46c7a2972147f95281b3
2023-01-03 17:53:05 +11:00
djm@openbsd.org 93f2ce8c05
upstream: Clear signal mask early in main(); sshd may have been
started with one or more signals masked (sigprocmask(2) is not cleared
on fork/exec) and this could interfere with various things, e.g. the
login grace timer.

Execution environments that fail to clear the signal mask before running
sshd are clearly broken, but apparently they do exist.

Reported by Sreedhar Balasubramanian; ok dtucker@

OpenBSD-Commit-ID: 77078c0b1c53c780269fc0c416f121d05e3010ae
2023-01-03 17:53:05 +11:00
jmc@openbsd.org 4acfaabfae
upstream: add -X to usage();
OpenBSD-Commit-ID: 1bdc3df7de11d766587b0428318336dbffe4a9d0
2023-01-03 17:53:05 +11:00
djm@openbsd.org e555d5cad5
upstream: add a -X option to both scp(1) and sftp(1) to allow
control over some SFTP protocol knobs: the copy buffer length and
the number of inflight requests, both of which are used during
upload/download.

Previously these could be controlled in sftp(1) using the -b/-R options.
This makes them available in both SFTP protocol clients using the same
option character sequence.

ok dtucker@

OpenBSD-Commit-ID: 27502bffc589776f5da1f31df8cb51abe9a15f1c
2023-01-03 17:53:05 +11:00
deraadt@openbsd.org 5a7a7acab2
upstream: The idiomatic way of coping with signed char vs unsigned
char (which did not come from stdio read functions) in the presence of
ctype macros, is to always cast to (unsigned char).  casting to (int)
for a "macro" which is documented to take int, is weird.  And sadly wrong,
because of the sing extension risk.. same diff from florian

OpenBSD-Commit-ID: 65b9a49a68e22ff3a0ebd593f363e9f22dd73fea
2023-01-03 17:48:39 +11:00
Darren Tucker b0b58222c7
Simply handling of SSH_CONNECTION PAM env var.
Prompted by bz#3508: there's no need to cache the value of
sshpam_conninfo so remove the global.  While there, add check of
return value from pam_putenv.  ok djm@
2022-12-19 18:49:51 +11:00
Darren Tucker ed8444572a
Add tests for LibreSSL 3.7.0 and OpenSSL 1.1.1s. 2022-12-19 18:42:34 +11:00
Darren Tucker abb9a8aadd
Use sudo when resetting perms on directories. 2022-12-18 21:36:25 +11:00
Darren Tucker 2f5664c590
Set group perms on regress dir.
This ensures that the tests don't fail due to StrictMode checks.
2022-12-18 21:19:33 +11:00
Darren Tucker 137196300f
Fetch regress logs from obj dir. 2022-12-18 21:13:42 +11:00
Darren Tucker 5f93c48365
obsdsnap test VMs runs-on libvirt too. 2022-12-13 20:59:54 +11:00
Darren Tucker 8386886fb1
Run upstream obsdsnap tests on ephemeral runners. 2022-12-13 20:55:37 +11:00
Darren Tucker b6e01459b5
Move obsdsnap test VMs to ephemeral runners. 2022-12-13 20:48:56 +11:00
Damien Miller ea6fdf9a1a
use calloc for allocating arc4random structs
ok dtucker
2022-12-09 18:00:50 +11:00
dtucker@openbsd.org 4403b62f55
upstream: Warn if no host keys for hostbased auth can be loaded.
OpenBSD-Commit-ID: 2a0a13132000cf8d3593133c1b49768aa3c95977
2022-12-09 11:36:35 +11:00
dtucker@openbsd.org a6183e25e3
upstream: Add server debugging for hostbased auth.
auth_debug_add queues messages about the auth process which is sent to
the client after successful authentication.  This also sends those to
the server debug log to aid in debugging.  From bz#3507, ok djm@

OpenBSD-Commit-ID: 46ff67518cccf9caf47e06393e2a121ee5aa258a
2022-12-09 11:36:27 +11:00
cheloha@openbsd.org b85c3581c1
upstream: remove '?' from getopt(3) loops
userspace: remove vestigial '?' cases from top-level getopt(3) loops

getopt(3) returns '?' when it encounters a flag not present in the in
the optstring or if a flag is missing its option argument.  We can
handle this case with the "default" failure case with no loss of
legibility.  Hence, remove all the redundant "case '?':" lines.

Prompted by dlg@.  With help from dlg@ and millert@.

Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2

ok naddy@ millert@ dlg@

OpenBSD-Commit-ID: b2f89346538ce4f5b33ab8011a23e0626a67e66e
2022-12-09 11:36:12 +11:00
dtucker@openbsd.org 9a067e8d28
upstream: Fix comment typo.
OpenBSD-Regress-ID: 3b04faced6511bb5e74648c6a4ef4bf2c4decf03
2022-12-09 11:24:14 +11:00
Darren Tucker ce3c3e78ce
Add SANDBOX_DEBUG to the kitchensink test build. 2022-12-07 18:58:25 +11:00
Damien Miller bc234605fa
disable SANDBOX_SECCOMP_FILTER_DEBUG
It was mistakenly enabled in 2580916e48

Reported by Peter sec-openssh-com.22.fichtner AT 0sg.net
2022-12-07 18:38:25 +11:00
Rose b087c5cfa0
Update autotools
Regenerate config files using latest autotools
2022-12-06 12:23:08 +11:00