Skip to content

Commit ac7c26b

Browse files
authored
Merge pull request #159 from geedo0/merge-ossh97
Upgrade to OpenSSH v9.7
2 parents e452df2 + 490ff89 commit ac7c26b

File tree

279 files changed

+18225
-11728
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

279 files changed

+18225
-11728
lines changed

.depend

Lines changed: 33 additions & 40 deletions
Large diffs are not rendered by default.

.github/ci-status.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1-
[![C/C++ CI](https://github.com/openssh/openssh-portable/actions/workflows/c-cpp.yml/badge.svg)](https://github.com/openssh/openssh-portable/actions/workflows/c-cpp.yml)
2-
[![C/C++ CI self-hosted](https://github.com/openssh/openssh-portable-selfhosted/actions/workflows/selfhosted.yml/badge.svg)](https://github.com/openssh/openssh-portable-selfhosted/actions/workflows/selfhosted.yml)
3-
[![Upstream self-hosted](https://github.com/openssh/openssh-portable-selfhosted/actions/workflows/upstream.yml/badge.svg)](https://github.com/openssh/openssh-portable-selfhosted/actions/workflows/upstream.yml)
1+
master :
2+
[![C/C++ CI](https://github.com/openssh/openssh-portable/actions/workflows/c-cpp.yml/badge.svg)](https://github.com/openssh/openssh-portable/actions/workflows/c-cpp.yml?query=branch:master)
3+
[![C/C++ CI self-hosted](https://github.com/openssh/openssh-portable-selfhosted/actions/workflows/selfhosted.yml/badge.svg)](https://github.com/openssh/openssh-portable-selfhosted/actions/workflows/selfhosted.yml?query=branch:master)
4+
[![Upstream self-hosted](https://github.com/openssh/openssh-portable-selfhosted/actions/workflows/upstream.yml/badge.svg)](https://github.com/openssh/openssh-portable-selfhosted/actions/workflows/upstream.yml?query=branch:master)
5+
[![CIFuzz](https://github.com/openssh/openssh-portable/actions/workflows/cifuzz.yml/badge.svg)](https://github.com/openssh/openssh-portable/actions/workflows/cifuzz.yml)
46
[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/openssh.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:openssh)
7+
[![Coverity Status](https://scan.coverity.com/projects/21341/badge.svg)](https://scan.coverity.com/projects/openssh-portable)
8+
9+
9.4 :
10+
[![C/C++ CI](https://github.com/openssh/openssh-portable/actions/workflows/c-cpp.yml/badge.svg?branch=V_9_4)](https://github.com/openssh/openssh-portable/actions/workflows/c-cpp.yml?query=branch:V_9_4)
11+
[![C/C++ CI self-hosted](https://github.com/openssh/openssh-portable-selfhosted/actions/workflows/selfhosted.yml/badge.svg?branch=V_9_4)](https://github.com/openssh/openssh-portable-selfhosted/actions/workflows/selfhosted.yml?query=branch:V_9_4)
12+
13+
9.3 :
14+
[![C/C++ CI](https://github.com/openssh/openssh-portable/actions/workflows/c-cpp.yml/badge.svg?branch=V_9_3)](https://github.com/openssh/openssh-portable/actions/workflows/c-cpp.yml?query=branch:V_9_3)
15+
[![C/C++ CI self-hosted](https://github.com/openssh/openssh-portable-selfhosted/actions/workflows/selfhosted.yml/badge.svg?branch=V_9_3)](https://github.com/openssh/openssh-portable-selfhosted/actions/workflows/selfhosted.yml?query=branch:V_9_3)

.github/configs

Lines changed: 184 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,13 @@
99
# LTESTS
1010

1111
config=$1
12+
if [ "$config" = "" ]; then
13+
config="default"
14+
fi
15+
16+
unset CC CFLAGS CPPFLAGS LDFLAGS LTESTS SUDO
1217

13-
TEST_TARGET="tests"
18+
TEST_TARGET="tests compat-tests"
1419
LTESTS=""
1520
SKIP_LTESTS=""
1621
SUDO=sudo # run with sudo by default
@@ -25,26 +30,97 @@ case "$config" in
2530
default|sol64)
2631
;;
2732
c89)
33+
# If we don't have LLONG_MAX, configure will figure out that it can
34+
# get it by setting -std=gnu99, at which point we won't be testing
35+
# C89 any more. To avoid this, feed it in via CFLAGS.
36+
llong_max=`gcc -E -dM - </dev/null | \
37+
awk '$2=="__LONG_LONG_MAX__"{print $3}'`
38+
CPPFLAGS="-DLLONG_MAX=${llong_max}"
39+
2840
CC="gcc"
2941
CFLAGS="-Wall -std=c89 -pedantic -Werror=vla"
3042
CONFIGFLAGS="--without-zlib"
3143
LIBCRYPTOFLAGS="--without-openssl"
3244
TEST_TARGET=t-exec
3345
;;
3446
cygwin-release)
35-
CONFIGFLAGS="--with-libedit --with-xauth=/usr/bin/xauth --disable-strip --with-security-key-builtin"
47+
# See https://cygwin.com/git/?p=git/cygwin-packages/openssh.git;a=blob;f=openssh.cygport;hb=HEAD
48+
CONFIGFLAGS="--with-xauth=/usr/bin/xauth --with-security-key-builtin"
49+
CONFIGFLAGS="$CONFIGFLAGS --with-kerberos5=/usr --with-libedit --disable-strip"
3650
;;
3751
clang-12-Werror)
3852
CC="clang-12"
3953
# clang's implicit-fallthrough requires that the code be annotated with
4054
# __attribute__((fallthrough)) and does not understand /* FALLTHROUGH */
41-
CFLAGS="-Wall -Wextra -O2 -Wno-error=implicit-fallthrough"
55+
CFLAGS="-Wall -Wextra -O2 -Wno-error=implicit-fallthrough -Wno-error=unused-parameter"
4256
CONFIGFLAGS="--with-pam --with-Werror"
4357
;;
58+
*-sanitize-*)
59+
case "$config" in
60+
gcc-*)
61+
CC=gcc
62+
;;
63+
clang-*)
64+
# Find the newest available version of clang
65+
for i in `seq 10 99`; do
66+
clang="`which clang-$i 2>/dev/null`"
67+
[ -x "$clang" ] && CC="$clang"
68+
done
69+
;;
70+
esac
71+
# Put Sanitizer logs in regress dir.
72+
SANLOGS=`pwd`/regress
73+
# - We replace chroot with chdir so that the sanitizer in the preauth
74+
# privsep process can read /proc.
75+
# - clang does not recognizes explicit_bzero so we use bzero
76+
# (see https://github.com/google/sanitizers/issues/1507
77+
# - openssl and zlib trip ASAN.
78+
# - sp_pwdp returned by getspnam trips ASAN, hence disabling shadow.
79+
case "$config" in
80+
*-sanitize-address)
81+
CFLAGS="-fsanitize=address -fno-omit-frame-pointer"
82+
LDFLAGS="-fsanitize=address"
83+
CPPFLAGS='-Dchroot=chdir -Dexplicit_bzero=bzero -D_FORTIFY_SOURCE=0 -DASAN_OPTIONS=\"detect_leaks=0:log_path='$SANLOGS'/asan.log\"'
84+
CONFIGFLAGS=""
85+
TEST_TARGET="t-exec"
86+
;;
87+
clang-sanitize-memory)
88+
CFLAGS="-fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer"
89+
LDFLAGS="-fsanitize=memory"
90+
CPPFLAGS='-Dchroot=chdir -Dexplicit_bzero=bzero -DMSAN_OPTIONS=\"log_path='$SANLOGS'/msan.log\"'
91+
CONFIGFLAGS="--without-zlib --without-shadow"
92+
LIBCRYPTOFLAGS="--without-openssl"
93+
TEST_TARGET="t-exec"
94+
;;
95+
*-sanitize-undefined)
96+
CFLAGS="-fsanitize=undefined"
97+
LDFLAGS="-fsanitize=undefined"
98+
;;
99+
*)
100+
echo unknown sanitize option;
101+
exit 1;;
102+
esac
103+
features="--disable-security-key --disable-pkcs11"
104+
hardening="--without-sandbox --without-hardening --without-stackprotect"
105+
privsep="--with-privsep-user=root"
106+
CONFIGFLAGS="$CONFIGFLAGS $features $hardening $privsep"
107+
# Because we hobble chroot we can't test it.
108+
SKIP_LTESTS=sftp-chroot
109+
;;
44110
gcc-11-Werror)
45-
CC="gcc"
111+
CC="gcc-11"
112+
# -Wnoformat-truncation in gcc 7.3.1 20180130 fails on fmt_scaled
113+
# -Wunused-result ignores (void) so is not useful. See
114+
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425
115+
CFLAGS="-O2 -Wno-format-truncation -Wimplicit-fallthrough=4 -Wno-unused-parameter -Wno-unused-result"
116+
CONFIGFLAGS="--with-pam --with-Werror"
117+
;;
118+
gcc-12-Werror)
119+
CC="gcc-12"
46120
# -Wnoformat-truncation in gcc 7.3.1 20180130 fails on fmt_scaled
47-
CFLAGS="-Wall -Wextra -Wno-format-truncation -O2 -Wimplicit-fallthrough=4"
121+
# -Wunused-result ignores (void) so is not useful. See
122+
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425
123+
CFLAGS="-O2 -Wno-format-truncation -Wimplicit-fallthrough=4 -Wno-unused-parameter -Wno-unused-result"
48124
CONFIGFLAGS="--with-pam --with-Werror"
49125
;;
50126
clang*|gcc*)
@@ -53,7 +129,7 @@ case "$config" in
53129
kitchensink)
54130
CONFIGFLAGS="--with-kerberos5 --with-libedit --with-pam"
55131
CONFIGFLAGS="${CONFIGFLAGS} --with-security-key-builtin --with-selinux"
56-
CONFIGFLAGS="${CONFIGFLAGS} --with-cflags=-DSK_DEBUG"
132+
CFLAGS="-DSK_DEBUG -DSANDBOX_SECCOMP_FILTER_DEBUG"
57133
;;
58134
hardenedmalloc)
59135
CONFIGFLAGS="--with-ldflags=-lhardened_malloc"
@@ -81,11 +157,25 @@ case "$config" in
81157
CONFIGFLAGS="--with-pam"
82158
SSHD_CONFOPTS="UsePam yes"
83159
;;
160+
boringssl)
161+
CONFIGFLAGS="--disable-pkcs11"
162+
LIBCRYPTOFLAGS="--with-ssl-dir=/opt/boringssl --with-rpath=-Wl,-rpath,"
163+
;;
84164
libressl-*)
85165
LIBCRYPTOFLAGS="--with-ssl-dir=/opt/libressl --with-rpath=-Wl,-rpath,"
86166
;;
167+
putty-*)
168+
CONFIGFLAGS="--with-plink=/usr/local/bin/plink --with-puttygen=/usr/local/bin/puttygen"
169+
# We don't need to rerun the regular tests, just the interop ones.
170+
TEST_TARGET=interop-tests
171+
;;
87172
openssl-*)
88173
LIBCRYPTOFLAGS="--with-ssl-dir=/opt/openssl --with-rpath=-Wl,-rpath,"
174+
# OpenSSL 1.1.1 specifically has a bug in its RNG that breaks reexec
175+
# fallback. See https://bugzilla.mindrot.org/show_bug.cgi?id=3483
176+
if [ "$config" = "openssl-1.1.1" ]; then
177+
SKIP_LTESTS="reexec"
178+
fi
89179
;;
90180
selinux)
91181
CONFIGFLAGS="--with-selinux"
@@ -97,7 +187,7 @@ case "$config" in
97187
LIBCRYPTOFLAGS="--without-openssl"
98188
TEST_TARGET=t-exec
99189
;;
100-
valgrind-[1-4]|valgrind-unit)
190+
valgrind-[1-5]|valgrind-unit)
101191
# rlimit sandbox and FORTIFY_SOURCE confuse Valgrind.
102192
CONFIGFLAGS="--without-sandbox --without-hardening"
103193
CONFIGFLAGS="$CONFIGFLAGS --with-cppflags=-D_FORTIFY_SOURCE=0"
@@ -106,15 +196,19 @@ case "$config" in
106196
export TEST_SSH_ELAPSED_TIMES
107197
# Valgrind slows things down enough that the agent timeout test
108198
# won't reliably pass, and the unit tests run longer than allowed
109-
# by github so split into three separate tests.
110-
tests2="rekey integrity try-ciphers sftp"
111-
tests3="krl forward-control sshsig agent-restrict kextype"
199+
# by github so split into separate tests.
200+
tests2="integrity try-ciphers"
201+
tests3="krl forward-control sshsig agent-restrict kextype sftp"
112202
tests4="cert-userkey cert-hostkey kextype sftp-perm keygen-comment percent"
203+
tests5="rekey"
113204
case "$config" in
114205
valgrind-1)
115-
# All tests except agent-timeout (which is flaky under valgrind)
116-
#) and slow ones that run separately to increase parallelism.
117-
SKIP_LTESTS="agent-timeout ${tests2} ${tests3} ${tests4}"
206+
# All tests except agent-timeout (which is flaky under valgrind),
207+
# connection-timeout (which doesn't work since it's so slow)
208+
# and hostbased (since valgrind won't let ssh exec keysign).
209+
# Slow ones are run separately to increase parallelism.
210+
SKIP_LTESTS="agent-timeout connection-timeout hostbased"
211+
SKIP_LTESTS="$SKIP_LTESTS ${tests2} ${tests3} ${tests4} ${tests5}"
118212
;;
119213
valgrind-2)
120214
LTESTS="${tests2}"
@@ -125,11 +219,18 @@ case "$config" in
125219
valgrind-4)
126220
LTESTS="${tests4}"
127221
;;
222+
valgrind-5)
223+
LTESTS="${tests5}"
224+
;;
128225
valgrind-unit)
129226
TEST_TARGET="unit USE_VALGRIND=1"
130227
;;
131228
esac
132229
;;
230+
zlib-develop)
231+
INSTALL_ZLIB=develop
232+
CONFIGFLAGS="--with-zlib=/opt/zlib --with-rpath=-Wl,-rpath,"
233+
;;
133234
*)
134235
echo "Unknown configuration $config"
135236
exit 1
@@ -139,28 +240,53 @@ esac
139240
# The Solaris 64bit targets are special since they need a non-flag arg.
140241
case "$config" in
141242
sol64*)
142-
CONFIGFLAGS="x86_64 --with-cflags=-m64 --with-ldflags=-m64 ${CONFIGFLAGS}"
143-
LIBCRYPTOFLAGS="--with-ssl-dir=/usr/local/ssl64"
243+
CONFIGFLAGS="--target=x86_64 --with-cflags=-m64 --with-ldflags=-m64 ${CONFIGFLAGS}"
244+
LIBCRYPTOFLAGS="--with-ssl-dir=/usr/local/ssl64 --with-rpath=-Wl,-rpath,"
144245
;;
145246
esac
146247

