tor-switch
Tor configuration and routing management for Kodachi OS
Version: 9.0.1 | Size: 13.6MB | Author: Warith Al Maawali
License: Proprietary | Website: https://digi77.com
File Information
Property | Value |
---|---|
Binary Name | tor-switch |
Version | 9.0.1 |
Build Date | 2025-09-23T19:20:06.409667585Z |
Rust Version | 1.82.0 |
File Size | 13.6MB |
JSON Data | View Raw JSON |
SHA256 Checksum
Features
Feature | Description |
---|---|
Feature | Tor network management and configuration |
Feature | Multi-instance Tor support |
Feature | Exit node rotation and control |
Feature | DNS leak prevention integration |
Feature | Firewall rule management |
Feature | HAProxy configuration for load balancing |
Feature | Authentication and security verification |
Feature | Comprehensive logging and monitoring |
Security Features
Feature | Description |
---|---|
Authentication | Secure authentication with certificate pinning |
Encryption | TLS 1.3 for all network communications |
Inputvalidation | All inputs are validated and sanitized |
Ratelimiting | Built-in rate limiting for network operations |
System Requirements
Requirement | Value |
---|---|
OS | Linux (Debian-based) |
Privileges | root/sudo for system operations |
Dependencies | OpenSSL, libcurl |
Global Options
Flag | Description |
---|---|
-h, --help |
Print help information |
-v, --version |
Print version information |
-n, --info |
Display detailed information |
-e, --examples |
Show usage examples |
--json |
Output in JSON format |
--json-pretty |
Pretty-print JSON output with indentation |
--json-human |
Enhanced JSON output with improved formatting (like jq) |
--verbose |
Enable verbose output |
--quiet |
Suppress non-essential output |
--no-color |
Disable colored output |
--config <FILE> |
Use custom configuration file |
--timeout <SECS> |
Set timeout (default: 30) |
--retry <COUNT> |
Retry attempts (default: 3) |
Commands
Authentication
verify_auth
Verify authentication status
Usage:
refresh_auth
Refresh authentication
Usage:
Basic Operations
start_tor
Start Tor daemon
Usage:
stop_tor
Stop Tor daemon
Usage:
restart_tor
Restart Tor daemon
Usage:
Configuration
validate_torrc
Validate torrc configuration
Usage:
reload_tor_config
Reload Tor configuration
Usage:
reload_tor_config_all
Reload config for all instances
Usage:
backup_config
Backup configuration
Usage:
backup_config_all
Backup all configurations
Usage:
restore_config
Restore configuration
Usage:
restore_config_all
Restore all configurations
Usage:
list_backups
List configuration backups
Usage:
generate_new_tor_password
Generate new Tor control password
Usage:
generate_new_tor_password_all
Generate password for all instances
Usage:
clean_torrc_custom
Clean custom torrc file
Usage:
clean_torrc_custom_all
Clean custom torrc for all instances
Usage:
DNS Management
start_tor_dns_iptables
Start Tor DNS with iptables
Usage:
start_tor_dns_nftables
Start Tor DNS with nftables
Usage:
stop_tor_dns_iptables
Stop Tor DNS iptables
Usage:
stop_tor_dns_nftables
Stop Tor DNS nftables
Usage:
torrify_system_dns
Route DNS through Tor
Usage:
torrify_system_iptables_dns
Route DNS through Tor with iptables
Usage:
torrify_system_nftables_dns
Route DNS through Tor with nftables
Usage:
verify_tor_dns
Verify Tor DNS resolution
Usage:
verify_tor_dns_all
Verify DNS for all instances
Usage:
verify_tor_dns_direct
Direct Tor DNS verification
Usage:
verify_tor_dns_port
Verify Tor DNS port
Usage:
Exit Node Control
set_exit_node
Set Tor exit node
Usage:
set_exit_node_all
Set exit node for all instances
Usage:
set_exclude_node
Set excluded nodes
Usage:
set_exclude_node_all
Set excluded nodes for all instances
Usage:
clear_exit_node
Clear exit node restrictions
Usage:
clear_exit_node_all
Clear exit node for all instances
Usage:
new_tor_circuit
Create new Tor circuit
Usage:
new_tor_circuit_all
New circuit for all instances
Usage:
Firewall
flush_iptables
Flush iptables rules
Usage:
flush_nftables
Flush nftables rules
Usage:
list_iptables
List iptables rules
Usage:
list_iptables_nat
List iptables NAT rules
Usage:
list_nftables
List nftables rules
Usage:
HAProxy
generate_haproxy_config
Generate HAProxy configuration
Usage:
haproxy_start
Start HAProxy service
Usage:
haproxy_stop
Stop HAProxy service
Usage:
haproxy_status
Check HAProxy status
Usage:
list_haproxy_modes
List HAProxy load balancing modes
Usage:
display_load_balancing_config
Display load balancing configuration
Usage:
Help
show_help
Show help information
Usage:
show_examples
Show usage examples
Usage:
Instance Management
create_instance
Create new Tor instance
Usage:
delete_instance
Delete Tor instance
Usage:
delete_all_instances
Delete all Tor instances
Usage:
delete_all_instances_with_default
Delete all instances including default
Usage:
start_instance
Start a Tor instance
Usage:
stop_instance
Stop a Tor instance
Usage:
restart_instance
Restart a Tor instance
Usage:
start_all_instances
Start all Tor instances
Usage:
stop_all_instances
Stop all Tor instances
Usage:
show_instance
Show instance details
Usage:
set_default_instance
Set default Tor instance
Usage:
rename_instance
Rename a Tor instance
Usage:
clone_instance
Clone a Tor instance
Usage:
create_multiple_instances
Create multiple Tor instances
Usage:
Load Balancing
set_load_balancing_mode
Set load balancing mode
Usage:
set_instance_weight
Set instance weight for load balancing
Usage:
torrify_system_iptables_load_balanced
Torrify with iptables load balancing
Usage:
torrify_system_nftables_load_balanced
Torrify with nftables load balancing
Usage:
Main Tor Management
validate_torrc_main
Validate main Tor configuration
Usage:
read_main_tor_config
Display main Tor settings (ports, exit/exclude nodes, security)
Usage:
backup_main_tor_config
Backup main Tor configuration
Usage:
restore_main_tor_config
Restore main Tor configuration from backup
Usage:
set_exit_node_main
Set exit node for main Tor
Usage:
clear_exit_node_main
Clear exit restrictions for main Tor
Usage:
set_exclude_node_main
Set excluded countries for main Tor
Usage:
clear_exclude_node_main
Clear exclude restrictions for main Tor
Usage:
list_exit_exclude_main
Show current exit/exclude settings for main Tor
Usage:
reload_main_tor
Reload main Tor configuration (SIGHUP)
Usage:
status_main_tor
Detailed status of main Tor daemon
Usage:
verify_main_tor_dns
Verify DNS routing through main Tor
Usage:
new_circuit_main_tor
Request new circuit for main Tor
Usage:
check_main_tor_security
Security audit of main Tor config
Usage:
main_tor_bandwidth
Show bandwidth usage of main Tor
Usage:
main_tor_connections
List active connections through main Tor
Usage:
main_tor_logs
Display recent main Tor logs
Usage:
Status Operations
check_tor
Check if Tor is working
Usage:
check_tor_all
Check if Tor is working for all instances
Usage:
torverify
Verify Tor connectivity through network check
Usage:
tor_status
Get detailed Tor status
Usage:
tor_status_all
Get Tor status for all instances
Usage:
get_tor_status
Get Tor status information
Usage:
get_tor_custom_status
Get custom Tor status
Usage:
list_instances
List all Tor instances
Usage:
list_instances_with_ip
List all Tor instances with IP addresses
Usage:
System Management
which_is_active
Check active firewall system
Usage:
cleanup
Clean up orphaned Tor instances
Usage:
clean_orphan_services
Clean orphaned services
Usage:
System Routing
torrify_system_iptables
Route all traffic through Tor (iptables)
Usage:
detorrify_system_iptables
Stop routing traffic through Tor (iptables)
Usage:
torrify_system_nftables
Route all traffic through Tor (nftables)
Usage:
detorrify_system_nftables
Stop routing traffic through Tor (nftables)
Usage:
Timer & Automation
auto_ip_change
Enable automatic IP changes
Usage:
stop_auto_ip_change
Stop automatic IP changes
Usage:
update_ip_timer
Update IP change timer
Usage:
update_ip_all_timer
Update timer for all instances
Usage:
remove_ip_timer
Remove IP change timer
Usage:
remove_ip_all_timer
Remove all IP timers
Usage:
list_ip_timers
List all IP change timers
Usage:
list_auto_ip_change
List auto IP change settings
Usage:
Examples
Basic Usage
Essential operations for getting started
Start Tor daemon
Expected Output: Tor daemon started successfullyNote
Requires sudo privileges for system-level operations
Stop Tor daemon
Expected Output: Tor daemon stopped successfullyNote
Gracefully shuts down Tor service
Restart Tor daemon
Expected Output: Tor daemon restarted successfullyNote
Combines stop and start operations
Route all traffic through Tor
Expected Output: System traffic routing through Tor enabledNote
All network traffic will be routed through Tor
Stop routing traffic through Tor
Expected Output: System traffic routing through Tor disabledNote
Returns to normal direct internet connection
Check if Tor service is running
Expected Output: Tor is responding/not respondingNote
Checks if Tor service is active via systemctl
Verify actual Tor connectivity
Expected Output: Shows whether traffic is routed through Tor and displays IPNote
Makes direct HTTP request to check.torproject.org to verify torrification
Get new Tor circuit/IP
Expected Output: New circuit established with different exit IPNote
Forces new Tor circuit for different exit node
Instance Management
Managing multiple Tor instances for performance
Create a secondary Tor instance
Expected Output: Instance 'secondary' created successfullyNote
Multiple instances provide load balancing and redundancy
List all available instances
Expected Output: Shows all instances with their statusStart specific instance
Expected Output: Instance 'secondary' startedStop specific instance
Expected Output: Instance 'secondary' stoppedRestart specific instance
Expected Output: Instance 'secondary' restartedDelete an instance permanently
Expected Output: Instance 'secondary' deletedNote
This permanently removes the instance configuration
Start all configured instances
Expected Output: All Tor instances startedStop all running instances
Expected Output: All Tor instances stoppedAdvanced Instance Operations
Create, clone, rename and manage multiple Tor instances
Create 5 auto-named instances
Expected Output: 5 Tor instances created with auto-generated namesNote
Useful for load balancing and redundancy
Create 3 instances with 'performance' prefix
Expected Output: 3 instances created: performance_0, performance_1, performance_2Note
Creates instances with custom naming prefix
Create 10 worker instances
Expected Output: 10 instances created: worker_1 through worker_10Note
Ideal for high-throughput operations
Create 5 regional instances
Expected Output: 5 instances created: region_1 through region_5Note
Perfect for geographic distribution
Create 3 node instances
Expected Output: 3 instances created: node_1, node_2, node_3Note
Simple node-based naming
Clone 'main' instance to 'backup'
Expected Output: Instance 'main' cloned to 'backup' successfullyNote
Copies all configuration from source instance
Rename instance
Expected Output: Instance renamed from 'old_name' to 'new_name'Note
Updates all references and configuration files
List all instances with current IP addresses
Expected Output: All instances listed with their current exit IPsNote
Shows both instance names and their current exit IPs
Show detailed information for 'streaming' instance
Expected Output: Detailed configuration and status for 'streaming' instanceNote
Shows configuration, status, and current IP information
Set 'performance_0' as the default instance
Expected Output: Default instance set to 'performance_0'Note
Changes which instance is used for default operations
Set weight for load balancing
Expected Output: Instance 'secondary' weight set to 50Note
Used for load balancing when multiple instances are active
Delete all instances except default
Expected Output: All non-default instances deletedNote
Preserves default instance for basic functionality
Delete ALL instances including default
Expected Output: All instances deleted including defaultNote
WARNING: Removes all instances
Monitoring & Status
Checking system status and verifying operations
Get detailed Tor status
Expected Output: Comprehensive status report of all Tor componentsDetailed status in JSON format
Expected Output: JSON-formatted status reportNote
Machine-readable output for scripts
Check Tor status for all instances
Expected Output: Connection status for every configured instanceNote
Quick health check across all instances
Verify if system traffic is routed through Tor
Expected Output: ✓ You are connected through Tor IP Address:Note
Makes HTTP request to check.torproject.org API to verify torrification
Verify Tor connectivity with detailed JSON output
Expected Output: { "is_tor": true, "ip_address": "Note
Useful for scripts and automation
Get detailed status for all instances
Expected Output: Comprehensive status report for all instancesGet Tor daemon status
Expected Output: Current Tor daemon statusNote
Quick status check - use tor_status for detailed report
Troubleshooting
Debug and resolve common issues
Clean up orphaned processes
Expected Output: Orphaned instances and services cleaned upNote
Use when experiencing startup issues
Thorough cleanup including systemd units
Expected Output: Complete cleanup including failed systemd servicesNote
More comprehensive than regular cleanup
Clean orphaned services
Expected Output: Orphaned services removedNew circuits for all instances
Expected Output: All instances have new circuits with different IPsNote
Refreshes exit IPs for all active instances
Start with detailed logging
Expected Output: Detailed startup process informationNote
Use when diagnosing startup problems
4. EXIT NODE MANAGEMENT
Control and configure Tor exit nodes for geographic routing and privacy
Route via United States
Expected Output: Exit node set to United StatesNote
Traffic will exit through US-based Tor nodes
Set UK exit for specific instance
Expected Output: Exit node set to United Kingdom for 'secondary'Note
Instance-specific exit node configuration
Set Germany exit for streaming instance
Expected Output: Exit node set to Germany for 'streaming'Note
Useful for geo-restricted content
Set Switzerland exit for secure instance
Expected Output: Exit node set to Switzerland for 'secure'Note
Privacy-friendly jurisdiction
Random exit node selection
Expected Output: Exit node set to random selectionNote
Maximum anonymity through randomization
Random worldwide exit node
Expected Output: Exit node set to random country worldwideNote
Maximum geographic diversity
Random European exit node
Expected Output: Exit node set to random European countryNote
Stay within European jurisdiction
Random Asian exit node
Expected Output: Exit node set to random Asian countryNote
Exit through Asian infrastructure
Random African exit node
Expected Output: Exit node set to random African countryNote
Exit through African networks
Random North American exit
Expected Output: Exit node set to random North American countryNote
US, Canada, or Mexico exit
Random South American exit
Expected Output: Exit node set to random South American countryNote
Latin American exit points
Random Oceania exit node
Expected Output: Exit node set to random Oceania countryNote
Australia, NZ, or Pacific islands
Random Middle Eastern exit
Expected Output: Exit node set to random Middle Eastern countryNote
Middle Eastern exit points
Random Five Eyes exit
Expected Output: Exit node set to random Five Eyes countryNote
US, UK, CA, AU, or NZ
Random Nine Eyes exit
Expected Output: Exit node set to random Nine Eyes countryNote
5eyes + DK, FR, NL, NO
Random Fourteen Eyes exit
Expected Output: Exit node set to random Fourteen Eyes countryNote
9eyes + DE, BE, IT, ES, SE
Random high-traffic exit
Expected Output: Exit node set to random high-volume countryNote
Better performance and anonymity
Random low-traffic exit
Expected Output: Exit node set to random low-volume countryNote
Less common exit points
Route through any European country
Expected Output: Exit node set to Europe regionNote
GDPR-compliant region
Route through any Asian country
Expected Output: Exit node set to Asia regionNote
Asian network infrastructure
Route through any African country
Expected Output: Exit node set to Africa regionNote
African exit nodes
Route through North America
Expected Output: Exit node set to North America regionNote
US, Canada, or Mexico
Route through South America
Expected Output: Exit node set to South America regionNote
Latin American countries
Route through Oceania
Expected Output: Exit node set to Oceania regionNote
Pacific region countries
Route through Middle East
Expected Output: Exit node set to Middle East regionNote
Middle Eastern countries
Use Five Eyes countries
Expected Output: Exit node set to Five Eyes allianceNote
US, UK, Canada, Australia, NZ
Use Nine Eyes countries
Expected Output: Exit node set to Nine Eyes allianceNote
5eyes + Denmark, France, Netherlands, Norway
Use Fourteen Eyes countries
Expected Output: Exit node set to Fourteen Eyes allianceNote
9eyes + Germany, Belgium, Italy, Spain, Sweden
Use high-traffic countries
Expected Output: Exit node set to high-volume countriesNote
Better performance and anonymity
Use low-traffic countries
Expected Output: Exit node set to low-volume countriesNote
Less common exit points for uniqueness
Set Canada for all instances
Expected Output: Exit node set to Canada for all instancesNote
Applies setting to all configured instances
Clear exit node restrictions
Expected Output: Exit node restrictions clearedNote
Returns to default random exit selection
Exclude specific countries
Expected Output: Excluded nodes setNote
Prevents routing through specified countries
Exclude Five Eyes countries
Expected Output: Five Eyes countries excludedNote
US, UK, Canada, Australia, New Zealand
Exclude Nine Eyes countries
Expected Output: Nine Eyes countries excludedNote
5eyes + Denmark, France, Netherlands, Norway
Exclude Fourteen Eyes countries
Expected Output: Fourteen Eyes countries excludedNote
9eyes + Germany, Belgium, Italy, Spain, Sweden
Exclude all European countries
Expected Output: European countries excludedNote
Routes traffic outside Europe
Exclude all Asian countries
Expected Output: Asian countries excludedNote
Avoids Asian network infrastructure
Exclude North American countries
Expected Output: North American countries excludedNote
US, Canada, Mexico excluded
Exclude high-traffic countries
Expected Output: High-volume countries excludedNote
Forces use of less common exit nodes
Exclude low-traffic countries
Expected Output: Low-volume countries excludedNote
Use only high-traffic exit nodes
Exclude one random high-traffic country
Expected Output: Random high-volume country excludedNote
Randomly blocks one popular exit country
Exclude one random low-traffic country
Expected Output: Random low-volume country excludedNote
Randomly blocks one uncommon exit country
Exclude Asia for secure instance
Expected Output: Asia excluded for 'secure' instanceNote
Instance-specific exclusion
Exclude 14eyes for privacy instance
Expected Output: 14eyes excluded for 'privacy_1' instanceNote
Maximum privacy configuration
Exclude France for all instances
Expected Output: France excluded for all instancesNote
Global exclusion across all instances
Clear all excluded countries
Expected Output: All exclusions removedNote
Resets to default behavior
Clear exit restrictions for all instances
Expected Output: Exit restrictions cleared for all instancesNote
All instances return to random exit selection
7. LOAD BALANCING (Native Kernel-Level)
Native load balancing using iptables/nftables firewall rules
Sequential distribution
Expected Output: Load balancing mode set to round-robinNote
Each new connection uses the next Tor instance in order
Weight-based distribution
Expected Output: Load balancing mode set to weightedNote
Routes traffic based on instance weights
Client IP affinity for session persistence
Expected Output: Load balancing mode set to consistent-hashingNote
Same client IP always routes to same Tor instance
Set weight for specific instance
Expected Output: Weight for instance 'tor1' set to 50Note
Only affects weighted mode distribution
Set low weight for minimal traffic
Expected Output: Weight for instance 'tor1' set to 10Note
10% of traffic when using weighted mode
Set moderate weight for balanced traffic
Expected Output: Weight for instance 'tor2' set to 30Note
30% of traffic distribution
Set high weight for primary traffic
Expected Output: Weight for instance 'tor3' set to 60Note
60% of traffic - primary instance
High weight for performance instance
Expected Output: Weight for instance 'performance_0' set to 75Note
Prioritize high-performance instance
Minimal weight for backup instance
Expected Output: Weight for instance 'backup' set to 5Note
Mostly idle, used for failover
Equal weight for worker instances
Expected Output: Weight for instance 'worker_1' set to 25Note
4 workers at 25% each = equal distribution
Show current load balancing setup
Expected Output: Current load balancing configuration detailsApply load balanced routing (iptables)
Expected Output: Load balanced routing through Tor enabledNote
Routes traffic through multiple Tor instances using iptables
Apply load balanced routing (nftables)
Expected Output: Load balanced routing through Tor enabled (nftables)Note
Modern firewall load balanced routing using nftables
8. HAPROXY INTEGRATION (Application-Level Proxy)
HAProxy provides advanced application-level load balancing
Generate config with round-robin algorithm
Expected Output: HAProxy configuration generatedNote
Each server is used in turns on port 9055
Generate config with source IP hash
Expected Output: HAProxy configuration generatedNote
IP hash persistence on port 8080
Generate config with least connections
Expected Output: HAProxy configuration generatedNote
Routes to instance with fewest active connections
Generate config with random selection
Expected Output: HAProxy configuration generatedNote
Randomly selects backend for each connection
Start HAProxy service
Expected Output: HAProxy started successfullyCheck HAProxy status
Expected Output: HAProxy service status and statisticsStop HAProxy service
Expected Output: HAProxy stoppedShow available HAProxy algorithms
Expected Output: List of supported HAProxy algorithmsNote
roundrobin, source, leastconn, random
Timer Management and Automation
Automatic IP rotation and timer-based operations
Auto IP change every 10 minutes
Expected Output: Automatic IP change enabled with 10 minute intervalNote
Creates new Tor circuit to get new exit IP
Set timer for specific instance
Expected Output: IP change timer set for 'browsing' instanceSet 30-minute timer for worker instance
Expected Output: IP change timer set for 'worker_1' instance: 30 minutesNote
Balanced rotation for moderate privacy
Set hourly timer for streaming
Expected Output: IP change timer set for 'streaming' instance: 1 hourNote
Less frequent changes for stable connections
Set 15-minute timer for research
Expected Output: IP change timer set for 'research' instance: 15 minutesNote
Frequent rotation for privacy-focused browsing
Set daily timer for backup instance
Expected Output: IP change timer set for 'backup' instance: 24 hoursNote
Minimal rotation for long-running operations
Set 10-minute timer for all instances
Expected Output: IP change timer set for all instances: 10 minutesNote
Synchronizes rotation across all instances
Set 2-hour timer for all instances
Expected Output: IP change timer set for all instances: 2 hoursNote
Stable rotation for production workloads
List all IP change timers
Expected Output: Table showing all instances with their IP change intervalsRemove timer for instance
Expected Output: IP change timer removedStop auto IP change
Expected Output: Automatic IP change stoppedSet timer for all instances
Expected Output: IP change timer set for all instancesNote
Synchronizes IP rotation across instances
Remove all IP change timers
Expected Output: All IP timers removedNote
Removes all automatic IP rotation timers from all instances
List automatic IP change settings
Expected Output: Auto IP change configurations for all instancesDNS Verification
Test and verify DNS routing through Tor
Verify Tor DNS resolution of .onion addresses
Expected Output: DNS verification successful! (tests both direct and port methods)Note
Resolves .onion addresses to verify DNS goes through Tor
Verify DNS resolution for all Tor instances
Expected Output: DNS verification results for each instanceNote
Tests .onion resolution for all configured Tor instances
Verify .onion resolution using system DNS
Expected Output: Onion addresses can be resolved directlyNote
Uses system resolver to test .onion domain resolution
Verify .onion resolution via Tor DNS port
Expected Output: Onion addresses can be resolved using DNS portNote
Uses instance's DNS port to test .onion resolution
Verify DNS for specific instance
Expected Output: DNS verification successful for instance 'tor1'Note
Tests DNS for a specific Tor instance
DNS Management
Configure and manage DNS routing through Tor
Start Tor DNS listener with iptables
Expected Output: Tor DNS service started with iptables rulesNote
Sets up Tor DNS listener service on port 9053
Stop Tor DNS routing
Expected Output: Tor DNS iptables rules removedRoute all DNS through Tor
Expected Output: System DNS queries routed through TorNote
Universal command - auto-detects and uses active firewall
Start Tor DNS listener with nftables
Expected Output: Tor DNS service started with nftables rulesNote
Sets up Tor DNS listener service on port 9053
Stop Tor DNS (nftables)
Expected Output: Tor DNS nftables rules removedRoute DNS through Tor using iptables
Expected Output: DNS routing through Tor enabled (iptables)Note
Redirects all system DNS queries to Tor DNS listener
Route DNS through Tor using nftables
Expected Output: DNS routing through Tor enabled (nftables)Note
Redirects all system DNS queries to Tor DNS listener
Firewall Operations
Manage iptables and nftables firewall rules
Flush iptables rules
Expected Output: All iptables rules clearedNote
Removes all current iptables rules and policies
List current iptables rules
Expected Output: Display of all active iptables rulesCheck active firewall
Expected Output: Shows whether iptables or nftables is activeFlush nftables rules
Expected Output: All nftables rules clearedNote
Removes all current nftables rules
List current nftables rules
Expected Output: Display of all active nftables rulesList NAT rules
Expected Output: Display of all NAT table rulesNote
Shows network address translation rules
Configuration Management
Manage Tor configuration files and validation
Validate torrc configuration
Expected Output: Configuration validation resultsNote
Checks syntax without starting Tor
Reload configuration
Expected Output: Configuration reloaded successfullyNote
Applies changes without restart
Generate new control password
Expected Output: New control password generatedClean custom configuration
Expected Output: Custom torrc entries removedClean all custom configurations
Expected Output: Custom entries removed from all instancesReload all configurations
Expected Output: All instance configurations reloadedGenerate passwords for all instances
Expected Output: New control passwords generated for allGet custom configuration status
Expected Output: Status of custom configurationsBackup and Restore
Backup and restore Tor instance configurations
Backup configuration
Expected Output: Configuration backed up with timestampList available backups
Expected Output: Table showing all backup filesRestore from backup
Expected Output: Configuration restoredNote
Restores configuration and restarts instances
Backup all configurations
Expected Output: All instance configurations backed upRestore all from backup
Expected Output: All configurations restored from backupNote
Restores complete multi-instance setup
Authentication and Verification
Verify authentication status and system integrity
Verify authentication
Expected Output: Authentication status and token validityNote
Required for write operations
Refresh authentication (sends heartbeat manually)
Expected Output: Authentication token refreshedNote
Manually sends heartbeat to refresh authentication status
Main Tor Management (TROUBLESHOOTING ONLY)
TROUBLESHOOTING ONLY: Commands for debugging the main system Tor. Most operations should use Kodachi instances instead. Only use these for troubleshooting main Tor issues.
Do NOT modify main Tor for regular use
Expected Output: Use Kodachi instances instead for all normal operationsNote
Only use these commands for debugging main Tor issues
Validate main Tor configuration
Expected Output: Main Tor configuration validatedNote
Validates /etc/tor/torrc syntax and settings
Display main Tor configuration
Expected Output: Main Tor configuration displayedNote
Shows ports, exit/exclude nodes, and security settings
Backup main Tor configuration
Expected Output: Main Tor configuration backed upNote
Creates timestamped backup in backups/main-tor/
Restore main Tor configuration
Expected Output: Main Tor configuration restoredNote
Current config is backed up before restoring
Set US exit node for main Tor
Expected Output: Exit node set to US for main TorNote
Forces traffic to exit through United States
Clear exit node restrictions
Expected Output: Exit node restrictions cleared for main TorNote
Allows Tor to choose any exit country
Exclude countries from circuits
Expected Output: Excluded nodes set for main TorNote
Prevents routing through specified countries
Clear excluded countries
Expected Output: Exclude restrictions cleared for main TorNote
Removes all country exclusions
Show exit/exclude settings
Expected Output: Exit/exclude settings displayedNote
Displays current geographic routing rules
Reload main Tor configuration
Expected Output: Main Tor configuration reloadedNote
Sends SIGHUP signal to apply config changes
Get main Tor daemon status
Expected Output: Main Tor status displayedNote
Shows systemctl status and port information
Verify DNS routing through Tor
Expected Output: DNS routing through main Tor verifiedNote
Tests DNS resolution via tor-resolve
Request new Tor circuit
Expected Output: New circuit requested for main TorNote
Gets new IP by building fresh circuit
Security audit main Tor
Expected Output: Security audit completedNote
Checks for security misconfigurations
Show Tor bandwidth usage
Expected Output: Bandwidth usage displayedNote
Displays active SOCKS connections count
List active Tor connections
Expected Output: Active connections listedNote
Shows established connections on SOCKS port
Display recent Tor logs
Expected Output: Recent logs displayedNote
Shows last 50 lines from Tor log or journald
Validate with JSON output
Expected Output: JSON validation output returnedNote
Machine-readable output for scripting
Advanced Workflows
Complete workflow examples for common use cases
Complete privacy-focused setup
# Privacy-focused browsing setup
sudo tor-switch create_multiple_instances 3 privacy
sudo tor-switch set_exclude_node 5eyes --instance privacy_1
sudo tor-switch set_exclude_node 9eyes --instance privacy_2
sudo tor-switch set_exclude_node 14eyes --instance privacy_3
sudo tor-switch update_ip_timer privacy_1 5m
sudo tor-switch update_ip_timer privacy_2 10m
sudo tor-switch update_ip_timer privacy_3 15m
Note
Avoids surveillance alliance countries with rapid rotation
Geographic distribution setup
# Regional distribution setup
sudo tor-switch create_instance europe
sudo tor-switch create_instance asia
sudo tor-switch create_instance americas
sudo tor-switch set_exit_node europe --instance europe
sudo tor-switch set_exit_node asia --instance asia
sudo tor-switch set_exit_node north_america --instance americas
Note
Access region-specific content simultaneously
High-availability load balanced setup
# High-availability setup
sudo tor-switch create_multiple_instances 5 ha
sudo tor-switch set_load_balancing_mode weighted
sudo tor-switch set_instance_weight ha_1 30
sudo tor-switch set_instance_weight ha_2 25
sudo tor-switch set_instance_weight ha_3 20
sudo tor-switch set_instance_weight ha_4 15
sudo tor-switch set_instance_weight ha_5 10
sudo tor-switch torrify_system_iptables_load_balanced
Note
Redundant instances with priority-based traffic distribution
Research and testing environment
# Research and testing setup
sudo tor-switch create_instance research
sudo tor-switch create_instance testing
sudo tor-switch set_exit_node random_low_volume --instance research
sudo tor-switch set_exit_node high_volume --instance testing
sudo tor-switch update_ip_timer research 2m
sudo tor-switch verify_tor_dns --instance research
sudo tor-switch verify_tor_dns --instance testing
Note
Separate instances for different testing scenarios
Maximum performance configuration
# Performance-optimized setup
sudo tor-switch create_multiple_instances 10 perf
sudo tor-switch set_load_balancing_mode round-robin
sudo tor-switch generate_haproxy_config
sudo tor-switch haproxy_start
sudo tor-switch haproxy_status
Note
10 instances with HAProxy for maximum throughput
Complete reset to default state
# Clean slate reset
sudo tor-switch stop_all_instances
sudo tor-switch cleanup --thorough
sudo tor-switch flush_iptables
sudo tor-switch restart_tor
sudo tor-switch check_tor
Note
Removes all custom configurations and instances
Complete system status check
# Monitoring and diagnostics
sudo tor-switch tor_status_all
sudo tor-switch list_instances
sudo tor-switch list_ip_timers
sudo tor-switch display_load_balancing_config
sudo tor-switch haproxy_status
Note
Comprehensive view of all Tor configurations
Environment Variables
Variable | Description | Default | Values |
---|---|---|---|
RUST_LOG |
Set logging level | info | error |
NO_COLOR |
Disable all colored output when set | unset | 1 |
Exit Codes
Code | Description |
---|---|
0 | Success |
1 | General error |
2 | Invalid arguments |
3 | Permission denied |
4 | Network error |
5 | File not found |