mitm

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2026 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Overview

Package mitm implements a transparent Man-in-the-Middle proxy that intercepts TLS connections to known AI providers, enabling the firewall to mask/unmask sensitive data in transit.

(Bilinen AI sağlayıcılarına yapılan TLS bağlantılarını yakalayan şeffaf bir

Ortadaki Adam (MITM) proxy'si uygular. Güvenlik duvarının aktarım sırasında
hassas verileri maskelemesini/maskesini kaldırmasını sağlar.)

Package mitm implements a transparent Man-in-the-Middle proxy that intercepts TLS connections to known AI providers, enabling the firewall to mask/unmask sensitive data in transit.

(Bilinen AI sağlayıcılarına yapılan TLS bağlantılarını yakalayan şeffaf bir

Ortadaki Adam (MITM) proxy'si uygular. Güvenlik duvarının aktarım sırasında
hassas verileri maskelemesini/maskesini kaldırmasını sağlar.)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckInstalled

func CheckInstalled() bool

CheckInstalled checks whether the AI Firewall CA is already installed in the system trust store. Returns false if the check fails for any reason.

(AI Firewall CA'sının sistem güven deposuna zaten yüklenip yüklenmediğini

kontrol eder. Herhangi bir nedenle kontrol başarısız olursa false döner.)

func InstallCA

func InstallCA(certPath string) error

InstallCA installs the CA certificate at certPath into the operating system's trusted root certificate store. This allows clients to trust the MITM proxy's leaf certificates without manual configuration.

Requires elevated privileges (sudo on macOS/Linux, Administrator on Windows). Returns a clear error with manual instructions if it fails due to permissions.

(certPath'teki CA sertifikasını işletim sisteminin güvenilir kök sertifika

deposuna yükler. Bu, istemcilerin MITM proxy'sinin yaprak sertifikalarına
elle yapılandırma olmadan güvenmesini sağlar.
Yükseltilmiş ayrıcalıklar gerektirir (macOS/Linux'ta sudo, Windows'ta Yönetici).
İzin nedeniyle başarısız olursa elle talimatlar içeren açık bir hata döner.)

func UninstallCA

func UninstallCA(certPath string) error

UninstallCA removes the AI Firewall CA certificate from the operating system's trusted root certificate store.

Requires elevated privileges (sudo on macOS/Linux, Administrator on Windows). Returns a clear error with manual instructions if it fails due to permissions.

(AI Firewall CA sertifikasını işletim sisteminin güvenilir kök sertifika deposundan kaldırır. Yükseltilmiş ayrıcalıklar gerektirir (macOS/Linux'ta sudo, Windows'ta Yönetici). İzin nedeniyle başarısız olursa elle talimatlar içeren açık bir hata döner.)

Types

type CA

type CA struct {
	// contains filtered or unexported fields
}

CA holds the root certificate authority used for signing leaf certificates. It is safe for concurrent use from multiple goroutines.

(Yaprak sertifikaları imzalamak için kullanılan kök sertifika otoritesini tutar.

Birden fazla goroutine'den eşzamanlı kullanım için güvenlidir.)

func LoadOrCreateCA

func LoadOrCreateCA(certPath, keyPath string) (*CA, error)

LoadOrCreateCA loads an existing CA certificate and key from disk, or generates a new ECDSA P-256 CA if the files don't exist. The CA is persisted to certPath and keyPath for reuse across restarts.

(Mevcut bir CA sertifikasını ve anahtarını diskten yükler veya dosyalar

yoksa yeni bir ECDSA P-256 CA oluşturur. CA, yeniden başlatmalarda
kullanılmak üzere certPath ve keyPath'e kaydedilir.)

func (*CA) CertPEM

func (ca *CA) CertPEM() []byte

CertPEM returns the CA certificate in PEM format. Used by install.go to write the certificate to the system trust store.

(CA sertifikasını PEM formatında döner.

install.go tarafından sertifikayı sistem güven deposuna yazmak için kullanılır.)

func (*CA) LeafCert

func (ca *CA) LeafCert(hostname string) (*tls.Certificate, error)

LeafCert returns a TLS certificate for the given hostname, using a cached version if available and not expired. Leaf certificates are valid for 24 hours.

(Verilen ana bilgisayar adı için bir TLS sertifikası döner; varsa ve

süresi dolmamışsa önbelleğe alınmış sürümü kullanır.
Yaprak sertifikalar 24 saat geçerlidir.)

type MITMProxy

type MITMProxy struct {
	// contains filtered or unexported fields
}

MITMProxy handles HTTP CONNECT requests to intercept TLS traffic to AI providers. For AI hosts, it performs TLS termination with dynamically generated leaf certs, masks sensitive data, forwards to the real API, and unmasks responses. Non-AI hosts are rejected. This service is not a general-purpose CONNECT proxy.

(HTTP CONNECT isteklerini işleyerek AI sağlayıcılarına yapılan TLS trafiğini

yakalar. AI ana bilgisayarları için dinamik olarak oluşturulan yaprak sertifikalar
ile TLS sonlandırması yapar, hassas verileri maskele, gerçe API'ye iletir ve
yanıtların maskelerini kaldırır. AI olmayan ana bilgisayarlar için kör TCP
tüneli oluşturur (TLS müdahalesi olmaz).)

func NewMITMProxy

func NewMITMProxy(ca *CA, m *masker.Masker, cfg *config.Config) *MITMProxy

NewMITMProxy creates a new MITM proxy handler. (Yeni bir MITM proxy işleyicisi oluşturur.)

func (*MITMProxy) ServeHTTP

func (p *MITMProxy) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP handles incoming requests. Only CONNECT method is supported for establishing TLS tunnels. All other requests receive a 405 Method Not Allowed.

(Gelen istekleri işler. Yalnızca CONNECT yöntemi, TLS tünelleri kurmak için

desteklenir. Diğer tüm istekler 405 Yöntem Izin Verilmiyor yanıtı alır.)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL