Skip to content

Security: Anton-Babaskin/Docker-WireGuard-Monitor

Security

SECURITY.md

πŸ›‘οΈ Security Policy

πŸ“‹ Supported Versions

We actively support and provide security updates for the following versions:

Version Supported Status
2.0.x βœ… Yes Current
1.x ❌ No End of Life

🚨 Reporting a Vulnerability

Please do not report security vulnerabilities through public GitHub issues.

Reporting Process

  1. Email: Send details to security@example.com (replace with actual email)
  2. Subject: Include "WireGuard Monitor Security Issue" in the subject line
  3. Details: Include as much information as possible (see template below)
  4. Response: We will respond within 48 hours

Security Report Template

Subject: WireGuard Monitor Security Issue - [Brief Description]

**Summary**: 
Brief description of the vulnerability

**Impact**: 
What could an attacker accomplish?

**Reproduction Steps**:
1. Step one
2. Step two
3. Step three

**Environment**:
- OS and version
- WireGuard Monitor version
- Docker version
- Any relevant configuration

**Proof of Concept**:
(If applicable, include PoC code or screenshots)

**Suggested Fix**:
(If you have ideas for fixing the issue)

Response Timeline

  • Initial Response: Within 48 hours
  • Investigation: 1-7 days depending on complexity
  • Fix Development: 7-30 days
  • Coordinated Disclosure: After fix is available

πŸ”’ Security Measures

Current Security Features

Configuration Security

  • βœ… Secure file permissions (600) for config files
  • βœ… Root-only access to sensitive files
  • βœ… Input validation for all configuration parameters
  • βœ… No hardcoded secrets in code

Runtime Security

  • βœ… Process isolation with systemd security features
  • βœ… Minimal privileges (NoNewPrivileges=true)
  • βœ… Protected system directories
  • βœ… Secure temporary file handling

Communication Security

  • βœ… HTTPS-only communication with Telegram API
  • βœ… TLS certificate validation
  • βœ… No sensitive data in logs
  • βœ… Secure error message handling

Docker Integration Security

  • βœ… Read-only Docker socket access where possible
  • βœ… Container isolation respect
  • βœ… No privileged container operations
  • βœ… Secure command execution

⚠️ Known Security Considerations

Bot Token Security

  • Risk: Telegram bot tokens provide full access to your bot
  • Mitigation: Store tokens securely with 600 permissions, rotate regularly
  • Best Practice: Use dedicated monitoring-only bot, not personal bot

Container Access

  • Risk: Script requires Docker socket access to monitor containers
  • Mitigation: Run with minimal necessary privileges
  • Best Practice: Consider read-only Docker access where possible

Log File Security

  • Risk: Logs may contain sensitive information
  • Mitigation: Logs are protected with proper file permissions
  • Best Practice: Regular log rotation and secure log storage

πŸ› οΈ Security Best Practices

For System Administrators

Installation Security

# Secure installation permissions
sudo chmod 600 /etc/telemon.env
sudo chown root:root /etc/telemon.env
sudo chmod 644 /var/log/wg-monitor.log
sudo chown root:adm /var/log/wg-monitor.log

Bot Token Management

  • Create dedicated bot for monitoring only
  • Limit bot permissions to send messages only
  • Regularly rotate bot tokens
  • Monitor bot usage in @BotFather

Network Security

  • Ensure firewall allows HTTPS (443) for Telegram API
  • Monitor network traffic to api.telegram.org
  • Consider using Telegram Bot API on local server

File System Security

# Check file permissions
ls -la /etc/telemon.env
ls -la /usr/local/bin/wg_telemon.sh
ls -la /var/log/wg-monitor.log

# Audit configuration
sudo /usr/local/bin/wg_telemon.sh --test

For Developers

Code Security Guidelines

  • Always validate input parameters
  • Use parameterized commands, avoid shell injection
  • Implement proper error handling
  • Never log sensitive information
  • Follow principle of least privilege

Configuration Handling

# βœ… Good - Secure variable handling
if [[ -n "${BOT_TOKEN:-}" ]]; then
    # Use token securely
fi

# ❌ Bad - Insecure variable usage
echo "Token: $BOT_TOKEN"

πŸ” Security Audit Checklist

Pre-deployment Security Review

  • Configuration files have proper permissions (600)
  • No hardcoded secrets in scripts or configs
  • Input validation for all user-provided data
  • Error messages don't reveal sensitive information
  • Log files are properly secured and rotated
  • Network communication uses encryption (HTTPS)
  • File operations use secure temporary files
  • Process execution follows least privilege principle

Runtime Security Monitoring

  • File permission changes monitored
  • Unusual network activity logged
  • Failed authentication attempts tracked
  • Configuration changes audited
  • Docker socket access monitored
  • Telegram API errors investigated

πŸ“Š Vulnerability Disclosure Timeline

Recent Security Updates

Version 2.0.0 (August 2024)

  • βœ… Added comprehensive input validation
  • βœ… Implemented secure configuration file handling
  • βœ… Enhanced systemd security features
  • βœ… Improved error message security
  • βœ… Added process isolation features

Planned Security Enhancements

Version 2.1.0

  • πŸ”„ Configuration encryption at rest
  • πŸ”„ Enhanced audit logging
  • πŸ”„ Rate limiting for API calls
  • πŸ”„ Additional input validation

πŸ† Security Recognition

Hall of Fame

We recognize security researchers who responsibly disclose vulnerabilities:

No vulnerabilities reported yet - be the first to help improve security!

Bounty Program

Currently no formal bounty program, but we recognize contributions:

  • Public acknowledgment in security advisories
  • GitHub contributor badge for security improvements
  • Priority support for security-focused contributors

πŸ“ž Security Resources

External Resources

Security Tools

  • ShellCheck - Static analysis for shell scripts
  • Docker Bench - Docker security benchmark
  • Lynis - Linux security auditing
  • CIS Benchmarks - Security configuration guides

πŸ“ Security Contact

  • Security Email: [Create a security@yourdomain email]
  • GPG Key: [Consider adding a GPG key for encrypted reports]
  • Response Team: Project maintainers
  • Escalation: For critical issues requiring immediate attention

Last Updated: August 2024
Next Review: November 2024

This security policy will be updated as the project evolves and new security features are implemented.

There aren't any published security advisories