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