ids.alfacom.it/deployment/systemd/ids-auto-block.service
marco370 4d9ed22c39 Add automatic IP blocking system to enhance security
Implement a systemd timer and Python script to periodically detect and automatically block malicious IP addresses based on risk scores, improving the application's security posture.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 7a657272-55ba-4a79-9a2e-f1ed9bc7a528
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Event-Id: 05ab2f73-e195-4de9-a183-cd4729713b92
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/449cf7c4-c97a-45ae-8234-e5c5b8d6a84f/7a657272-55ba-4a79-9a2e-f1ed9bc7a528/31VdIyL
2025-11-25 11:52:13 +00:00

31 lines
750 B
Desktop File

[Unit]
Description=IDS Auto-Blocking Service - Detect and Block Malicious IPs
Documentation=https://github.com/yourusername/ids
After=network.target ids-ml-backend.service postgresql-16.service
Requires=ids-ml-backend.service
[Service]
Type=oneshot
User=ids
Group=ids
WorkingDirectory=/opt/ids
EnvironmentFile=/opt/ids/.env
# Esegui script auto-blocking (usa venv Python)
ExecStart=/opt/ids/python_ml/venv/bin/python3 /opt/ids/python_ml/auto_block.py
# Logging
StandardOutput=append:/var/log/ids/auto_block.log
StandardError=append:/var/log/ids/auto_block.log
SyslogIdentifier=ids-auto-block
# Security
NoNewPrivileges=true
PrivateTmp=true
# Timeout: max 3 minuti per detection+blocking
TimeoutStartSec=180
[Install]
WantedBy=multi-user.target