Skip to content

ZalPika/homelab-scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Homelab Scripts

A curated collection of production-ready automation scripts for homelab infrastructure management. These scripts handle security, backup, monitoring, and system administration tasks in a home server environment.

Overview

This repository contains battle-tested scripts developed through real-world homelab operations, focusing on:

  • Security-first design - Multi-layered protection and validation
  • Automation - Reduce manual intervention and human error
  • Monitoring - Real-time visibility into system health
  • Reliability - Comprehensive error handling and logging
  • Documentation - Clear setup guides and usage examples

Perfect for homelabbers, self-hosters, and IT professionals building personal infrastructure.


📂 Repository Structure

homelab-scripts/
├── security/
│   └── malware-detection/        # Multi-layered download protection
├── backup/
│   └── proxmox/                   # System configuration backups
├── monitoring/
│   └── swiftbar/                  # macOS menu bar plugins
└── docs/                          # Additional documentation

Security Scripts

A comprehensive three-layer security system for safely handling downloaded files.

Architecture:

Download → ClamAV Scan → File Type Validation → Manual Approval → Media Library
              ↓              ↓                        ↓
         Quarantine     Quarantine              Final Storage

Features:

  • ✅ ClamAV antivirus integration with automatic quarantine
  • ✅ MIME type and extension validation
  • ✅ macOS GUI for manual file approval
  • ✅ Real-time monitoring via SwiftBar menu bar
  • ✅ Comprehensive logging and audit trail

Scripts:

  • scan-torrents.sh - ClamAV malware scanning with auto-quarantine
  • verify-filetypes.sh - File type validation and suspicious file detection
  • approve-and-move.sh - macOS GUI for manual approval and destination selection
  • approve-downloads.30s.sh - SwiftBar plugin for status monitoring

Use Case: Safe media downloads in homelab with qBittorrent, Plex, or similar services.

→ Read full documentation


Backup Scripts

Automated backup of critical Proxmox VE host configuration files with rotation.

Features:

  • ✅ Backs up network, storage, and Proxmox configurations
  • ✅ Includes SSH keys, cron jobs, and custom scripts
  • ✅ Compressed archives with date stamps
  • ✅ Automatic rotation (keeps last 4 backups)
  • ✅ Package list for easy system restoration

Scripts:

  • backup-proxmox-host.sh - Complete host configuration backup