147248
case "${TARGET_HOST}" in
249+
aix*)
250+
CONFIGFLAGS="--disable-security-key"
251+
LIBCRYPTOFLAGS="--without-openssl"
252+
# These are slow real or virtual machines so skip the slowest tests
253+
# (which tend to be thw ones that transfer lots of data) so that the
254+
# test run does not time out.
255+
# The agent-restrict test fails due to some quoting issue when run
256+
# with sh or ksh so specify bash for now.
257+
TEST_TARGET="t-exec unit TEST_SHELL=bash"
258+
SKIP_LTESTS="rekey sftp"
259+
;;
260+
debian-riscv64)
261+
# This machine is fairly slow, so skip the unit tests.
262+
TEST_TARGET="t-exec"
263+
;;
148264
dfly58*|dfly60*)
149265
# scp 3-way connection hangs on these so skip until sorted.
150266
SKIP_LTESTS=scp3
151267
;;
268+
fbsd6)
269+
# Native linker is not great with PIC so OpenSSL is built w/out.
270+
CONFIGFLAGS="${CONFIGFLAGS} --disable-security-key"
271+
;;
152272
hurd)
153273
SKIP_LTESTS="forwarding multiplex proxy-connect hostkey-agent agent-ptrace"
154274
;;
155275
minix3)
156-
LIBCRYPTOFLAGS="--without-openssl --disable-security-key"
276+
CONFIGFLAGS="${CONFIGFLAGS} --disable-security-key"
277+
# Unix domain sockets don't work quite like we expect, so also
278+
# disable FD passing (and thus multiplexing).
279+
CONFIGFLAGS="${CONFIGFLAGS} --disable-fd-passing"
280+
LIBCRYPTOFLAGS="--without-openssl"
281+
157282
# Minix does not have a loopback interface so we have to skip any
158283
# test that relies on one.
159284
# Also, Minix seems to be very limited in the number of select()
160285
# calls that can be operating concurrently, so prune additional tests for that.
161-
T="addrmatch agent-restrict brokenkeys cfgmatch cfgmatchlisten cfgparse connect
162-
connect-uri exit-status forward-control forwarding hostkey-agent
163-
key-options keyscan knownhosts-command login-timeout multiplex
286+
T="addrmatch agent-restrict brokenkeys cfgmatch cfgmatchlisten cfgparse
287+
connect connect-uri dynamic-forward exit-status forwarding
288+
forward-control
289+
hostkey-agent key-options keyscan knownhosts-command login-timeout
164290
reconfigure reexec rekey scp scp-uri scp3 sftp sftp-badcmds
165291
sftp-batch sftp-cmds sftp-glob sftp-perm sftp-uri stderr-data
166292
transfer"
@@ -173,6 +299,11 @@ case "${TARGET_HOST}" in
173299
# SHA256 functions in sha2.h conflict with OpenSSL's breaking sk-dummy
174300
CONFIGFLAGS="${CONFIGFLAGS} --without-hardening --disable-security-key"
175301
;;
302+
openwrt-*)
303+
CONFIGFLAGS="${CONFIGFLAGS} --without-zlib"
304+
LIBCRYPTOFLAGS="--without-openssl"
305+
TEST_TARGET="t-exec"
306+
;;
176307
sol10|sol11)
177308
# sol10 VM is 32bit and the unit tests are slow.
178309
# sol11 has 4 test configs so skip unit tests to speed up.
@@ -184,23 +315,50 @@ case "${TARGET_HOST}" in
184315
;;
185316
esac
186317

