Changeset 9827c485 for tests


Ignore:
Timestamp:
Jun 29, 2014 11:27:57 AM (6 years ago)
Author:
kytv <kytv@…>
Branches:
master
Children:
d855c5d, f1a7383
Parents:
367d68e
Message:

checkremotecerts.sh: support for ports

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/scripts/checkremotecerts.sh

    r367d68e r9827c485  
    55BASEDIR="$(dirname $0)/../../"
    66cd "$BASEDIR"
    7 RESEEDHOSTS=$(sed -e '/^\s\+"https:\/\/[-a-z0-9.]/!d' -e 's/.*"https:\/\/\([-a-z0-9.]\+\).*/\1/' router/java/src/net/i2p/router/networkdb/reseed/Reseeder.java)
     7RESEEDHOSTS=$(sed -e '/^\s\+"https:\/\/[-a-z0-9.]/!d' -e 's/.*"https:\/\/\([-a-z0-9.:]\+\).*/\1/' router/java/src/net/i2p/router/networkdb/reseed/Reseeder.java)
    88CERTHOME="installer/resources/certificates"
    99CACERTS=$(mktemp)
     
    8282connect() {
    8383    if [ $OPENSSL -eq 1 ]; then
    84         $OPENSSL_BIN s_client -connect "$1:443" -CAfile $CACERTS -servername $1 < /dev/null 2> /dev/null
     84        $OPENSSL_BIN s_client -connect "$1:$2" -CAfile $CACERTS -servername $1 < /dev/null 2> /dev/null
    8585    else
    86         $GNUTLS_BIN --insecure --print-cert --x509cafile "$CACERTS" "$1" < /dev/null 2>/dev/null
     86        $GNUTLS_BIN --insecure --print-cert --x509cafile "$CACERTS" "$1" -p "$2" < /dev/null 2>/dev/null
    8787    fi
    8888}
     
    120120check_hosts() {
    121121    for HOST in $RESEEDHOSTS; do
    122         echo -n "Checking $HOST..."
    123         if retry connect "$HOST"  < /dev/null 1> "$WORK/$HOST"; then
     122        if $(echo $HOST | grep -q ':'); then
     123            OLDIFS=$IFS
     124            IFS=":"
     125            set -- $HOST
     126            HOSTNAME=$1
     127            PORT=$2
     128            IFS=$OLDIFS
     129        else
     130            HOSTNAME=$HOST
     131            PORT=443
     132        fi
     133
     134        echo -n "Checking $HOSTNAME:$PORT..."
     135        if retry connect "$HOSTNAME" "$PORT"  < /dev/null 1> "$WORK/$HOST"; then
    124136
    125137            # OpenSSL returns "return code: 0 (ok)"
Note: See TracChangeset for help on using the changeset viewer.