Thanks to visit codestin.com
Credit goes to github.com

Skip to content

🛡️ Unified security management solution for Linux servers | Унифицированное решение для управления безопасностью Linux серверов

License

Notifications You must be signed in to change notification settings

FUYOH666/linux-defender

🛡️ Linux Defender

Python License Code style Version

A unified security management solution for Linux servers | Унифицированное решение для управления безопасностью Linux серверов

Linux Defender is an open-source security orchestration tool that unifies multiple security tools into a single, easy-to-use interface. Manage ClamAV, Fail2ban, Lynis, AIDE, Trivy, and more from one place.

Linux Defender — это open-source инструмент оркестрации безопасности, объединяющий множество инструментов безопасности в единый простой интерфейс.

✨ Features | Возможности

Security Modules | Модули безопасности

  • 🦠 ClamAV - Antivirus scanning with automatic database updates | Антивирусное сканирование с автоматическим обновлением баз данных
  • 🚫 Fail2ban - Brute-force protection and automatic IP blocking | Защита от брутфорса и автоматическая блокировка IP
  • 🔍 Lynis - Automated security auditing and hardening | Автоматический аудит безопасности и hardening
  • 🕵️ Rootkit Detection - Rootkit and backdoor detection (rkhunter/chkrootkit) | Обнаружение руткитов и бэкдоров
  • 📋 AIDE - File Integrity Monitoring (FIM) | Контроль целостности файлов
  • 🔎 Trivy - Vulnerability scanner for installed packages | Сканер уязвимостей для установленных пакетов
  • ⚙️ Wazuh - IDS/IPS, log monitoring, FIM (optional) | IDS/IPS, мониторинг логов (опционально)
  • ⚡ Falco - Runtime security via eBPF (optional) | Runtime security через eBPF (опционально)

Notifications & Monitoring | Уведомления и мониторинг

  • 📧 Email Notifications - Get alerts via email | Получайте уведомления по email
  • 🔔 Telegram Notifications - Real-time alerts via Telegram bot | Уведомления в реальном времени через Telegram бота
  • 🌐 Webhook Support - Integrate with external services | Интеграция с внешними сервисами
  • 📊 Daily Reports - Automated daily system and security status reports | Автоматические ежедневные отчеты о статусе системы и безопасности
  • ⚡ Real-time Monitoring - Continuous monitoring of security events | Непрерывный мониторинг событий безопасности
  • 🚨 Threat Alerts - Instant notifications when threats are detected | Мгновенные уведомления при обнаружении угроз

🚀 Quick Start | Быстрый старт

Prerequisites | Требования

  • Python 3.12+
  • Ubuntu/Debian Linux (recommended | рекомендуется)
  • Root/sudo access for security tool management | Доступ root/sudo для управления инструментами безопасности

Installation | Установка

  1. Install system security tools | Установите системные инструменты безопасности:
# ClamAV
sudo apt update
sudo apt install -y clamav clamav-daemon

# Fail2ban
sudo apt install -y fail2ban

# Lynis
sudo apt install -y lynis

# Rootkit detection | Обнаружение руткитов
sudo apt install -y rkhunter chkrootkit

# AIDE (File Integrity Monitoring | Контроль целостности файлов)
sudo apt install -y aide aide-common

# Trivy (Vulnerability Scanner | Сканер уязвимостей)
wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | sudo apt-key add -
echo "deb https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/trivy.list
sudo apt update
sudo apt install -y trivy
  1. Install Linux Defender | Установите Linux Defender:
# Clone the repository | Клонируйте репозиторий
git clone https://github.com/FUYOH666/linux-defender.git
cd linux-defender

# Install dependencies | Установите зависимости
uv sync
# or | или
pip install -e .

# Copy and configure | Скопируйте и настройте
cp config.yaml.example config.yaml
# Edit config.yaml to suit your needs | Отредактируйте config.yaml под свои нужды
  1. Run Linux Defender | Запустите Linux Defender:
# Check status | Проверить статус
uv run linux-defender status

# Health check | Проверка здоровья
uv run linux-defender health

# Start daemon | Запустить демон
uv run linux-defender daemon

