ClickHouse/tests/queries/0_stateless/00638_remote_ssrf.sh.disabled

32 lines
942 B
Plaintext
Raw Normal View History

#!/usr/bin/env bash
2021-09-12 12:35:27 +00:00
# Tags: disabled
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. $CURDIR/../shell_config.sh
user=readonly
address=${CLICKHOUSE_HOST}
port=${CLICKHOUSE_PORT_HTTP}
url="${CLICKHOUSE_PORT_HTTP_PROTO}://$address:$port/"
# Port is arbitary
2018-06-18 21:13:11 +00:00
# nc does not support -w option with -l and will wait forever for first packet
nc -l -p 61845 -q 0 > /dev/null &
${CLICKHOUSE_CURL} -sS $url --data-binary "SELECT * FROM remote('localhost:61845', system.one, 'user', 'password')" > /dev/null 2>&1
2018-06-18 21:13:11 +00:00
# Send packet to close listening nc (if clickhouse fails to send).
( echo -e "Finish him\n" | nc localhost 61845 ) 2>/dev/null || true
wait
nc -l -p 61846 -q 0 > /dev/null &
${CLICKHOUSE_CURL} -sS $url --data-binary "SELECT * FROM remote('localhost:61846', system.one, 'user', 'passw
ord')" 2>&1 | grep -o 'must not contain ASCII control characters'
2018-06-18 21:13:11 +00:00
( echo -e "Finish him\n" | nc localhost 61846 ) 2>/dev/null || true
wait