privacy-toolkit/tools/i2p/install.sh

190 lines
5.3 KiB
Bash
Executable file

#!/bin/bash
set -euo pipefail
# ==============================================================================
# I2P (Invisible Internet Project) Installation
# ==============================================================================
# Anonymous overlay network using "garlic routing"
# - Internal network of hidden services (eepsites)
# - Anonymous torrenting
# - More resistant to traffic analysis than Tor for internal traffic
# - Every user is both client and relay
# ==============================================================================
# Colors
readonly GREEN='\033[0;32m'
readonly YELLOW='\033[1;33m'
readonly BLUE='\033[0;34m'
readonly RED='\033[0;31m'
readonly NC='\033[0m'
log() { echo -e "${GREEN}[INFO]${NC} $*"; }
warn() { echo -e "${YELLOW}[WARN]${NC} $*"; }
error() { echo -e "${RED}[ERROR]${NC} $*"; }
section() { echo -e "${BLUE}=== $* ===${NC}"; }
section "I2P Installation"
echo ""
# Check if already installed
if command -v i2prouter &>/dev/null || [ -d /usr/share/i2p ]; then
log "I2P appears to be already installed"
read -p "Reinstall/upgrade? [y/N] " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
log "Skipping installation"
exit 0
fi
fi
# Detect distro
if [ -f /etc/os-release ]; then
. /etc/os-release
DISTRO="${ID:-unknown}"
else
error "Cannot detect distribution"
exit 1
fi
log "Detected: $DISTRO"
case "$DISTRO" in
debian|ubuntu|linuxmint|pop)
# Try i2pd from repos first (C++ implementation - lighter, faster)
if apt-cache show i2pd &>/dev/null; then
section "Installing i2pd (C++ implementation) from Debian repos"
log "i2pd is a lighter, faster C++ implementation of I2P"
sudo apt update
sudo apt install -y i2pd
log "i2pd installed from Debian repositories"
else
section "Installing I2P via Official Repository"
warn "i2pd not in repos, trying official I2P repository..."
# Install dependencies
log "Installing dependencies..."
sudo apt update
sudo apt install -y apt-transport-https curl gnupg
# Add I2P repo signing key
log "Adding I2P repository key..."
curl -fsSL https://geti2p.net/_static/i2p-archive-keyring.gpg | sudo gpg --dearmor -o /usr/share/keyrings/i2p-archive-keyring.gpg
sudo chmod 644 /usr/share/keyrings/i2p-archive-keyring.gpg
# Add I2P repository
log "Adding I2P repository..."
echo "deb [signed-by=/usr/share/keyrings/i2p-archive-keyring.gpg] https://deb.i2p2.de/ $(lsb_release -sc) main" | \
sudo tee /etc/apt/sources.list.d/i2p.list > /dev/null
# Install I2P
log "Installing I2P..."
sudo apt update
sudo apt install -y i2p i2p-keyring
fi
;;
fedora|rhel|centos)
section "Installing I2P via Copr"
log "Adding I2P Copr repository..."
sudo dnf copr enable -y i2p/i2p
log "Installing I2P..."
sudo dnf install -y i2p
;;
arch|manjaro|endeavouros)
section "Installing I2P via AUR"
if command -v yay &>/dev/null; then
log "Installing via yay..."
yay -S --noconfirm i2pd
elif command -v paru &>/dev/null; then
log "Installing via paru..."
paru -S --noconfirm i2pd
else
warn "No AUR helper found, installing i2pd manually..."
cd /tmp
git clone https://aur.archlinux.org/i2pd.git
cd i2pd
makepkg -si --noconfirm
cd ..
rm -rf i2pd
fi
;;
*)
error "Unsupported distribution: $DISTRO"
log "Please install manually from: https://geti2p.net/en/download"
exit 1
;;
esac
echo ""
section "Installation Complete!"
echo ""
cat << 'EOF'
I2P has been installed. Here's how to use it:
=== IF YOU INSTALLED i2pd (C++ version) ===
START i2pd:
sudo systemctl start i2pd
sudo systemctl enable i2pd # Auto-start on boot
WEB CONSOLE:
Open in browser: http://127.0.0.1:7070
PROXY PORTS:
HTTP Proxy: 127.0.0.1:4444 (for .i2p sites)
SOCKS Proxy: 127.0.0.1:4447
CONFIG FILE:
/etc/i2pd/i2pd.conf
=== IF YOU INSTALLED i2p (Java version) ===
START I2P:
sudo systemctl start i2p
# Or: i2prouter start
WEB CONSOLE:
Open in browser: http://127.0.0.1:7657
PROXY PORT:
HTTP Proxy: 127.0.0.1:4444
=== GENERAL USAGE ===
CONFIGURE YOUR BROWSER:
Set HTTP proxy to: 127.0.0.1:4444
(This lets you access .i2p eepsites)
FIRST-TIME SETUP:
1. Start I2P and wait ~5 minutes for network integration
2. Access the web console
3. Configure bandwidth limits based on your connection
POPULAR EEPSITES TO TEST:
- http://i2p-projekt.i2p (I2P Project homepage)
- http://stats.i2p (Network statistics)
SECURITY NOTES:
- I2P is for accessing I2P internal services (eepsites)
- Don't use I2P for regular web browsing (use Tor for that)
- Takes time to build up "tunnels" - be patient on first run
- More peers = better anonymity and speed
EOF
# Check if service is available
if systemctl list-unit-files | grep -q i2p.service; then
echo ""
log "To start I2P now: sudo systemctl start i2p"
log "To enable auto-start: sudo systemctl enable i2p"
fi
echo ""