Skip to content

Latest commit

Β 

History

History
121 lines (85 loc) Β· 2.85 KB

File metadata and controls

121 lines (85 loc) Β· 2.85 KB

πŸ” Corporate Proxy in Rust

A complete corporate HTTP/HTTPS proxy developed in Rust, focused on security, control, and performance. This proxy is ideal for corporate environments that require authentication, content blocking, and traffic logging.

πŸš€ Features

  • πŸ” Authentication via Proxy-Authorization header (Basic Auth)
  • 🌐 HTTPS support using the CONNECT method
  • 🚫 Domain and keyword blocking (e.g., "porn", "torrent", etc.)
  • πŸ“„ External configuration via proxy_config.json
  • πŸ“¦ Automatic fallback to default settings if JSON config is missing
  • 🧾 Detailed request logging
  • ⚑ Multithreaded and asynchronous with tokio

πŸ“ Project Structure

.
.
β”œβ”€β”€ Cargo.lock
β”œβ”€β”€ Cargo.toml
β”œβ”€β”€ LICENSE
β”œβ”€β”€ proxy_config.json
β”œβ”€β”€ proxy_logs.jsonl
β”œβ”€β”€ src
β”‚Β Β  └── main.rs
└── README.md

πŸ› οΈ Requirements

  • Rust (version 1.70+ recommended)
  • Cargo

πŸ“¦ Installation

Clone the repository and build the project:

git clone https://github.com/filipe-freitas-dev/https_proxy.git
cd https_proxy
cargo build --release

βš™οΈ Configuration

You can provide a proxy_config.json file with the following structure:

{
  "proxy_port": 8080,
  "username": "admin",
  "password": "supersecret",
  "blocked_domains": ["example.com", "test.org"],
  "blocked_keywords": ["porn", "torrent", "hack"]
}

If the file is not found, the proxy will use default settings:

{
  "proxy_port": 8080,
  "username": "admin",
  "password": "password",
  "blocked_domains": [],
  "blocked_keywords": []
}

▢️ Running

With custom configuration:

./target/release/rust-corporate-proxy

Or directly with default settings:

cargo run --release

πŸ” Logging

The proxy logs all processed requests:

  • Authenticated and blocked requests
  • Keyword detection
  • Blocked domain access attempts
  • TLS/connection errors

Example log:

{"timestamp":"2025-05-28T17:03:04.304297450Z","client_ip":"127.0.0.1","user":"admin","method":"GET","url":"http://detectportal.firefox.com/success.txt?ipv6","status":403,"blocked":true,"block_reason":"DomΓ­nio bloqueado","response_size":0}

πŸ“‹ To-Do

  • Persistent log storage
  • Web dashboard for monitoring
  • Dynamic blocking list via API
  • Rate limiting

🧠 About This Project

This proxy was developed as a practical project for studying cybersecurity, networking, and systems programming in Rust. It aims to deliver a robust and extensible tool for monitoring and controlling HTTP/HTTPS traffic in enterprise environments.


πŸ§‘β€πŸ’» Author

Made with πŸ’», β˜• and curiosity by Your Name or GitHub

πŸ“„ License

This project is licensed under the MIT License.