xref: /freebsd/crypto/openssh/regress/connect-privsep.sh (revision 193d9e768ba63fcfb187cfd17f461f7d41345048)
1#	$OpenBSD: connect-privsep.sh,v 1.6 2015/03/03 22:35:19 markus Exp $
2#	Placed in the Public Domain.
3
4tid="proxy connect with privsep"
5
6cp $OBJ/sshd_proxy $OBJ/sshd_proxy.orig
7echo 'UsePrivilegeSeparation yes' >> $OBJ/sshd_proxy
8
9for p in ${SSH_PROTOCOLS}; do
10	${SSH} -$p -F $OBJ/ssh_proxy 999.999.999.999 true
11	if [ $? -ne 0 ]; then
12		fail "ssh privsep+proxyconnect protocol $p failed"
13	fi
14done
15
16cp $OBJ/sshd_proxy.orig $OBJ/sshd_proxy
17echo 'UsePrivilegeSeparation sandbox' >> $OBJ/sshd_proxy
18
19for p in ${SSH_PROTOCOLS}; do
20	${SSH} -$p -F $OBJ/ssh_proxy 999.999.999.999 true
21	if [ $? -ne 0 ]; then
22		# XXX replace this with fail once sandbox has stabilised
23		warn "ssh privsep/sandbox+proxyconnect protocol $p failed"
24	fi
25done
26
27# Because sandbox is sensitive to changes in libc, especially malloc, retest
28# with every malloc.conf option (and none).
29if [ -z "TEST_MALLOC_OPTIONS" ]; then
30	mopts="A F G H J P R S X < >"
31else
32	mopts=`echo $TEST_MALLOC_OPTIONS | sed 's/./& /g'`
33fi
34for m in '' $mopts ; do
35    for p in ${SSH_PROTOCOLS}; do
36	env MALLOC_OPTIONS="$m" ${SSH} -$p -F $OBJ/ssh_proxy 999.999.999.999 true
37	if [ $? -ne 0 ]; then
38		fail "ssh privsep/sandbox+proxyconnect protocol $p mopt '$m' failed"
39	fi
40    done
41done
42