📖 Usage | Использование

Basic Commands | Основные команды

# Check status of all modules | Проверить статус всех модулей
linux-defender status

# Detailed health check | Детальная проверка здоровья
linux-defender health

# Scan a path with ClamAV | Сканировать путь с ClamAV
linux-defender scan /home --module clamav

# Run security audit | Запустить аудит безопасности
linux-defender audit

# Update ClamAV databases | Обновить базы данных ClamAV
linux-defender update --module clamav

# Start/stop/restart modules | Запустить/остановить/перезапустить модули
linux-defender start --module fail2ban
linux-defender stop --module clamav
linux-defender restart --module fail2ban

Daemon Mode | Режим демона

Run Linux Defender as a background service | Запустите Linux Defender как фоновый сервис:

linux-defender daemon

Or install as a systemd service (see linux-defender.service.example) | Или установите как systemd сервис (см. linux-defender.service.example).

⚙️ Configuration | Конфигурация

Edit config.yaml to customize | Отредактируйте config.yaml для настройки:

  • Module enable/disable | Включение/отключение модулей
  • Scan schedules (cron format) | Расписания сканирования (формат cron)
  • Scan paths and exclusions | Пути сканирования и исключения
  • Notification settings (email/webhook/Telegram) | Настройки уведомлений (email/webhook/Telegram)
  • Module-specific settings | Специфичные настройки модулей

Setting up Telegram Notifications | Настройка Telegram уведомлений

  1. Create a Telegram bot | Создайте Telegram бота:

    • Message @BotFather on Telegram
    • Send /newbot and follow instructions
    • Save the bot token
  2. Get your chat ID | Получите ваш chat ID:

    • Send a message to your bot
    • Visit: https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates
    • Find your chat ID in the response
  3. Configure | Настройте:

    # Set environment variables | Установите переменные окружения
    export LINUX_DEFENDER__NOTIFICATIONS__TELEGRAM__BOT_TOKEN="your_bot_token"
    export LINUX_DEFENDER__NOTIFICATIONS__TELEGRAM__CHAT_ID="your_chat_id"
    
    # Or add to .env file | Или добавьте в .env файл
    echo 'LINUX_DEFENDER__NOTIFICATIONS__TELEGRAM__BOT_TOKEN="your_bot_token"' >> .env
    echo 'LINUX_DEFENDER__NOTIFICATIONS__TELEGRAM__CHAT_ID="your_chat_id"' >> .env
  4. Enable in config.yaml | Включите в config.yaml:

    notifications:
      telegram:
        enabled: true
        chat_id: "your_chat_id"  # Can be numeric ID or username

Daily Reports | Ежедневные отчеты

Linux Defender can send daily system and security status reports via Telegram | Linux Defender может отправлять ежедневные отчеты о статусе системы и безопасности через Telegram:

  • Automatic scheduling | Автоматическое планирование - Reports sent daily at configured time
  • Delayed execution | Отложенное выполнение - If server is off, report sends on next boot
  • Comprehensive information | Полная информация - System metrics, security status, module health

See INSTALL.md for detailed setup instructions | См. INSTALL.md для подробных инструкций по настройке.

See config.yaml.example for all available options | См. config.yaml.example для всех доступных опций.

📚 Documentation | Документация

🤝 Contributing | Участие в разработке

Contributions are welcome! | Вклад приветствуется!

Please read CONTRIBUTING.md for details | Пожалуйста, прочитайте CONTRIBUTING.md для деталей.

📝 License

This project is licensed under the MIT License - see the LICENSE file for details | Этот проект лицензирован под MIT License - см. файл LICENSE для деталей.

🙏 Acknowledgments | Благодарности

  • ClamAV team | Команда ClamAV
  • Fail2ban developers | Разработчики Fail2ban
  • Lynis project | Проект Lynis
  • All security tool maintainers | Все поддерживающие инструменты безопасности

Made with ❤️ for Linux security | Сделано с ❤️ для безопасности Linux

About

🛡️ Unified security management solution for Linux servers | Унифицированное решение для управления безопасностью Linux серверов

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published