This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Filebeat configuration for container log aggregation | |
| # Ship container logs to Wazuh for centralized monitoring | |
| # Tags: container-security, logging, wazuh, filebeat | |
| filebeat.inputs: | |
| - type: container | |
| paths: | |
| - /var/lib/docker/containers/*/*.log | |
| processors: | |
| - add_docker_metadata: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Docker Bench Security | |
| git clone https://github.com/docker/docker-bench-security.git | |
| cd docker-bench-security | |
| sudo sh docker-bench-security.sh | |
| # Kubernetes kube-bench | |
| kubectl apply -f https://raw.githubusercontent.com/aquasecurity/kube-bench/main/job.yaml | |
| kubectl logs job/kube-bench |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Docker Compose for isolated AI environment | |
| # Provides network isolation and resource limits for AI experiments | |
| services: | |
| ai-sandbox: | |
| image: pytorch/pytorch:latest | |
| container_name: ai-experiment | |
| networks: | |
| - ai-isolated | |
| volumes: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Dream Machine Professional firewall rules for AI VLAN | |
| # Network segmentation for AI workloads | |
| # AI VLAN Configuration | |
| AI_VLAN="10.0.50.0/24" | |
| INTERNAL_REPO="10.0.10.5" | |
| # Allow: AI VLAN -> Internal model repository | |
| iptables -A FORWARD -s $AI_VLAN -d $INTERNAL_REPO -j ACCEPT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import torch | |
| import hashlib | |
| from pathlib import Path | |
| from typing import Optional | |
| class SecureModelLoader: | |
| """Verify model integrity before loading.""" | |
| def __init__(self, trusted_hashes_file: str = "model_hashes.txt"): | |
| self.trusted_hashes = self._load_trusted_hashes(trusted_hashes_file) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import re | |
| from typing import List | |
| class PromptSecurityFilter: | |
| """Detect and block prompt injection attempts.""" | |
| def __init__(self): | |
| self.blocked_patterns = [ | |
| r"ignore previous instructions", | |
| r"disregard all prior", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Suricata Custom Detection Rules | |
| # Location: /etc/suricata/rules/custom-local.rules | |
| # Purpose: Custom rules for port scanning, DNS anomalies, C2, and exfiltration detection | |
| # ============================================================================ | |
| # Port Scan Detection | |
| # ============================================================================ | |
| # Detect Nmap SYN scan | |
| alert tcp any any -> $HOME_NET any (msg:"SCAN Nmap SYN scan detected"; flags:S,12; threshold: type threshold, track by_src, count 20, seconds 10; classtype:attempted-recon; sid:1000001; rev:1;) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Suricata IDS/IPS Installation and Initial Configuration | |
| # For Ubuntu 24.04 - Homelab Network Traffic Analysis Setup | |
| # ============================================================================ | |
| # Installation | |
| # ============================================================================ | |
| # Install on Ubuntu 24.04 | |
| sudo add-apt-repository ppa:oisf/suricata-stable |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import psutil | |
| import GPUtil | |
| import logging | |
| from datetime import datetime | |
| from typing import List, Dict | |
| logger = logging.getLogger(__name__) | |
| class AIResourceMonitor: | |
| """Monitor AI workload resource usage and detect anomalies.""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Suricata Advanced Detection with Lua Scripts | |
| -- Location: /etc/suricata/lua/http-anomaly.lua | |
| -- Purpose: Complex HTTP anomaly detection using Lua scripting | |
| -- ============================================================================ | |
| -- HTTP Anomaly Detection Script | |
| -- ============================================================================ | |
| function init(args) | |
| local needs = {} |
NewerOlder