Backed Up:

  • Network configuration (/etc/network/interfaces, /etc/hosts)
  • Storage mounts (/etc/fstab)
  • Proxmox settings (/etc/pve/*)
  • User data (/etc/passwd, /etc/shadow, /etc/group)
  • Automation (cron.d, custom scripts)
  • Package selections (for reinstallation)

Use Case: Disaster recovery and system migration for Proxmox hosts.

→ Read full documentation


Monitoring Scripts

macOS menu bar integrations for real-time homelab monitoring.

Features:

  • ✅ Real-time file count and security status
  • ✅ Visual indicators (🟢 OK, 🟡 Pending, 🔴 Alert)
  • ✅ Quick actions from menu bar
  • ✅ Auto-refresh every 30 seconds
  • ✅ Direct links to web interfaces

Scripts:

  • approve-downloads.30s.sh - Download approval status and quick actions

Use Case: Monitor remote server status directly from macOS menu bar.

→ Read full documentation


Quick Start

Prerequisites

Server Side (Linux):

  • Debian/Ubuntu-based system
  • SSH server with key authentication
  • ClamAV (for security scripts)
  • Standard Unix utilities (file, tar, rsync)

Client Side (macOS):

  • SSH key configured for passwordless access
  • SwiftBar (for monitoring plugins)
  • Network/VPN access to server

Basic Installation

# Clone repository
git clone https://github.com/ZalPika/homelab-scripts.git
cd homelab-scripts

# Choose a category
cd security/malware-detection

# Read category-specific README
cat README.md

# Follow installation instructions for your use case

Each script category has detailed setup instructions in its own README.


Tech Stack

Languages & Tools

  • Bash/zsh - Core scripting language
  • SSH - Remote automation and management
  • Git - Version control

Security

  • ClamAV - Antivirus scanning
  • MIME detection - File type validation
  • Quarantine system - Isolated suspicious files

Infrastructure

  • Proxmox VE - Virtualization platform
  • LXC containers - Lightweight virtualization
  • Linux - Server operating system

Integration

  • macOS - Client-side GUI and monitoring
  • SwiftBar - Menu bar plugins
  • AppleScript - macOS automation

Common Use Cases

Media Server Homelab

qBittorrent → Security Scripts → Plex/Jellyfin
                    ↓
              Malware Protection

Safe downloading with automated malware scanning and manual approval.

Proxmox Infrastructure

Daily Cron → Backup Scripts → External Storage
                  ↓
          Configuration Safety Net

Automated backups for disaster recovery and system migration.

Remote Monitoring

Server Status → SwiftBar Plugin → macOS Menu Bar
                      ↓
              Real-time Visibility

Monitor homelab health from your Mac without opening terminal.


Learning Objectives

This repository demonstrates:

System Administration

  • Automated security workflows
  • Backup strategies and rotation
  • Log management and monitoring
  • Service integration

Security Practices

  • Defense-in-depth architecture
  • Malware detection and quarantine
  • File validation techniques
  • Audit trails and logging

Scripting Skills

  • Bash/zsh automation
  • Error handling and validation
  • Cross-platform integration (Linux + macOS)
  • Modular script design

DevOps Concepts

  • Infrastructure as code
  • Automation pipelines
  • Monitoring and alerting
  • Configuration management

Perfect for demonstrating practical IT skills to potential employers.


Documentation

Each script category includes:

  • README.md - Overview and quick start
  • Installation guide - Step-by-step setup
  • Configuration examples - Sample configs
  • Troubleshooting - Common issues and solutions
  • Usage examples - Real-world workflows

Security Considerations

Best Practices Implemented

  • ✅ No hardcoded credentials (use SSH keys)
  • ✅ Principle of least privilege
  • ✅ Comprehensive logging for audit trails
  • ✅ Quarantine before execution
  • ✅ Manual approval for critical operations

What These Scripts Don't Do

  • ❌ Replace professional security solutions
  • ❌ Guarantee 100% malware detection
  • ❌ Handle all edge cases automatically
  • ❌ Provide warranty or liability coverage

Use at your own risk. Always:

  • Test in non-production first
  • Keep software updated
  • Review logs regularly
  • Maintain additional security layers (firewall, VPN, network segmentation)

Contributing

This is a personal homelab repository, but feedback and suggestions are welcome!

How to Contribute

  1. Open an issue for bugs or feature requests
  2. Share your own script variations
  3. Suggest improvements to documentation
  4. Report security vulnerabilities privately

Contribution Guidelines

  • Follow existing code style
  • Include documentation for new scripts
  • Test thoroughly before submitting
  • Explain the problem your script solves

Roadmap

Planned Additions

  • Network automation scripts (VLAN management, firewall rules)
  • Container management (LXC automation, Docker cleanup)
  • Monitoring extensions (Telegram/Discord notifications)
  • Backup enhancements (LXC container backups, verification)
  • Documentation improvements (video tutorials, diagrams)

Future Categories

  • network/ - Network configuration and automation
  • containers/ - LXC and Docker management
  • notifications/ - Alert systems and integrations
  • utilities/ - General-purpose homelab tools

Statistics

Category Scripts Lines of Code Documentation
Security 4 ~280 Comprehensive
Backup 1 ~50 Complete
Monitoring 1 ~65 Complete
Total 6 ~395 ~850 lines

Portfolio Use

This repository showcases real-world IT skills relevant to:

Job Roles:

  • System Administrator
  • DevOps Engineer
  • Security Operations
  • IT Infrastructure
  • Automation Engineer
  • Site Reliability Engineer (SRE)

Key Competencies Demonstrated:

  • Shell scripting and automation
  • Security-first thinking
  • Cross-platform integration
  • Documentation and knowledge sharing
  • Problem-solving with practical solutions
  • Infrastructure management

Perfect for linking in your CV, LinkedIn, or job applications.


License

MIT License - See LICENSE file for details.

Free to use, modify, and distribute with attribution.


Acknowledgments

These scripts were developed through practical homelab experience, combining:

  • Real-world security requirements
  • Community best practices
  • Trial-and-error learning
  • Professional IT standards

Inspired by the homelab community and the need for reliable, documented automation.


Contact & Support

  • GitHub Issues: For bugs and feature requests
  • Discussions: For questions and sharing experiences
  • Security Issues: Report privately via GitHub security advisories

Star This Repo

If you find these scripts useful, consider:

  • ⭐ Starring the repository
  • 🔗 Sharing with other homelabbers
  • 💬 Opening discussions about your use cases
  • 🤝 Contributing your own improvements

Built with ❤️ for the homelab community

Making home infrastructure secure, automated, and maintainable.

Packages

 
 
 

Contributors

Languages