Skip to content

Instantly share code, notes, and snippets.

@SomajitDey
Last active December 1, 2021 19:11
Show Gist options
  • Select an option

  • Save SomajitDey/f2c5b2f6de3e5b3ed3092644a534ec08 to your computer and use it in GitHub Desktop.

Select an option

Save SomajitDey/f2c5b2f6de3e5b3ed3092644a534ec08 to your computer and use it in GitHub Desktop.
SSL/TLS passthrough reverse proxy/load-balancer: read SNI in Client-Hello and redirect
#!/usr/bin/env bash
# Get localtest.me for curl https://localtest.me
sudo nc -lk 443 | grep -Uzo --line-buffered '[0-9a-z\-\.]*test.me'
# To read length of client hello handshake - the first 4th and 5th byte - record layer
nc -l 8000 | (head -c3 >/dev/null; head -c2 | xxd -p) # for curl https://localtest.me:8000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment