~ubuntu-branches/ubuntu/lucid/openssh/lucid

« back to all changes in this revision

Viewing changes to regress/cfgmatch.sh

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2008-09-30 23:09:58 UTC
  • mfrom: (1.13.3 upstream) (29 hardy)
  • mto: This revision was merged to the branch mainline in revision 43.
  • Revision ID: james.westby@ubuntu.com-20080930230958-o6vsgn8c4mm959s0
Tags: 1:5.1p1-3
* Remove unnecessary ssh-vulnkey output in non-verbose mode when no
  compromised or unknown keys were found (closes: #496495).
* Configure with --disable-strip; dh_strip will deal with stripping
  binaries and will honour DEB_BUILD_OPTIONS (thanks, Bernhard R. Link;
  closes: #498681).
* Fix handling of zero-length server banners (thanks, Tomas Mraz; closes:
  #497026).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#       $OpenBSD: cfgmatch.sh,v 1.2 2006/07/22 01:50:00 dtucker Exp $
 
1
#       $OpenBSD: cfgmatch.sh,v 1.4 2006/12/13 08:36:36 dtucker Exp $
2
2
#       Placed in the Public Domain.
3
3
 
4
4
tid="sshd_config match"
35
35
        rm -f $pidfile
36
36
        trace "match permitopen localhost proto $p"
37
37
        ${SSH} -$p $fwd -F $OBJ/ssh_config -f somehost \
38
 
            "echo \$\$ > $pidfile; exec sleep 100" >>$TEST_SSH_LOGFILE 2>&1 ||\
 
38
            exec sh -c \'"echo \$\$ > $pidfile; exec sleep 100"\' >>$TEST_SSH_LOGFILE 2>&1 ||\
39
39
            fail "match permitopen proto $p sshd failed"
40
40
        sleep 1;
41
41
        ${SSH} -q -$p -p $fwdport -F $OBJ/ssh_config somehost true || \
48
48
        rm -f $pidfile
49
49
        trace "match permitopen proxy proto $p"
50
50
        ${SSH} -q -$p $fwd -F $OBJ/ssh_proxy -f somehost \
51
 
            "echo \$\$ > $pidfile; exec sleep 100" >>$TEST_SSH_LOGFILE 2>&1 ||\
 
51
            exec sh -c \'"echo \$\$ > $pidfile; exec sleep 100"\' >>$TEST_SSH_LOGFILE 2>&1 ||\
52
52
            fail "match permitopen proxy proto $p sshd failed"
53
53
        sleep 1;
54
54
        ${SSH} -q -$p -p $fwdport -F $OBJ/ssh_config somehost true && \
65
65
        rm -f $pidfile
66
66
        trace "match permitopen proxy w/key opts proto $p"
67
67
        ${SSH} -q -$p $fwd -F $OBJ/ssh_proxy -f somehost \
68
 
            "echo \$\$ > $pidfile; exec sleep 100" >>$TEST_SSH_LOGFILE 2>&1 ||\
 
68
            exec sh -c \'"echo \$\$ > $pidfile; exec sleep 100"\' >>$TEST_SSH_LOGFILE 2>&1 ||\
69
69
            fail "match permitopen w/key opt proto $p sshd failed"
70
70
        sleep 1;
71
71
        ${SSH} -q -$p -p $fwdport -F $OBJ/ssh_config somehost true && \
79
79
        rm -f $pidfile
80
80
        trace "match permitopen localhost proto $p"
81
81
        ${SSH} -$p $fwd -F $OBJ/ssh_config -f somehost \
82
 
            "echo \$\$ > $pidfile; exec sleep 100" >>$TEST_SSH_LOGFILE 2>&1 ||\
 
82
            exec sh -c \'"echo \$\$ > $pidfile; exec sleep 100"\' >>$TEST_SSH_LOGFILE 2>&1 ||\
83
83
            fail "match permitopen proto $p sshd failed"
84
84
        sleep 1;
85
85
        ${SSH} -q -$p -p $fwdport -F $OBJ/ssh_config somehost true || \
97
97
        rm -f $pidfile
98
98
        trace "match permitopen proxy w/key opts proto $p"
99
99
        ${SSH} -q -$p $fwd -F $OBJ/ssh_proxy -f somehost \
100
 
            "echo \$\$ > $pidfile; exec sleep 100" >>$TEST_SSH_LOGFILE 2>&1 ||\
 
100
            exec sh -c \'"echo \$\$ > $pidfile; exec sleep 100"\' >>$TEST_SSH_LOGFILE 2>&1 ||\
101
101
            fail "match override permitopen proto $p sshd failed"
102
102
        sleep 1;
103
103
        ${SSH} -q -$p -p $fwdport -F $OBJ/ssh_config somehost true && \
104
104
            fail "match override permitopen proto $p"
105
105
        stop_client
106
106
done
 
107
 
 
108
cp $OBJ/sshd_proxy_bak $OBJ/sshd_proxy
 
109
echo "PermitOpen 127.0.0.1:1 127.0.0.1:$PORT 127.0.0.2:2" >>$OBJ/sshd_proxy
 
110
echo "Match User NoSuchUser" >>$OBJ/sshd_proxy
 
111
echo "PermitOpen 127.0.0.1:1 127.0.0.1:2" >>$OBJ/sshd_proxy
 
112
 
 
113
# Test that a rule that doesn't match doesn't override, plus test a
 
114
# PermitOpen entry that's not at the start of the list
 
115
for p in 1 2; do
 
116
        rm -f $pidfile
 
117
        trace "nomatch permitopen proxy w/key opts proto $p"
 
118
        ${SSH} -q -$p $fwd -F $OBJ/ssh_proxy -f somehost \
 
119
            exec sh -c \'"echo \$\$ > $pidfile; exec sleep 100"\' >>$TEST_SSH_LOGFILE 2>&1 ||\
 
120
            fail "nomatch override permitopen proto $p sshd failed"
 
121
        sleep 1;
 
122
        ${SSH} -q -$p -p $fwdport -F $OBJ/ssh_config somehost true || \
 
123
            fail "nomatch override permitopen proto $p"
 
124
        stop_client
 
125
done