-
On laptop (macOS), clone this repo
git clone https://github.com/syncom/mitmproxy-hermit.git cd mitmproxy-hermit/
-
Install
mitmproxy
brew install mitmproxy
The CA certificate for
mitmproxy
has been copied from~/.mitmproxy/mitmproxy-ca-cert.cert
of the local machine to mitmproxy-ca-cert.cer of this repo. If your localmitmproxy
's CA certificate is different, replacemitmproxy-ca-cert.cer
in the cloned repository with yours. -
Build Docker image for testing
docker build --tag ubuntu:mitm .
-
Proxy Docker traffic. In Docker Desktop,
Preferences/Resources/PROXIES
, turn on "Manual proxy configuration", and usehttp://localhost:4242
as the value for "Web Server (HTTP)" and "Secure Web Server (HTTPS)". Restart Docker Desktop. -
On laptop, start
mitmproxy
in passthrough mode.mitmproxy --listen-port 4242
-
Run Docker image
docker run -it ubuntu:mitm
Inside Docker VM shell (run as
root
user)# Install Hermit from canary channel curl -fsSL https://github.com/cashapp/hermit/releases/download/canary/install.sh | /bin/bash # Add to PATH export PATH="/root/bin:$PATH" # Show version hermit version # For my test run, 819b5ff (canary) # Run hermit init, and activate hermit mkdir project cd project hermit init . . bin/activate-hermit # Show version inside environment hermit version # For my test run same as above, 819b5ff (canary)
-
On laptop host, build custom Hermit for
linux-amd64
make GOOS=linux GOARCH=amd64 CHANNEL=canary VERSION=testversion build
Rename
build/hermit-linux-amd64.gz
totest-hermit-linux-amd64.gz
, and put it in the top-level directory in this repository. -
On host, exit from
mitmproxy
console (pressq
and selectyes
), and run themitmdump
to override the downloadedhermit-linux-amd64.gz
with the custom built one.mitmdump -s rewrite_file.py --listen-port 4242 | tee mitmproxy.log
-
In Docker VM shell, test
hermit update
in the already activated environment. This should gettest-hermit-linux-amd64.gz
to replace the Hermit binary.project🐚 hermit update project🐚 hermit version # Should be "testversion (canary)" project🐚 hermit validate env . project🐚 echo $? # Should be 0 project🐚 deactivate-hermit # More testing with the custom Hermit mkdir ../project1 cd ../project1 hermit version # Should be "testversion (canary)" hermit init . . bin/activate-hermit project1🐚 hermit version # Should be "testversion (canary)" project1🐚 hermit validate env . project1🐚 echo $? # Should be 0 # Clear cache and try custom Hermit again project1🐚 deactivate-hermit rm -rf ~/.cache/hermit rm -rf /root/bin/hermit* . bin/activate-hermit project1🐚 hermit version # Should be "testversion (canary)" project1🐚 hermit validate env . project1🐚 echo $? # Should be 0
Remember to revert your proxy configuration in Docker Desktop after testing is done.