187-
# Unless specified otherwise, build without OpenSSL on Mac OS since
188-
# modern versions don't ship with libcrypto.
189-
case "`./config.guess`" in
318+
host=`./config.guess`
319+
case "$host" in
320+
*cygwin)
321+
SUDO=""
322+
# Don't run compat tests on cygwin as they don't currently compile.
323+
TEST_TARGET="tests"
324+
;;
190325
*-darwin*)
326+
# Unless specified otherwise, build without OpenSSL on Mac OS since
327+
# modern versions don't ship with libcrypto.
191328
LIBCRYPTOFLAGS="--without-openssl"
192329
TEST_TARGET=t-exec
330+
331+
# On some OS X runners we can't write to /var/empty.
332+
CONFIGFLAGS="${CONFIGFLAGS} --with-privsep-path=/usr/local/empty"
333+
334+
case "$host" in
335+
*-darwin22.*)
336+
# sudo -S nobody doesn't work on macos 13 for some reason.
337+
SKIP_LTESTS="agent-getpeereid" ;;
338+
esac
193339
;;
194340
esac
195341

196-
# If we have a local openssl/libressl, use that.
342+
# Unless specifically configured, search for a suitable version of OpenSSL,
343+
# otherwise build without it.
197344
if [ -z "${LIBCRYPTOFLAGS}" ]; then
345+
LIBCRYPTOFLAGS="--without-openssl"
198346
# last-match
199-
for i in /usr/local /usr/local/ssl /usr/local/opt/openssl; do
347+
for i in /usr /usr/local /usr/local/ssl /usr/local/opt/openssl; do
348+
ver="none"
200349
if [ -x ${i}/bin/openssl ]; then
201-
LIBCRYPTOFLAGS="--with-ssl-dir=${i}"
350+
ver="$(${i}/bin/openssl version)"
202351
fi
352+
case "$ver" in
353+
none) ;;
354+
"OpenSSL 0."*|"OpenSSL 1.0."*|"OpenSSL 1.1.0"*) ;;
355+
"LibreSSL 2."*|"LibreSSL 3.0."*) ;;
356+
*) LIBCRYPTOFLAGS="--with-ssl-dir=${i}" ;;
357+
esac
203358
done
359+
if [ "${LIBCRYPTOFLAGS}" = "--without-openssl" ]; then
360+
TEST_TARGET="t-exec"
361+
fi
204362
fi
205363

