Skip to content

Commit 18da1b8

Browse files
committed
Fix some IPv6 proxy issues
As a quick hack this PR enables *basically* the IPv6 proxy which results that testssl.sh will use an IPv6 proxy when * the binary supports that * the binary is used an not tls_sockets() * there's no A record but an AAAA record of the proxy or an IPv6 address as proxy address was specified. The latter should guarantee that it doesn't break anything. However tls_sockets() still uses IPv4 for the connection to the proxy. See #1105
1 parent 5359bef commit 18da1b8

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

testssl.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21962,17 +21962,23 @@ check_proxy() {
2196221962
# strip off http/https part if supplied:
2196321963
PROXY="${PROXY/http\:\/\//}"
2196421964
PROXY="${PROXY/https\:\/\//}" # this shouldn't be needed
21965+
PROXYPORT="${PROXY##*:}"
2196521966
PROXYNODE="${PROXY%:*}"
21966-
PROXYPORT="${PROXY#*:}"
2196721967
is_number "$PROXYPORT" || fatal "Proxy port cannot be determined from \"$PROXY\"" $ERR_CMDLINE
2196821968

21969-
#if is_ipv4addr "$PROXYNODE" || is_ipv6addr "$PROXYNODE" ; then
21970-
# IPv6 via openssl -proxy: that doesn't work. Sockets does
21971-
#FIXME: finish this with LibreSSL which supports an IPv6 proxy
21969+
#FIXME: finish this with IPv6 proxy support, see #1105.
2197221970
if is_ipv4addr "$PROXYNODE"; then
2197321971
PROXYIP="$PROXYNODE"
21972+
elif is_ipv6addr "$PROXYNODE"; then
21973+
# Maybe an option like --proxy6 is better for purists
21974+
PROXYIP="[$PROXYNODE]"
2197421975
else
21976+
# We check now preferred whether there was an IPv4 proxy via DNS specified
21977+
# If it fails it could be an IPv6 only proxy via DNS or we just can't reach the proxy
2197521978
PROXYIP="$(get_a_record "$PROXYNODE" 2>/dev/null | grep -v alias | sed 's/^.*address //')"
21979+
if [[ -z "$PROXYIP" ]]; then
21980+
PROXYIP="$(get_aaaa_record "$PROXYNODE" 2>/dev/null | grep -v alias | sed 's/^.*address //')"
21981+
fi
2197621982
[[ -z "$PROXYIP" ]] && fatal "Proxy IP cannot be determined from \"$PROXYNODE\"" $ERR_CMDLINE
2197721983
fi
2197821984
PROXY="-proxy $PROXYIP:$PROXYPORT"

0 commit comments

Comments
 (0)