xref: /openssh-portable/.github/configs (revision cb4ff640)
1#!/bin/sh
2#
3# usage: configs vmname test_config (or '' for default)
4#
5# Sets the following variables:
6# CONFIGFLAGS           options to ./configure
7# SSHD_CONFOPTS         sshd_config options
8# TEST_TARGET           make target used when testing.  defaults to "tests".
9# LTESTS
10
11config=$1
12
13TEST_TARGET="tests"
14LTESTS=""
15SKIP_LTESTS=""
16SUDO=sudo	# run with sudo by default
17TEST_SSH_UNSAFE_PERMISSIONS=1
18
19CONFIGFLAGS=""
20LIBCRYPTOFLAGS=""
21
22case "$config" in
23    default|sol64)
24	;;
25    kitchensink)
26	CONFIGFLAGS="--with-kerberos5 --with-libedit --with-pam"
27	CONFIGFLAGS="${CONFIGFLAGS} --with-security-key-builtin --with-selinux"
28	CONFIGFLAGS="${CONFIGFLAGS} --with-cflags=-DSK_DEBUG"
29	;;
30    hardenedmalloc)
31	CONFIGFLAGS="--with-ldflags=-lhardened_malloc"
32	;;
33    kerberos5)
34	CONFIGFLAGS="--with-kerberos5"
35	;;
36    libedit)
37	CONFIGFLAGS="--with-libedit"
38	;;
39    *pam)
40	CONFIGFLAGS="--with-pam"
41	SSHD_CONFOPTS="UsePam yes"
42	;;
43    libressl-head)
44	LIBCRYPTOFLAGS="--with-ssl-dir=/opt/libressl/head --with-rpath=-Wl,-rpath,"
45	;;
46    openssl-head)
47	LIBCRYPTOFLAGS="--with-ssl-dir=/opt/openssl/head --with-rpath=-Wl,-rpath,"
48	;;
49    selinux)
50	CONFIGFLAGS="--with-selinux"
51	;;
52    sk)
53	CONFIGFLAGS="--with-security-key-builtin"
54        ;;
55    without-openssl)
56	LIBCRYPTOFLAGS="--without-openssl"
57	TEST_TARGET=t-exec
58	;;
59    valgrind-[1-4]|valgrind-unit)
60	# rlimit sandbox and FORTIFY_SOURCE confuse Valgrind.
61	CONFIGFLAGS="--without-sandbox --without-hardening"
62	CONFIGFLAGS="$CONFIGFLAGS --with-cppflags=-D_FORTIFY_SOURCE=0"
63	TEST_TARGET="t-exec USE_VALGRIND=1"
64	TEST_SSH_ELAPSED_TIMES=1
65	export TEST_SSH_ELAPSED_TIMES
66	# Valgrind slows things down enough that the agent timeout test
67	# won't reliably pass, and the unit tests run longer than allowed
68	# by github so split into three separate tests.
69	tests2="rekey integrity"
70	tests3="krl forward-control sshsig"
71	tests4="cert-userkey cert-hostkey kextype sftp-perm keygen-comment"
72	case "$config" in
73	    valgrind-1)
74		# All tests except agent-timeout (which is flaky under valgrind)
75		#) and slow ones that run separately to increase parallelism.
76		SKIP_LTESTS="agent-timeout ${tests2} ${tests3} ${tests4}"
77		;;
78	    valgrind-2)
79		LTESTS="${tests2}"
80		;;
81	    valgrind-3)
82		LTESTS="${tests3}"
83		;;
84	    valgrind-4)
85		LTESTS="${tests4}"
86		;;
87	    valgrind-unit)
88		TEST_TARGET="unit USE_VALGRIND=1"
89		;;
90	esac
91	;;
92    *)
93	echo "Unknown configuration $config"
94	exit 1
95	;;
96esac
97
98# The Solaris 64bit targets are special since they need a non-flag arg.
99case "$config" in
100    sol64*)
101	CONFIGFLAGS="x86_64 --with-cflags=-m64 --with-ldflags=-m64 ${CONFIGFLAGS}"
102	LIBCRYPTOFLAGS="--with-ssl-dir=/usr/local/ssl64"
103	;;
104esac
105
106case "${TARGET_HOST}" in
107    sol10|sol11)
108	# sol10 VM is 32bit and the unit tests are slow.
109	# sol11 has 4 test configs so skip unit tests to speed up.
110	TEST_TARGET="tests SKIP_UNIT=1"
111	;;
112    win10)
113	# No sudo on Windows.
114	SUDO=""
115	;;
116esac
117
118# If we have a local openssl/libressl, use that.
119if [ -z "${LIBCRYPTOFLAGS}" ]; then
120	# last-match
121	for i in /usr/local /usr/local/ssl /usr/local/opt/openssl; do
122		if [ -x ${i}/bin/openssl ]; then
123			LIBCRYPTOFLAGS="--with-ssl-dir=${i}"
124		fi
125	done
126fi
127
128CONFIGFLAGS="${CONFIGFLAGS} ${LIBCRYPTOFLAGS}"
129
130export LTESTS SUDO TEST_TARGET TEST_SSH_UNSAFE_PERMISSIONS
131