Damien Miller | 8b9cde7 | 2003-01-22 17:53:16 +1100 | [diff] [blame] | 1 | # $OpenBSD: ssh-com.sh,v 1.4 2002/07/16 08:58:16 markus Exp $ |
Damien Miller | 38cd435 | 2002-05-01 13:17:33 +1000 | [diff] [blame] | 2 | # Placed in the Public Domain. |
| 3 | |
| 4 | tid="connect to ssh.com server" |
| 5 | |
| 6 | #TEST_COMBASE=/path/to/ssh/com/binaries |
| 7 | if [ "X${TEST_COMBASE}" = "X" ]; then |
| 8 | fatal '$TEST_COMBASE is not set' |
| 9 | fi |
| 10 | |
| 11 | VERSIONS=" |
| 12 | 2.0.12 |
| 13 | 2.0.13 |
| 14 | 2.1.0 |
| 15 | 2.2.0 |
| 16 | 2.3.0 |
Damien Miller | 38cd435 | 2002-05-01 13:17:33 +1000 | [diff] [blame] | 17 | 2.4.0 |
| 18 | 3.0.0 |
Damien Miller | 8b9cde7 | 2003-01-22 17:53:16 +1100 | [diff] [blame] | 19 | 3.1.0 |
| 20 | 3.2.0 |
| 21 | 3.3.0" |
Damien Miller | 38cd435 | 2002-05-01 13:17:33 +1000 | [diff] [blame] | 22 | # 2.0.10 does not support UserConfigDirectory |
Damien Miller | 8b9cde7 | 2003-01-22 17:53:16 +1100 | [diff] [blame] | 23 | # 2.3.1 requires a config in $HOME/.ssh2 |
Damien Miller | 38cd435 | 2002-05-01 13:17:33 +1000 | [diff] [blame] | 24 | |
| 25 | SRC=`dirname ${SCRIPT}` |
| 26 | |
| 27 | # ssh.com |
| 28 | cat << EOF > $OBJ/sshd2_config |
Damien Miller | 8b9cde7 | 2003-01-22 17:53:16 +1100 | [diff] [blame] | 29 | #*: |
Damien Miller | 38cd435 | 2002-05-01 13:17:33 +1000 | [diff] [blame] | 30 | # Port and ListenAdress are not used. |
| 31 | QuietMode yes |
| 32 | Port 4343 |
| 33 | ListenAddress 127.0.0.1 |
| 34 | UserConfigDirectory ${OBJ}/%U |
| 35 | Ciphers AnyCipher |
| 36 | PubKeyAuthentication yes |
| 37 | #AllowedAuthentications publickey |
| 38 | AuthorizationFile authorization |
| 39 | HostKeyFile ${SRC}/dsa_ssh2.prv |
| 40 | PublicHostKeyFile ${SRC}/dsa_ssh2.pub |
| 41 | RandomSeedFile ${OBJ}/random_seed |
| 42 | MaxConnections 0 |
| 43 | PermitRootLogin yes |
| 44 | VerboseMode no |
| 45 | CheckMail no |
| 46 | Ssh1Compatibility no |
| 47 | EOF |
| 48 | |
| 49 | # create client config |
| 50 | sed "s/HostKeyAlias.*/HostKeyAlias ssh2-localhost-with-alias/" \ |
| 51 | < $OBJ/ssh_config > $OBJ/ssh_config_com |
| 52 | |
| 53 | # we need a DSA key for |
| 54 | rm -f ${OBJ}/dsa ${OBJ}/dsa.pub |
| 55 | ${SSHKEYGEN} -q -N '' -t dsa -f ${OBJ}/dsa |
| 56 | |
| 57 | # setup userdir, try rsa first |
| 58 | mkdir -p ${OBJ}/${USER} |
| 59 | cp /dev/null ${OBJ}/${USER}/authorization |
| 60 | for t in rsa dsa; do |
| 61 | ${SSHKEYGEN} -e -f ${OBJ}/$t.pub > ${OBJ}/${USER}/$t.com |
| 62 | echo Key $t.com >> ${OBJ}/${USER}/authorization |
| 63 | echo IdentityFile ${OBJ}/$t >> ${OBJ}/ssh_config_com |
| 64 | done |
| 65 | |
| 66 | # convert and append DSA hostkey |
| 67 | ( |
| 68 | echo -n 'ssh2-localhost-with-alias,127.0.0.1,::1 ' |
| 69 | ${SSHKEYGEN} -if ${SRC}/dsa_ssh2.pub |
| 70 | ) >> $OBJ/known_hosts |
| 71 | |
| 72 | # go for it |
| 73 | for v in ${VERSIONS}; do |
| 74 | sshd2=${TEST_COMBASE}/${v}/sshd2 |
| 75 | if [ ! -x ${sshd2} ]; then |
| 76 | continue |
| 77 | fi |
| 78 | trace "sshd2 ${v}" |
| 79 | PROXY="proxycommand ${sshd2} -qif ${OBJ}/sshd2_config 2> /dev/null" |
| 80 | ${SSH} -qF ${OBJ}/ssh_config_com -o "${PROXY}" dummy exit 0 |
| 81 | if [ $? -ne 0 ]; then |
| 82 | fail "ssh connect to sshd2 ${v} failed" |
| 83 | fi |
| 84 | |
| 85 | ciphers="3des-cbc blowfish-cbc arcfour" |
| 86 | macs="hmac-md5" |
| 87 | case $v in |
| 88 | 2.4.*) |
| 89 | ciphers="$ciphers cast128-cbc" |
| 90 | macs="$macs hmac-sha1 hmac-sha1-96 hmac-md5-96" |
| 91 | ;; |
| 92 | 3.*) |
| 93 | ciphers="$ciphers aes128-cbc cast128-cbc" |
| 94 | macs="$macs hmac-sha1 hmac-sha1-96 hmac-md5-96" |
| 95 | ;; |
| 96 | esac |
| 97 | #ciphers="3des-cbc" |
| 98 | for m in $macs; do |
| 99 | for c in $ciphers; do |
| 100 | trace "sshd2 ${v} cipher $c mac $m" |
| 101 | verbose "test ${tid}: sshd2 ${v} cipher $c mac $m" |
| 102 | ${SSH} -c $c -m $m -qF ${OBJ}/ssh_config_com -o "${PROXY}" dummy exit 0 |
| 103 | if [ $? -ne 0 ]; then |
| 104 | fail "ssh connect to sshd2 ${v} with $c/$m failed" |
| 105 | fi |
| 106 | done |
| 107 | done |
| 108 | done |
| 109 | |
| 110 | rm -rf ${OBJ}/${USER} |
| 111 | for i in sshd_config_proxy ssh_config_proxy random_seed \ |
| 112 | sshd2_config dsa.pub dsa ssh_config_com; do |
| 113 | rm -f ${OBJ}/$i |
| 114 | done |