Welcome to InfraNinja! π This project contains a comprehensive set of PyInfra deployments π₯· used by Kalvad teams π οΈ, making them publicly available for everyone via PyPI! π
These ninja-level deployments are designed to simplify infrastructure management and automate common tasks, helping you deploy services, configure security hardening, manage inventory, and more β fast and effortlessly! π¨
- π Automated Deployments: Deploy services like Netdata with precision and ease! π₯·
- π‘οΈ Comprehensive Security: Advanced security hardening including SSH configuration, kernel hardening, firewall setup, malware detection, and intrusion detection systems
- π§© Modular Architecture: Reusable deployment modules organized by OS (Ubuntu, Alpine, FreeBSD) and functionality
- π Dynamic Inventory: Integration with Jinn API and Coolify for automated server inventory management
- π οΈ Multi-OS Support: Compatible with Ubuntu, Alpine Linux, and FreeBSD
- π Compliance Ready: Includes UAE IA compliance modules
- π¦ PyPI Ready: Available publicly on PyPI for smooth installation
To get started with InfraNinja, you can install it directly from PyPI:
pip install infraninja
Then, bring ninja-style automation to your infrastructure with simple imports:
from infraninja.netdata import deploy_netdata
Deploy Netdata monitoring like a ninja π₯·:
from infraninja.netdata import deploy_netdata
deploy_netdata()
Comprehensive security hardening across different OS types:
# SSH Hardening
from infraninja.security.common.ssh_hardening import ssh_hardening
ssh_hardening()
# Kernel Security
from infraninja.security.common.kernel_hardening import kernel_hardening
kernel_hardening()
# Firewall Setup (Ubuntu)
from infraninja.security.ubuntu.fail2ban_setup import fail2ban_setup
fail2ban_setup()
# For Alpine Linux
from infraninja.security.alpine.fail2ban_setup import fail2ban_setup_alpine
fail2ban_setup_alpine()
Use Jinn API for dynamic server inventory:
from infraninja.inventory.jinn import Jinn
# Initialize with API credentials
jinn = Jinn(
api_url="https://jinn-api.kalvad.cloud",
api_key="your-api-key",
groups=["production", "web"],
tags=["nginx", "database"]
)
# Get filtered servers
servers = jinn.get_servers()
Use Coolify for container management:
from infraninja.inventory.coolify import Coolify
coolify = Coolify(
api_url="https://coolify.example.com/api",
api_key="your-api-key",
tags=["prod", "staging"]
)
servers = coolify.get_servers()
InfraNinja provides comprehensive deployment modules organized by functionality:
- Netdata: Real-time performance monitoring and alerting
- SSH Hardening: Secure SSH configuration with multiple security options
- Kernel Hardening: System-level security hardening
- Firewall Management: IPTables and NFTables configuration
- Network Security: ARP poisoning protection, secure routing controls
- Audit & Compliance: System auditing, UAE IA compliance modules
- Fail2Ban: Intrusion prevention system
- AppArmor: Mandatory access controls
- ClamAV: Antivirus scanning
- Lynis: Security auditing tool
- Suricata: Network threat detection
- Chkrootkit: Rootkit detection
- Fail2Ban: Lightweight intrusion prevention
- ClamAV: Antivirus for Alpine
- Suricata: IDS for Alpine systems
- Security Tools: Alpine-optimized security utilities
- Jinn Integration: Dynamic inventory management via Jinn API
- Coolify Integration: Container orchestration platform integration
- SSH Key Management: Automated SSH key deployment and management
- System Updates: Multi-distribution package updates
- MOTD Customization: Dynamic message of the day
- Template System: Jinja2 templates for configuration files
Want to add your own ninja-style improvements? Here's how to get started:
git clone https://github.com/KalvadTech/infraninja.git
cd infraninja
pip install -r requirements.txt
Test your deployments locally using PyInfra:
# Test with local inventory
pyinfra @local your_deployment.py
# Test with dynamic inventory
pyinfra inventory.py your_deployment.py
# Test specific modules
pyinfra @vagrant/ubuntu infraninja.security.common.ssh_hardening
# Run all tests
pytest
# Run specific test modules
pytest tests/inventory/
pytest tests/common/
# Run with coverage
pytest --cov=infraninja tests/
Create a distribution package:
python -m build
The project includes a Vagrant-based test environment in the deploy/
directory:
cd deploy
vagrant up
vagrant ssh ubuntu # or vagrant ssh alpine
- Current Version: 0.2.1
- Python Support: >=3.8
- License: MIT License
- Stability: Production Ready
Contributions are welcome! π If you spot any bugs π or have ideas π‘ for cool new features, feel free to open an issue or submit a pull request. The ninja squad would love to collaborate! π€
- Mohammad Abu-khader π₯· [email protected]
- LoΓ―c Tosser π₯·
- The skilled ninja team at KalvadTech π οΈ
- Repository: GitHub - KalvadTech/infraninja
- Issues: Report bugs and request features
- Discussions: Share your ninja deployments with the community
This project is licensed under the MIT License. π Feel free to use it, modify it, and become an infrastructure ninja yourself! π₯·
Stay stealthy and keep deploying like a ninja! π₯·π¨π