github.com/containers/libpod@v1.9.4-0.20220419124438-4284fd425507/contrib/cirrus/networking.sh (about)

     1  #!/bin/bash
     2  
     3  # This script attempts basic confirmation of functional networking
     4  # by connecting to a set of essential external servers and failing
     5  # if any cannot be reached.
     6  
     7  source $(dirname $0)/lib.sh
     8  
     9  while read host port
    10  do
    11      if [[ "$port" -eq "443" ]]
    12      then
    13          item_test "SSL/TLS to $host:$port" "$(echo -n '' | openssl s_client -quiet -no_ign_eof -connect $host:$port &> /dev/null; echo $?)" -eq "0"
    14      else
    15          item_test "Connect to $host:$port" "$(nc -zv -w 13 $host $port &> /dev/null; echo $?)" -eq 0
    16      fi
    17  done < ${CIRRUS_WORKING_DIR}/${SCRIPT_BASE}/required_host_ports.txt