pip3 install mitmproxy
# launch on a different port, with web UI, I want to access it from the outside world
mitmweb --mode regular@8082 --web-host 0.0.0.0
# configure the AWS cli to use the proxy
export HTTPS_PROXY=http://localhost:8082
export AWS_CA_BUNDLE=~/.mitmproxy/mitmproxy-ca-cert.cer
aws s3 ls
# configuring other things to trust the MITM cert
pip3 config set global.cert /home/ec2-user/.mitmproxy/mitmproxy-ca-cert.cer
npm config set cafile /home/ec2-user/.mitmproxy/mitmproxy-ca-cert.cer
# curl wget
export CURL_CA_BUNDLE=/home/ec2-user/.mitmproxy/mitmproxy-ca-cert.cer
export https_proxy=$HTTPS_PROXY
echo "ca_certificate=/home/ec2-user/.mitmproxy/mitmproxy-ca-cert.cer" > ~/.wgetrc
# yum
printf "[main]\nproxy=$HTTPS_PROXY\nsslverify=false\n" | sudo tee /etc/dnf/dnf.conf
# docker
printf "[Service]\nEnvironment=\"HTTPS_PROXY==$HTTPS_PROXY\"\n" | sudo tee /etc/systemd/system/docker.service.d/override.conf
cat /home/ec2-user/.mitmproxy/mitmproxy-ca-cert.cer | sudo tee -a /etc/pki/tls/certs/ca-bundle.crt
Last active
April 1, 2025 04:59
-
-
Save russau/6931f7a9287fed6f741dc3abb1570d1c to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment