xref: /openbsd/regress/usr.bin/ssh/Makefile (revision 5a38ef86)
1#	$OpenBSD: Makefile,v 1.118 2021/10/01 05:20:20 dtucker Exp $
2
3OPENSSL?=	yes
4
5# Unit tests require OpenSSL.
6.if !defined(SKIP_UNIT) && ${OPENSSL:L} == yes
7SUBDIR=		unittests
8.endif
9SUBDIR+=	misc
10
11REGRESS_SETUP_ONCE=misc	# For sk-dummy.so
12
13REGRESS_FAIL_EARLY?=	yes
14
15# Key conversion operations are not supported when built w/out OpenSSL.
16.if ${OPENSSL:L} != no
17REGRESS_TARGETS=	t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12
18.endif
19
20LTESTS= 	connect \
21		proxy-connect \
22		sshfp-connect \
23		connect-privsep \
24		connect-uri \
25		proto-version \
26		proto-mismatch \
27		exit-status \
28		exit-status-signal \
29		envpass \
30		transfer \
31		banner \
32		rekey \
33		dhgex \
34		stderr-data \
35		stderr-after-eof \
36		broken-pipe \
37		try-ciphers \
38		yes-head \
39		login-timeout \
40		agent \
41		agent-getpeereid \
42		agent-timeout \
43		agent-ptrace \
44		agent-subprocess \
45		keyscan \
46		keygen-change \
47		keygen-comment \
48		keygen-convert \
49		keygen-knownhosts \
50		keygen-moduli \
51		keygen-sshfp \
52		key-options \
53		scp \
54		scp3 \
55		scp-uri \
56		sftp \
57		sftp-chroot \
58		sftp-cmds \
59		sftp-badcmds \
60		sftp-batch \
61		sftp-glob \
62		sftp-perm \
63		sftp-uri \
64		reconfigure \
65		dynamic-forward \
66		forwarding \
67		multiplex \
68		reexec \
69		brokenkeys \
70		sshcfgparse \
71		cfgparse \
72		cfgmatch \
73		cfgmatchlisten \
74		percent \
75		addrmatch \
76		localcommand \
77		forcecommand \
78		portnum \
79		keytype \
80		kextype \
81		cert-hostkey \
82		cert-userkey \
83		host-expand \
84		keys-command \
85		forward-control \
86		integrity \
87		krl \
88		multipubkey \
89		limit-keytype \
90		hostkey-agent \
91		hostkey-rotate \
92		principals-command \
93		cert-file \
94		cfginclude \
95		servcfginclude \
96		allow-deny-users \
97		authinfo \
98		sshsig \
99		knownhosts \
100		knownhosts-command
101
102INTEROP_TESTS=	putty-transfer putty-ciphers putty-kex conch-ciphers
103#INTEROP_TESTS+=ssh-com ssh-com-client ssh-com-keygen ssh-com-sftp
104
105EXTRA_TESTS=	agent-pkcs11
106#EXTRA_TESTS+= 	cipher-speed
107
108USERNAME!=	id -un
109CLEANFILES+=	*.core actual agent-key.* authorized_keys_${USERNAME} \
110		authorized_keys_${USERNAME}.* authorized_principals_${USERNAME} \
111		banner.in banner.out cert_host_key* cert_user_key* \
112		copy.1 copy.2 data ed25519-agent ed25519-agent* \
113		ed25519-agent.pub empty.in expect failed-regress.log \
114		failed-ssh.log failed-sshd.log hkr.* host.ecdsa-sha2-nistp256 \
115		host.ecdsa-sha2-nistp384 host.ecdsa-sha2-nistp521 \
116		host.ssh-dss host.ssh-ed25519 host.ssh-rsa \
117		host_* host_ca_key* host_krl_* host_revoked_* key.* \
118		key.dsa-* key.ecdsa-* key.ed25519-512 key.ed25519-512.pub \
119		key.rsa-* keys-command-args kh.* known_hosts askpass \
120		known_hosts-cert known_hosts.* krl-* ls.copy modpipe \
121		netcat pidfile putty.rsa2 ready regress.log remote_pid \
122		revoked-* rsa rsa-agent rsa-agent.pub rsa.pub rsa_ssh2_cr.prv \
123		rsa_ssh2_crnl.prv scp-ssh-wrapper.exe \
124		scp-ssh-wrapper.scp setuid-allowed sftp-server.log \
125		sftp-server.sh sftp.log ssh-log-wrapper.sh ssh.log \
126		ssh-rsa_oldfmt knownhosts_command \
127		ssh_config ssh_config.* ssh_proxy ssh_proxy_bak \
128		ssh_proxy_* sshd.log sshd_config sshd_config.* \
129		sshd_proxy sshd_proxy.* sshd_proxy_bak sshd_proxy_orig \
130		t10.out t10.out.pub t12.out t12.out.pub t2.out t3.out \
131		t6.out1 t6.out2 t7.out t7.out.pub t8.out t8.out.pub \
132		t9.out t9.out.pub testdata user_*key* user_ca* user_key*
133
134# Enable all malloc(3) randomisations and checks
135TEST_ENV=      "MALLOC_OPTIONS=CFGJRSUX"
136
137t1:
138	ssh-keygen -if ${.CURDIR}/rsa_ssh2.prv | diff - ${.CURDIR}/rsa_openssh.prv
139	tr '\n' '\r' <${.CURDIR}/rsa_ssh2.prv > ${.OBJDIR}/rsa_ssh2_cr.prv
140	ssh-keygen -if ${.OBJDIR}/rsa_ssh2_cr.prv | diff - ${.CURDIR}/rsa_openssh.prv
141	awk '{print $$0 "\r"}' ${.CURDIR}/rsa_ssh2.prv > ${.OBJDIR}/rsa_ssh2_crnl.prv
142	ssh-keygen -if ${.OBJDIR}/rsa_ssh2_crnl.prv | diff - ${.CURDIR}/rsa_openssh.prv
143
144t2:
145	cat ${.CURDIR}/rsa_openssh.prv > t2.out
146	chmod 600 t2.out
147	ssh-keygen -yf t2.out | diff - ${.CURDIR}/rsa_openssh.pub
148
149t3:
150	ssh-keygen -ef ${.CURDIR}/rsa_openssh.pub |\
151		ssh-keygen -if /dev/stdin |\
152		diff - ${.CURDIR}/rsa_openssh.pub
153
154t4:
155	ssh-keygen -E md5 -lf ${.CURDIR}/rsa_openssh.pub |\
156		awk '{print $$2}' | diff - ${.CURDIR}/t4.ok
157
158t5:
159	ssh-keygen -Bf ${.CURDIR}/rsa_openssh.pub |\
160		awk '{print $$2}' | diff - ${.CURDIR}/t5.ok
161
162t6:
163	ssh-keygen -if ${.CURDIR}/dsa_ssh2.prv > t6.out1
164	ssh-keygen -if ${.CURDIR}/dsa_ssh2.pub > t6.out2
165	chmod 600 t6.out1
166	ssh-keygen -yf t6.out1 | diff - t6.out2
167
168t7.out:
169	ssh-keygen -q -t rsa -N '' -f $@
170
171t7: t7.out
172	ssh-keygen -lf t7.out > /dev/null
173	ssh-keygen -Bf t7.out > /dev/null
174
175t8.out:
176	ssh-keygen -q -t dsa -N '' -f $@
177
178t8: t8.out
179	ssh-keygen -lf t8.out > /dev/null
180	ssh-keygen -Bf t8.out > /dev/null
181
182t9.out:
183	ssh-keygen -q -t ecdsa -N '' -f $@
184
185t9: t9.out
186	ssh-keygen -lf t9.out > /dev/null
187	ssh-keygen -Bf t9.out > /dev/null
188
189t10.out:
190	ssh-keygen -q -t ed25519 -N '' -f $@
191
192t10: t10.out
193	ssh-keygen -lf t10.out > /dev/null
194	ssh-keygen -Bf t10.out > /dev/null
195
196t11:
197	ssh-keygen -E sha256 -lf ${.CURDIR}/rsa_openssh.pub |\
198		awk '{print $$2}' | diff - ${.CURDIR}/t11.ok
199
200t12.out:
201	ssh-keygen -q -t ed25519 -N '' -C 'test-comment-1234' -f $@
202
203t12: t12.out
204	ssh-keygen -lf t12.out.pub | grep -q test-comment-1234
205
206modpipe: modpipe.c
207
208t-integrity: modpipe
209
210.for t in ${LTESTS} ${INTEROP_TESTS} ${EXTRA_TESTS}
211t-${t}:
212	env SUDO="${SUDO}" ${TEST_ENV} \
213	    sh ${.CURDIR}/test-exec.sh ${.OBJDIR} ${.CURDIR}/${t}.sh
214.endfor
215
216.for t in ${LTESTS}
217REGRESS_TARGETS+=t-${t}
218.endfor
219
220.for t in ${INTEROP_TESTS}
221INTEROP_TARGETS+=t-${t}
222.endfor
223
224# Not run by default
225interop: ${INTEROP_TARGETS}
226
227.for t in ${EXTRA_TESTS}
228EXTRA_TARGETS+=t-${t}
229.endfor
230
231# Not run by default
232extra: ${EXTRA_TARGETS}
233
234.for s in ${SUBDIR}
235CLEAN_SUBDIR+=c-${s}
236c-${s}:
237	${MAKE} -C ${.CURDIR}/${s} clean
238.endfor
239
240clean: ${CLEAN_SUBDIR}
241	rm -f ${CLEANFILES}
242	rm -rf .putty
243
244.include <bsd.regress.mk>
245