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