Skip to content

Instantly share code, notes, and snippets.

@jawj
Last active March 29, 2023 05:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jawj/b3f2ddb3c3c32db3c3715aa8aaacead9 to your computer and use it in GitHub Desktop.
Save jawj/b3f2ddb3c3c32db3c3715aa8aaacead9 to your computer and use it in GitHub Desktop.
Debug serverless driver in Chrome + Wireshark from any AWS region
# using AWS Lightsail, Ubuntu 20.04
# in dashboard, allow TCP on port 5901
sudo apt update && sudo apt upgrade -y && sudo apt install -y \
tigervnc-standalone-server tigervnc-xorg-extension \
xfce4 wireshark node # pick any window mgr, say yes to non-root packet capture
# set up VNC
vncserver # choose password
vncserver -kill :1
echo '#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
/usr/bin/startxfce4
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
x-window-manager &
' > ~/.vnc/xstartup
chmod +x ~/.vnc/xstartup
vncserver -localhost no -geometry 1600x800 -depth 16 :1
# connect using e.g. Apple Screen Sharing to <IP>:5901
# set up Chrome
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
&& sudo apt install -y ./google-chrome-stable_current_amd64.deb \
&& rm google-chrome-stable_current_amd64.deb
# set up Wireshark + TLS
sudo usermod -aG wireshark ubuntu
sudo reboot # wireshark won't find interfaces until you do
SSLKEYLOGFILE=~/sslkeylog google-chrome &
# Wireshark: eth0, capture filter 'port 443'
# Edit > Preferences > Protocols > TLS > (Pre)-Master-Secret log filename
# set up node + serverless driver
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - && sudo apt-get install -y nodejs
git clone https://github.com/neondatabase/serverless.git
cd serverless
nano .dev.vars # paste in NEON_DB_URL and MY_DB_URL
npm install
npm run start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment