{"id":47978928,"url":"https://github.com/rios0rios0/termux-etc-redirect","last_synced_at":"2026-04-04T10:59:58.292Z","repository":{"id":346020209,"uuid":"1188209611","full_name":"rios0rios0/termux-etc-redirect","owner":"rios0rios0","description":"Transparent `/etc/` path redirection for Termux — enables Go CLIs (`gh`, `terraform`, `kubectl`) to resolve DNS and verify TLS certificates without `proot`, using `LD_PRELOAD` and `seccomp` `user_notif`","archived":false,"fork":false,"pushed_at":"2026-03-31T18:39:33.000Z","size":54,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-04T10:59:55.147Z","etag":null,"topics":["android","dns-resolution","ld-preload","seccomp","termux"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rios0rios0.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"rios0rios0"}},"created_at":"2026-03-21T19:05:22.000Z","updated_at":"2026-03-31T18:39:32.000Z","dependencies_parsed_at":"2026-03-22T10:00:07.108Z","dependency_job_id":null,"html_url":"https://github.com/rios0rios0/termux-etc-redirect","commit_stats":null,"previous_names":["rios0rios0/termux-etc-redirect"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rios0rios0/termux-etc-redirect","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rios0rios0%2Ftermux-etc-redirect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rios0rios0%2Ftermux-etc-redirect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rios0rios0%2Ftermux-etc-redirect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rios0rios0%2Ftermux-etc-redirect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rios0rios0","download_url":"https://codeload.github.com/rios0rios0/termux-etc-redirect/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rios0rios0%2Ftermux-etc-redirect/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31397056,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T10:20:44.708Z","status":"ssl_error","status_checked_at":"2026-04-04T10:20:06.846Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["android","dns-resolution","ld-preload","seccomp","termux"],"created_at":"2026-04-04T10:59:54.380Z","updated_at":"2026-04-04T10:59:58.282Z","avatar_url":"https://github.com/rios0rios0.png","language":"C","funding_links":["https://github.com/sponsors/rios0rios0"],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003etermux-etc-redirect\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/rios0rios0/termux-etc-redirect/releases/latest\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/release/rios0rios0/termux-etc-redirect.svg?style=for-the-badge\u0026logo=github\" alt=\"Latest Release\"/\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/rios0rios0/termux-etc-redirect/blob/main/LICENSE\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/license/rios0rios0/termux-etc-redirect.svg?style=for-the-badge\u0026logo=github\" alt=\"License\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nTransparent `/etc/` path redirection for Termux, enabling Go-based CLIs (GitHub CLI, Terraform, Terragrunt, 1Password CLI, kubectl) to resolve DNS and verify TLS certificates without proot.\n\n## Problem\n\nOn Android/Termux, standard Linux paths like `/etc/resolv.conf`, `/etc/hosts`, and `/etc/ssl/certs/` either don't exist or contain incomplete data. Termux maintains proper versions under `$PREFIX/etc/`, but statically linked Go binaries hardcode the standard `/etc/` paths.\n\nThis project provides two complementary solutions:\n\n| Tier | Mechanism | Targets | Overhead |\n|------|-----------|---------|----------|\n| **Tier 1** | `LD_PRELOAD` shared library | Dynamically linked binaries (Python, Node.js, Termux packages) | Near-zero |\n| **Tier 2** | `seccomp user_notif` interceptor | **All** binaries, including statically linked Go programs | Minimal (kernel BPF filtering) |\n\n## Features\n\n- **DNS resolution**: redirects `/etc/resolv.conf`, `/etc/hosts`, `/etc/nsswitch.conf`\n- **TLS certificates**: redirects Go's hardcoded CA certificate paths to `$PREFIX/etc/tls/cert.pem`\n- **Zero configuration**: auto-detects `$PREFIX` from environment\n- **Fail-open**: if the Termux file doesn't exist, the original path is used\n- **No root required**: uses unprivileged seccomp and LD_PRELOAD\n\n## Installation\n\n```bash\ngit clone https://github.com/rios0rios0/termux-etc-redirect.git\ncd termux-etc-redirect\n./scripts/install.sh\n```\n\nOr manually:\n\n```bash\nmake\nmake install\n```\n\n## Usage\n\n### Tier 2: seccomp interceptor (for static Go binaries)\n\n```bash\ntermux-etc-seccomp terraform init\ntermux-etc-seccomp gh auth status\ntermux-etc-seccomp terragrunt plan\ntermux-etc-seccomp kubectl get pods\n```\n\n### Tier 1: LD_PRELOAD library (for dynamic binaries)\n\nAdd to your shell profile (`~/.zshrc` or `~/.bashrc`):\n\n```bash\nexport LD_PRELOAD=\"$PREFIX/lib/libtermux-etc-redirect.so${LD_PRELOAD:+:$LD_PRELOAD}\"\n```\n\nThis transparently redirects `/etc/` paths for all dynamically linked programs.\n\n## How It Works\n\n### Tier 1: LD_PRELOAD\n\nIntercepts libc functions (`open`, `openat`, `fopen`, `access`, `stat`, `lstat`, `faccessat`) and rewrites paths before they reach the kernel.\n\n### Tier 2: seccomp user_notif\n\n1. Installs a BPF filter targeting `openat` syscalls with `SECCOMP_RET_USER_NOTIF`\n2. Non-matching syscalls (99.9%+) pass through the kernel at full speed with zero overhead\n3. For matching `openat` calls, the supervisor reads the path from the child's memory\n4. If the path matches the redirect table, the supervisor opens the Termux file and injects the fd into the child via `SECCOMP_IOCTL_NOTIF_ADDFD`\n\nThis is fundamentally more efficient than proot (ptrace), which intercepts **every** syscall.\n\n## Redirected Paths\n\n| Source Path | Destination |\n|-------------|-------------|\n| `/etc/resolv.conf` | `$PREFIX/etc/resolv.conf` |\n| `/etc/hosts` | `$PREFIX/etc/hosts` |\n| `/etc/nsswitch.conf` | `$PREFIX/etc/nsswitch.conf` |\n| `/etc/ssl/certs/ca-certificates.crt` | `$PREFIX/etc/tls/cert.pem` |\n| `/etc/pki/tls/certs/ca-bundle.crt` | `$PREFIX/etc/tls/cert.pem` |\n| `/etc/ssl/ca-bundle.pem` | `$PREFIX/etc/tls/cert.pem` |\n| `/etc/pki/tls/cacert.pem` | `$PREFIX/etc/tls/cert.pem` |\n| `/etc/ssl/cert.pem` | `$PREFIX/etc/tls/cert.pem` |\n\n## Contributing\n\nContributions are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.\n\n## License\n\nSee [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frios0rios0%2Ftermux-etc-redirect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frios0rios0%2Ftermux-etc-redirect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frios0rios0%2Ftermux-etc-redirect/lists"}