{"id":19443011,"url":"https://github.com/syncom/mitmproxy-hermit","last_synced_at":"2025-07-04T14:34:40.545Z","repository":{"id":37835813,"uuid":"503929338","full_name":"syncom/mitmproxy-hermit","owner":"syncom","description":"A Hermit test setup with `mitmproxy`","archived":false,"fork":false,"pushed_at":"2022-06-15T22:27:34.000Z","size":71,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-07T22:13:17.853Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/syncom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-15T21:37:16.000Z","updated_at":"2022-06-15T21:50:01.000Z","dependencies_parsed_at":"2022-08-19T06:01:01.500Z","dependency_job_id":null,"html_url":"https://github.com/syncom/mitmproxy-hermit","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syncom%2Fmitmproxy-hermit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syncom%2Fmitmproxy-hermit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syncom%2Fmitmproxy-hermit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syncom%2Fmitmproxy-hermit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/syncom","download_url":"https://codeload.github.com/syncom/mitmproxy-hermit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240627082,"owners_count":19831592,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T15:41:43.785Z","updated_at":"2025-02-25T07:45:39.898Z","avatar_url":"https://github.com/syncom.png","language":"Python","readme":"# How to set up `mitmproxy` to test Hermit update\n\n1. On laptop (macOS), clone this repo\n\n   ```bash\n   git clone https://github.com/syncom/mitmproxy-hermit.git\n   cd mitmproxy-hermit/\n   ```\n\n2. Install `mitmproxy`\n\n   ```bash\n   brew install mitmproxy\n   ```\n\n   The CA certificate for `mitmproxy` has been copied from\n   `~/.mitmproxy/mitmproxy-ca-cert.cert` of the local machine to\n   [mitmproxy-ca-cert.cer](./mitmproxy-ca-cert.cer) of this repo. If\n   your local `mitmproxy`'s CA certificate is different, replace\n   `mitmproxy-ca-cert.cer` in the cloned repository with yours.\n\n3. Build Docker image for testing\n\n   ```bash\n   docker build --tag ubuntu:mitm .\n   ```\n\n4. Proxy Docker traffic. In Docker Desktop,\n`Preferences/Resources/PROXIES`, turn on \"Manual proxy configuration\",\nand use `http://localhost:4242` as the value for \"Web Server (HTTP)\" and\n\"Secure Web Server (HTTPS)\". Restart Docker Desktop.\n\n   ![Docker Desktop Proxy Configuration](./docker-proxy.png \"Configure Docker Desktop Proxy\")\n\n5. On laptop, start `mitmproxy` in passthrough mode.\n\n   ```bash\n   mitmproxy --listen-port 4242\n   ```\n\n6. Run Docker image\n\n   ```bash\n   docker run -it ubuntu:mitm\n   ```\n\n   Inside Docker VM shell (run as `root` user)\n\n   ```bash\n   # Install Hermit from canary channel\n   curl -fsSL https://github.com/cashapp/hermit/releases/download/canary/install.sh | /bin/bash\n   # Add to PATH\n   export PATH=\"/root/bin:$PATH\"\n   # Show version\n   hermit version # For my test run, 819b5ff (canary)\n   # Run hermit init, and activate hermit\n   mkdir project\n   cd project\n   hermit init .\n   . bin/activate-hermit\n   # Show version inside environment\n   hermit version # For my test run same as above, 819b5ff (canary)\n   ```\n\n7. On laptop host, build custom Hermit for `linux-amd64`\n\n   ```bash\n   make GOOS=linux GOARCH=amd64 CHANNEL=canary VERSION=testversion build\n   ```\n\n   Rename `build/hermit-linux-amd64.gz` to `test-hermit-linux-amd64.gz`,\n   and put it in the top-level directory in this repository.\n\n8. On host, exit from `mitmproxy` console (press `q` and select\n`yes`), and run the `mitmdump` to override the downloaded\n`hermit-linux-amd64.gz` with the custom built one.\n\n   ```bash\n   mitmdump -s rewrite_file.py --listen-port 4242 | tee mitmproxy.log\n   ```\n\n9. In Docker VM shell, test `hermit update` in the already activated\nenvironment. This should get `test-hermit-linux-amd64.gz` to replace the\nHermit binary.\n\n   ```bash\n   project🐚  hermit update\n   project🐚  hermit version # Should be \"testversion (canary)\"\n   project🐚  hermit validate env .\n   project🐚  echo $? # Should be 0\n   project🐚  deactivate-hermit\n   # More testing with the custom Hermit\n   mkdir ../project1\n   cd ../project1\n   hermit version # Should be \"testversion (canary)\"\n   hermit init .\n   . bin/activate-hermit\n   project1🐚  hermit version # Should be \"testversion (canary)\"\n   project1🐚  hermit validate env .\n   project1🐚  echo $? # Should be 0\n   # Clear cache and try custom Hermit again\n   project1🐚  deactivate-hermit\n   rm -rf ~/.cache/hermit\n   rm -rf /root/bin/hermit*\n   . bin/activate-hermit\n   project1🐚  hermit version # Should be \"testversion (canary)\"\n   project1🐚  hermit validate env .\n   project1🐚  echo $? # Should be 0\n   ```\n\nRemember to revert your proxy configuration in Docker Desktop after\ntesting is done.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyncom%2Fmitmproxy-hermit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsyncom%2Fmitmproxy-hermit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyncom%2Fmitmproxy-hermit/lists"}