惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Microsoft Security Blog
Microsoft Security Blog
J
Java Code Geeks
GbyAI
GbyAI
aimingoo的专栏
aimingoo的专栏
L
LangChain Blog
I
InfoQ
D
Docker
F
Fortinet All Blogs
Y
Y Combinator Blog
Martin Fowler
Martin Fowler
月光博客
月光博客
B
Blog
Engineering at Meta
Engineering at Meta
T
Tailwind CSS Blog
罗磊的独立博客
博客园_首页
G
Google Developers Blog
Stack Overflow Blog
Stack Overflow Blog
Recent Announcements
Recent Announcements
D
DataBreaches.Net
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
B
Blog RSS Feed
IT之家
IT之家
V
V2EX

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Building a Stateless, RAM-Only Transparent Tor Proxy for ...
onyks · 2026-05-15 · via DEV Community
Cover image for Building a Stateless, RAM-Only Transparent Tor Proxy for Linux (TTP v0.3.0)

onyks

Transparent Tor Proxy (TTP) is a Linux CLI tool designed to intercept all outgoing network traffic and force it through the Tor network using nftables. Version 0.3.0 introduces a major architectural shift focused on system integrity and forensic invisibility, transitioning the application to a fully volatile runtime.

The Challenge

Classic transparent proxy implementations often suffer from severe state management issues. System configurations, such as /etc/resolv.conf, are typically overwritten directly. Furthermore, the default system Tor daemon (tor.service) is usually hijacked, leading to permission conflicts and disrupting any pre-existing background Tor relays.

The v0.3.0 Solution: Amnesia Core

The application core has been redesigned to operate almost entirely in volatile memory.

  • Volatile Standard Core: All runtime metadata, lock files, and logs are now stored in /run/ttp, which utilizes a tmpfs mount. This ensures zero physical traces are left on the host's physical disk after a power cycle.
  • Native Service Management: Tor is executed as a dedicated ttp-tor.service systemd unit. The volatile unit file is dynamically generated in /run/systemd/system/, avoiding interference with the system's own tor.service and bypassing its sandboxing restrictions.
  • Conflict Resolution: Daemon management is handled via a private Unix ControlSocket located at /run/tor/ttp/control.sock. SocksPort is set to 0 by default, allowing TTP to coexist alongside other Tor instances without triggering "Address already in use" errors.
  • Stateless DNS Overlay: Physical overwrites of /etc/resolv.conf have been replaced with a kernel-level mount --bind strategy. This achieves non-destructive redirection of DNS queries. Stale DNS mount overlays are automatically cleared to ensure absolute idempotency, and a lazy unmount fallback (umount -l) ensures successful removal during teardown even if the resource is busy.

Network Safety and Memory Trade-offs

Operating exclusively in RAM introduces specific constraints that require careful resource and state management.

  • Graceful Teardown: A cryptographic SHUTDOWN signal is sent to the Tor daemon before nftables firewall rules are removed. This guarantees all circuits close cleanly and strictly prevents cleartext RST packet leaks on the physical interface.
  • Persistent Entry Guards: Bootstrapping Tor entirely from scratch on every execution introduces severe latency. To mitigate this, DataDirectory /var/lib/tor/ttp/ is utilized to preserve Entry Guards across runs, maintaining a fast bootstrap time of approximately 3 seconds.
  • Resource Management: Logs have been moved to /run/ttp/ttp.log and are capped at a 1MB limit to prevent memory exhaustion in the RAM disk. Additionally, a pre-flight safety check is performed to verify sufficient tmpfs space is available before execution, preventing out-of-memory crashes mid-setup.

The networking logic utilizes a dedicated inet ttp table for nftables, ensuring all firewall modifications are isolated and cleanup is executed atomically via an nft destroy command.

Disclaimer: Entry guards are maintained in a persistent cache to facilitate rapid initialization. Although a setting to modify this behavior is currently absent, its introduction is expected in a subsequent version. It must be noted that standard OS-level logging, including systemd journals, remains active, meaning the tool is not forensically invisible or reliable for high-stakes anonymity. For scenarios necessitating absolute forensic protection, the use of TailsOS and the TOR Browser is advised.

Repository: TransparentTorProxy on GitHub