blob: d15898ad0ba15b8bc0d19e5f038b4959f10f6f91 [file] [log] [blame]
millert@openbsd.org@openbsd.org116b1b42017-10-24 19:33:32 +00001# $OpenBSD: Makefile,v 1.96 2017/10/24 19:33:32 millert Exp $
Damien Miller38cd4352002-05-01 13:17:33 +10002
markus@openbsd.org27ca1a52015-01-12 20:13:27 +00003REGRESS_TARGETS= unit t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t-exec
Damien Miller9e1cfca2015-02-26 20:32:58 -08004tests: prep $(REGRESS_TARGETS)
Damien Miller38cd4352002-05-01 13:17:33 +10005
Damien Milleraf784932008-03-13 00:17:00 +11006# Interop tests are not run by default
Damien Miller66429962008-03-13 12:05:40 +11007interop interop-tests: t-exec-interop
Damien Milleraf784932008-03-13 00:17:00 +11008
Damien Miller9e1cfca2015-02-26 20:32:58 -08009prep:
Damien Miller02973ad2015-02-28 08:05:27 -080010 test "x${USE_VALGRIND}" = "x" || mkdir -p $(OBJ)/valgrind-out
Damien Miller9e1cfca2015-02-26 20:32:58 -080011
Darren Tuckerebc3c132003-09-04 15:37:58 +100012clean:
Darren Tuckerb12d16f2003-09-14 11:40:35 +100013 for F in $(CLEANFILES); do rm -f $(OBJ)$$F; done
Darren Tuckerf3568fc2013-05-17 09:35:26 +100014 test -z "${SUDO}" || ${SUDO} rm -f ${SUDO_CLEAN}
Damien Miller9c8a4272008-03-27 17:42:06 +110015 rm -rf $(OBJ).putty
16
Darren Tuckerebc3c132003-09-04 15:37:58 +100017distclean: clean
Damien Miller38cd4352002-05-01 13:17:33 +100018
19LTESTS= connect \
20 proxy-connect \
21 connect-privsep \
millert@openbsd.org@openbsd.org116b1b42017-10-24 19:33:32 +000022 connect-uri \
Damien Miller38cd4352002-05-01 13:17:33 +100023 proto-version \
24 proto-mismatch \
25 exit-status \
Darren Tucker4c37ef02004-06-16 20:08:56 +100026 envpass \
Damien Miller38cd4352002-05-01 13:17:33 +100027 transfer \
Darren Tuckerdc001a52003-10-08 17:47:19 +100028 banner \
Darren Tuckerd57a76e2003-06-18 22:32:51 +100029 rekey \
Damien Miller38cd4352002-05-01 13:17:33 +100030 stderr-data \
31 stderr-after-eof \
32 broken-pipe \
33 try-ciphers \
34 yes-head \
Darren Tucker017fd612004-02-29 20:30:17 +110035 login-timeout \
Damien Miller38cd4352002-05-01 13:17:33 +100036 agent \
Damien Miller8b9cde72003-01-22 17:53:16 +110037 agent-getpeereid \
38 agent-timeout \
39 agent-ptrace \
Damien Miller38cd4352002-05-01 13:17:33 +100040 keyscan \
Damien Miller8b9cde72003-01-22 17:53:16 +110041 keygen-change \
Damien Millerb6bd3c22010-02-24 17:24:56 +110042 keygen-convert \
dtucker@openbsd.org44d82fc2016-09-12 02:25:46 +000043 keygen-moduli \
Damien Miller2e80cf22008-06-30 08:06:25 +100044 key-options \
Darren Tucker50433a92004-06-16 20:15:59 +100045 scp \
millert@openbsd.org@openbsd.org116b1b42017-10-24 19:33:32 +000046 scp-uri \
Damien Miller38cd4352002-05-01 13:17:33 +100047 sftp \
Darren Tuckerf3568fc2013-05-17 09:35:26 +100048 sftp-chroot \
Damien Miller8b9cde72003-01-22 17:53:16 +110049 sftp-cmds \
Darren Tuckera4040f52003-06-18 22:35:11 +100050 sftp-badcmds \
Damien Miller8b9cde72003-01-22 17:53:16 +110051 sftp-batch \
Darren Tucker1c56ef62005-03-07 17:36:18 +110052 sftp-glob \
Damien Millera176e182013-10-18 09:05:41 +110053 sftp-perm \
millert@openbsd.org@openbsd.org116b1b42017-10-24 19:33:32 +000054 sftp-uri \
Darren Tucker50cea672003-06-18 22:45:34 +100055 reconfigure \
Darren Tuckere2f2be72003-07-03 20:27:55 +100056 dynamic-forward \
Darren Tuckere7d05832004-06-16 20:22:22 +100057 forwarding \
Darren Tucker977a9d22004-06-25 13:45:18 +100058 multiplex \
Darren Tucker124f58e2004-12-06 23:07:37 +110059 reexec \
Damien Miller7b1877c2006-07-24 15:31:41 +100060 brokenkeys \
dtucker@openbsd.orge6508892016-06-03 04:10:41 +000061 sshcfgparse \
dtucker@openbsd.org0ef1de72015-04-23 05:01:19 +000062 cfgparse \
Damien Miller7b1877c2006-07-24 15:31:41 +100063 cfgmatch \
Darren Tucker10f92422008-06-10 23:16:46 +100064 addrmatch \
Damien Millera5e58422008-03-12 23:58:05 +110065 localcommand \
Darren Tucker287b9322009-10-07 10:31:56 +110066 forcecommand \
Damien Miller58ac6de2010-02-27 07:57:12 +110067 portnum \
Darren Tuckereab5f0d2010-11-05 18:23:38 +110068 keytype \
69 kextype \
Damien Miller58ac6de2010-02-27 07:57:12 +110070 cert-hostkey \
Damien Miller7d06b002011-01-07 09:54:20 +110071 cert-userkey \
Damien Miller771c43c2012-12-03 10:12:13 +110072 host-expand \
Damien Miller999bd2d2012-12-03 10:13:39 +110073 keys-command \
Damien Miller1fb593a2012-12-12 10:54:37 +110074 forward-control \
Damien Millerebafebd2013-01-18 11:51:56 +110075 integrity \
djm@openbsd.org4bea0ab2014-12-22 08:06:03 +000076 krl \
djm@openbsd.org09205532015-01-13 07:49:49 +000077 multipubkey \
djm@openbsd.orgd59ec472015-01-18 19:47:55 +000078 limit-keytype \
djm@openbsd.org79478102015-01-18 22:00:18 +000079 hostkey-agent \
djm@openbsd.orgd411d392015-01-26 06:12:18 +000080 keygen-knownhosts \
djm@openbsd.org13640792015-05-21 06:44:25 +000081 hostkey-rotate \
djm@openbsd.orge14ac432015-09-24 06:16:53 +000082 principals-command \
djm@openbsd.org35f22da2016-04-15 00:31:10 +000083 cert-file \
dtucker@openbsd.org0d2f8842016-12-16 03:51:19 +000084 cfginclude \
djm@openbsd.orgc9cdef32017-06-24 06:35:24 +000085 allow-deny-users \
86 authinfo
djm@openbsd.org09205532015-01-13 07:49:49 +000087
88
Damien Miller2476c312014-03-02 04:01:00 +110089# dhgex \
Damien Miller38cd4352002-05-01 13:17:33 +100090
Damien Miller4268a132008-06-30 08:07:56 +100091INTEROP_TESTS= putty-transfer putty-ciphers putty-kex conch-ciphers
Damien Milleraf784932008-03-13 00:17:00 +110092#INTEROP_TESTS+=ssh-com ssh-com-client ssh-com-keygen ssh-com-sftp
93
Darren Tuckereab5f0d2010-11-05 18:23:38 +110094#LTESTS= cipher-speed
95
Damien Miller6bdf70f2017-05-09 14:35:03 +100096USERNAME= ${LOGNAME}
natano@openbsd.org09f99782016-10-06 09:31:38 +000097CLEANFILES= *.core actual agent-key.* authorized_keys_${USERNAME} \
98 authorized_keys_${USERNAME}.* \
99 authorized_principals_${USERNAME} \
djm@openbsd.orgb1d05aa2016-04-15 00:48:01 +0000100 banner.in banner.out cert_host_key* cert_user_key* \
101 copy.1 copy.2 data ed25519-agent ed25519-agent* \
Damien Miller6bdf70f2017-05-09 14:35:03 +1000102 ed25519-agent.pub ed25519 ed25519.pub empty.in \
103 expect failed-regress.log failed-ssh.log failed-sshd.log \
104 hkr.* host.ed25519 host.rsa host.rsa1 host_* \
105 host_ca_key* host_krl_* host_revoked_* key.* \
106 key.dsa-* key.ecdsa-* key.ed25519-512 \
107 key.ed25519-512.pub key.rsa-* keys-command-args kh.* \
108 known_hosts known_hosts-cert known_hosts.* krl-* ls.copy \
109 modpipe netcat no_identity_config \
110 pidfile putty.rsa2 ready regress.log \
111 remote_pid revoked-* rsa rsa-agent rsa-agent.pub rsa.pub \
112 rsa1 rsa1-agent rsa1-agent.pub rsa1.pub rsa_ssh2_cr.prv \
djm@openbsd.orgb1d05aa2016-04-15 00:48:01 +0000113 rsa_ssh2_crnl.prv scp-ssh-wrapper.exe \
114 scp-ssh-wrapper.scp setuid-allowed sftp-server.log \
115 sftp-server.sh sftp.log ssh-log-wrapper.sh ssh.log \
116 ssh_config ssh_config.* ssh_proxy ssh_proxy_bak \
Damien Miller6bdf70f2017-05-09 14:35:03 +1000117 ssh_proxy_envpass sshd.log sshd_config sshd_config_minimal \
118 sshd_config.orig sshd_proxy sshd_proxy.* sshd_proxy_bak \
119 sshd_proxy_orig t10.out t10.out.pub t12.out t12.out.pub \
120 t2.out t3.out t6.out1 t6.out2 t7.out t7.out.pub \
121 t8.out t8.out.pub t9.out t9.out.pub testdata \
122 user_*key* user_ca* user_key*
Damien Miller38cd4352002-05-01 13:17:33 +1000123
natano@openbsd.org09f99782016-10-06 09:31:38 +0000124SUDO_CLEAN+= /var/run/testdata_${USERNAME} /var/run/keycommand_${USERNAME}
Darren Tuckerf3568fc2013-05-17 09:35:26 +1000125
Damien Miller8f9492c2010-02-24 17:28:45 +1100126# Enable all malloc(3) randomisations and checks
tb@openbsd.org7da751d2016-11-01 13:43:27 +0000127TEST_ENV= "MALLOC_OPTIONS=CFGJRSUX"
Damien Miller8f9492c2010-02-24 17:28:45 +1100128
Damien Miller369c0e82011-01-17 10:51:40 +1100129TEST_SSH_SSHKEYGEN?=ssh-keygen
130
Damien Millerb3764e12013-02-19 13:15:01 +1100131CPPFLAGS=-I..
132
Damien Miller38cd4352002-05-01 13:17:33 +1000133t1:
Damien Miller369c0e82011-01-17 10:51:40 +1100134 ${TEST_SSH_SSHKEYGEN} -if ${.CURDIR}/rsa_ssh2.prv | diff - ${.CURDIR}/rsa_openssh.prv
Darren Tuckereab5f0d2010-11-05 18:23:38 +1100135 tr '\n' '\r' <${.CURDIR}/rsa_ssh2.prv > ${.OBJDIR}/rsa_ssh2_cr.prv
Damien Miller369c0e82011-01-17 10:51:40 +1100136 ${TEST_SSH_SSHKEYGEN} -if ${.OBJDIR}/rsa_ssh2_cr.prv | diff - ${.CURDIR}/rsa_openssh.prv
Darren Tuckereab5f0d2010-11-05 18:23:38 +1100137 awk '{print $$0 "\r"}' ${.CURDIR}/rsa_ssh2.prv > ${.OBJDIR}/rsa_ssh2_crnl.prv
Damien Miller369c0e82011-01-17 10:51:40 +1100138 ${TEST_SSH_SSHKEYGEN} -if ${.OBJDIR}/rsa_ssh2_crnl.prv | diff - ${.CURDIR}/rsa_openssh.prv
Damien Miller38cd4352002-05-01 13:17:33 +1000139
140t2:
Tim Rice8b2157d2003-09-09 06:07:10 -0700141 cat ${.CURDIR}/rsa_openssh.prv > $(OBJ)/t2.out
142 chmod 600 $(OBJ)/t2.out
Damien Miller369c0e82011-01-17 10:51:40 +1100143 ${TEST_SSH_SSHKEYGEN} -yf $(OBJ)/t2.out | diff - ${.CURDIR}/rsa_openssh.pub
Damien Miller38cd4352002-05-01 13:17:33 +1000144
145t3:
Damien Miller369c0e82011-01-17 10:51:40 +1100146 ${TEST_SSH_SSHKEYGEN} -ef ${.CURDIR}/rsa_openssh.pub >$(OBJ)/t3.out
147 ${TEST_SSH_SSHKEYGEN} -if $(OBJ)/t3.out | diff - ${.CURDIR}/rsa_openssh.pub
Damien Miller38cd4352002-05-01 13:17:33 +1000148
149t4:
djm@openbsd.org1e304832014-12-22 02:15:52 +0000150 ${TEST_SSH_SSHKEYGEN} -E md5 -lf ${.CURDIR}/rsa_openssh.pub |\
Damien Miller38cd4352002-05-01 13:17:33 +1000151 awk '{print $$2}' | diff - ${.CURDIR}/t4.ok
152
153t5:
Damien Miller369c0e82011-01-17 10:51:40 +1100154 ${TEST_SSH_SSHKEYGEN} -Bf ${.CURDIR}/rsa_openssh.pub |\
Damien Miller38cd4352002-05-01 13:17:33 +1000155 awk '{print $$2}' | diff - ${.CURDIR}/t5.ok
156
157t6:
Damien Miller369c0e82011-01-17 10:51:40 +1100158 ${TEST_SSH_SSHKEYGEN} -if ${.CURDIR}/dsa_ssh2.prv > $(OBJ)/t6.out1
159 ${TEST_SSH_SSHKEYGEN} -if ${.CURDIR}/dsa_ssh2.pub > $(OBJ)/t6.out2
Tim Rice8b2157d2003-09-09 06:07:10 -0700160 chmod 600 $(OBJ)/t6.out1
Damien Miller369c0e82011-01-17 10:51:40 +1100161 ${TEST_SSH_SSHKEYGEN} -yf $(OBJ)/t6.out1 | diff - $(OBJ)/t6.out2
Damien Miller38cd4352002-05-01 13:17:33 +1000162
Tim Rice8b2157d2003-09-09 06:07:10 -0700163$(OBJ)/t7.out:
Damien Miller369c0e82011-01-17 10:51:40 +1100164 ${TEST_SSH_SSHKEYGEN} -q -t rsa -N '' -f $@
Damien Miller38cd4352002-05-01 13:17:33 +1000165
Tim Rice8b2157d2003-09-09 06:07:10 -0700166t7: $(OBJ)/t7.out
Damien Miller369c0e82011-01-17 10:51:40 +1100167 ${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t7.out > /dev/null
168 ${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t7.out > /dev/null
Damien Miller38cd4352002-05-01 13:17:33 +1000169
Tim Rice522262f2010-11-07 13:00:27 -0800170$(OBJ)/t8.out:
Damien Miller369c0e82011-01-17 10:51:40 +1100171 ${TEST_SSH_SSHKEYGEN} -q -t dsa -N '' -f $@
Darren Tuckereab5f0d2010-11-05 18:23:38 +1100172
Tim Rice522262f2010-11-07 13:00:27 -0800173t8: $(OBJ)/t8.out
Damien Miller369c0e82011-01-17 10:51:40 +1100174 ${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t8.out > /dev/null
175 ${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t8.out > /dev/null
Darren Tuckereab5f0d2010-11-05 18:23:38 +1100176
Tim Rice522262f2010-11-07 13:00:27 -0800177$(OBJ)/t9.out:
Darren Tuckereab5f0d2010-11-05 18:23:38 +1100178 test "${TEST_SSH_ECC}" != yes || \
Damien Miller369c0e82011-01-17 10:51:40 +1100179 ${TEST_SSH_SSHKEYGEN} -q -t ecdsa -N '' -f $@
Darren Tuckereab5f0d2010-11-05 18:23:38 +1100180
Tim Rice522262f2010-11-07 13:00:27 -0800181t9: $(OBJ)/t9.out
Darren Tuckereab5f0d2010-11-05 18:23:38 +1100182 test "${TEST_SSH_ECC}" != yes || \
Damien Miller369c0e82011-01-17 10:51:40 +1100183 ${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t9.out > /dev/null
Darren Tuckereab5f0d2010-11-05 18:23:38 +1100184 test "${TEST_SSH_ECC}" != yes || \
Damien Miller369c0e82011-01-17 10:51:40 +1100185 ${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t9.out > /dev/null
Darren Tuckereab5f0d2010-11-05 18:23:38 +1100186
Damien Millerf54542a2013-12-07 16:32:44 +1100187
188$(OBJ)/t10.out:
189 ${TEST_SSH_SSHKEYGEN} -q -t ed25519 -N '' -f $@
190
191t10: $(OBJ)/t10.out
192 ${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t10.out > /dev/null
193 ${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t10.out > /dev/null
194
djm@openbsd.org1e304832014-12-22 02:15:52 +0000195t11:
196 ${TEST_SSH_SSHKEYGEN} -E sha256 -lf ${.CURDIR}/rsa_openssh.pub |\
197 awk '{print $$2}' | diff - ${.CURDIR}/t11.ok
198
Tim Ricea170f222015-06-09 22:41:13 -0700199$(OBJ)/t12.out:
200 ${TEST_SSH_SSHKEYGEN} -q -t ed25519 -N '' -C 'test-comment-1234' -f $@
markus@openbsd.org27ca1a52015-01-12 20:13:27 +0000201
Tim Ricea170f222015-06-09 22:41:13 -0700202t12: $(OBJ)/t12.out
Tim Rice9f82e5a2015-03-16 22:49:20 -0700203 ${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t12.out.pub | grep test-comment-1234 >/dev/null
markus@openbsd.org27ca1a52015-01-12 20:13:27 +0000204
Damien Millerfaabeb62012-12-12 12:51:54 +1100205t-exec: ${LTESTS:=.sh}
Darren Tuckerebc3c132003-09-04 15:37:58 +1000206 @if [ "x$?" = "x" ]; then exit 0; fi; \
207 for TEST in ""$?; do \
208 echo "run test $${TEST}" ... 1>&2; \
Tim Rice5ab9b632013-06-02 14:05:48 -0700209 (env SUDO="${SUDO}" TEST_ENV=${TEST_ENV} ${TEST_SHELL} ${.CURDIR}/test-exec.sh ${.OBJDIR} ${.CURDIR}/$${TEST}) || exit $$?; \
Darren Tuckerebc3c132003-09-04 15:37:58 +1000210 done
Damien Milleraf784932008-03-13 00:17:00 +1100211
212t-exec-interop: ${INTEROP_TESTS:=.sh}
213 @if [ "x$?" = "x" ]; then exit 0; fi; \
214 for TEST in ""$?; do \
215 echo "run test $${TEST}" ... 1>&2; \
Tim Rice5ab9b632013-06-02 14:05:48 -0700216 (env SUDO="${SUDO}" TEST_ENV=${TEST_ENV} ${TEST_SHELL} ${.CURDIR}/test-exec.sh ${.OBJDIR} ${.CURDIR}/$${TEST}) || exit $$?; \
Damien Milleraf784932008-03-13 00:17:00 +1100217 done
218
Darren Tuckereab5f0d2010-11-05 18:23:38 +1100219# Not run by default
220interop: ${INTEROP_TARGETS}
Damien Millere7429f22014-05-15 18:01:01 +1000221
222# Unit tests, built by top-level Makefile
223unit:
Damien Millerdd8b1dd2014-07-02 17:38:31 +1000224 set -e ; if test -z "${SKIP_UNIT}" ; then \
Damien Millerbd588532015-02-25 16:58:22 -0800225 V="" ; \
Damien Millerf7f31162015-02-27 15:52:49 -0800226 test "x${USE_VALGRIND}" = "x" || \
Damien Millerbd588532015-02-25 16:58:22 -0800227 V=${.CURDIR}/valgrind-unit.sh ; \
228 $$V ${.OBJDIR}/unittests/sshbuf/test_sshbuf ; \
229 $$V ${.OBJDIR}/unittests/sshkey/test_sshkey \
Damien Millere89c7802015-02-17 10:04:55 +1100230 -d ${.CURDIR}/unittests/sshkey/testdata ; \
Damien Millerbd588532015-02-25 16:58:22 -0800231 $$V ${.OBJDIR}/unittests/bitmap/test_bitmap ; \
Darren Tuckerb1b22dd2017-03-14 14:19:36 +1100232 $$V ${.OBJDIR}/unittests/conversion/test_conversion ; \
Damien Millerbd588532015-02-25 16:58:22 -0800233 $$V ${.OBJDIR}/unittests/kex/test_kex ; \
234 $$V ${.OBJDIR}/unittests/hostkeys/test_hostkeys \
Damien Millere89c7802015-02-17 10:04:55 +1100235 -d ${.CURDIR}/unittests/hostkeys/testdata ; \
Damien Miller6ee4f1c2016-08-23 16:33:48 +1000236 $$V ${.OBJDIR}/unittests/match/test_match ; \
Darren Tucker47b8c992016-12-08 15:48:34 +1100237 if test "x${TEST_SSH_UTF8}" = "xyes" ; then \
238 $$V ${.OBJDIR}/unittests/utf8/test_utf8 ; \
239 fi \
Damien Millerdd8b1dd2014-07-02 17:38:31 +1000240 fi