206364
CONFIGFLAGS="${CONFIGFLAGS} ${LIBCRYPTOFLAGS}"
@@ -210,5 +368,5 @@ if [ -x "$(which plink 2>/dev/null)" ]; then
210368
export REGRESS_INTEROP_PUTTY
211369
fi
212370

213-
export CC CFLAGS LTESTS SUDO
371+
export CC CFLAGS CPPFLAGS LDFLAGS LTESTS SUDO
214372
export TEST_TARGET TEST_SSH_UNSAFE_PERMISSIONS TEST_SSH_FAIL_FATAL

.github/configure.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ if [ "x$LDFLAGS" != "x" ]; then
1818
fi
1919

2020
echo ./configure ${CONFIGFLAGS}
21-
./configure ${CONFIGFLAGS}
21+
./configure ${CONFIGFLAGS} 2>&1

.github/run_test.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,22 @@
66

77
set -ex
88

9+
# If we want to test hostbased auth, set up the host for it.
10+
if [ ! -z "$SUDO" ] && [ ! -z "$TEST_SSH_HOSTBASED_AUTH" ]; then
11+
sshconf=/usr/local/etc
12+
hostname | $SUDO tee $sshconf/shosts.equiv >/dev/null
13+
echo "EnableSSHKeysign yes" | $SUDO tee $sshconf/ssh_config >/dev/null
14+
$SUDO mkdir -p $sshconf
15+
$SUDO cp -p /etc/ssh/ssh_host*key* $sshconf
16+
$SUDO make install
17+
for key in $sshconf/ssh_host*key*.pub; do
18+
echo `hostname` `cat $key` | \
19+
$SUDO tee -a $sshconf/ssh_known_hosts >/dev/null
20+
done
21+
fi
22+
923
output_failed_logs() {
10-
for i in regress/failed*; do
24+
for i in regress/failed*.log; do
1125
if [ -f "$i" ]; then
1226
echo -------------------------------------------------------------------------
1327
echo LOGFILE $i

0 commit comments

Comments
 (0)