SSG-143/linux-security-homelab

GitHub: SSG-143/linux-security-homelab

一个基于 Athena OS 的 Linux 安全家庭实验室项目,通过防火墙管理、用户权限控制和日志监控等实操配置展示蓝队安全防御与系统运维技能。

Stars: 0 | Forks: 0


███████╗███████╗ ██████╗    ██╗      █████╗ ██████╗

 ██╔════╝██╔════╝██╔════╝    ██║     ██╔══██╗██╔══██╗

 ███████╗█████╗  ██║         ██║     ███████║██████╔╝

 ╚════██║██╔══╝  ██║         ██║     ██╔══██║██╔══██╗

 ███████║███████╗╚██████╗    ███████╗██║  ██║██████╔╝

 ╚══════╝╚══════╝ ╚═════╝    ╚══════╝╚═╝  ╚═╝╚═════╝

# 🛡️ Linux 安全家庭实验室




[![OS](https://img.shields.io/badge/Athena%20OS-Arch%20Based-1793d1?style=for-the-badge&logo=archlinux&logoColor=white)](https://athenaos.org) [![Firewall](https://img.shields.io/badge/Firewall-Firewalld-e94560?style=for-the-badge&logo=linux&logoColor=white)]() [![Docker](https://img.shields.io/badge/Containers-Docker-2496ed?style=for-the-badge&logo=docker&logoColor=white)]() [![Cockpit](https://img.shields.io/badge/Admin%20UI-Cockpit-0078d4?style=for-the-badge&logo=linux&logoColor=white)]() [![SSH](https://img.shields.io/badge/Remote-SSH-4caf50?style=for-the-badge&logo=openssh&logoColor=white)]() [![Status](https://img.shields.io/badge/Status-Active-brightgreen?style=for-the-badge)]() [![Type](https://img.shields.io/badge/Type-Blue%20Team%20%2F%20Sysadmin-blueviolet?style=for-the-badge)]()
## 📖 概述 **Linux Security Homelab** 是一个个人网络安全和系统管理项目,通过将一台旧的 Linux 台式机改造成一个完全由自己管理、专注于安全的服务器环境而构建。 该机器最初运行的是 **Athena OS**(一个基于 Arch 的面向网络安全的发行版),并配备了完整的 **Hyprland** 桌面环境。后来它被转换为一个无头服务器 —— 配置了各项服务、管理了用户、编写了防火墙规则,并积极监控了日志。 这个项目反映了与**日志分析**、**Linux 系统管理员**和**蓝队**职位直接相关的实用技能。 ## 🛠️ 使用的技术
| 类别 | 技术 | 用途 | |----------|-----------|---------| | 🐧 **操作系统** | Athena OS (基于 Arch 的 Linux) | 专注于安全的发行版,滚动发布 | | 🌐 **服务器管理界面** | Cockpit | 基于浏览器的服务器管理和日志查看 | | 🔥 **防火墙** | Firewalld | 动态防火墙守护进程,基于区域的规则 | | 🐳 **容器** | Docker | 隔离的服务部署 | | ⚙️ **Init 系统** | Systemd | 服务生命周期和启动管理 | | 🔑 **远程访问** | SSH | 加密的终端访问 | | 📋 **日志工具** | Journalctl / /var/log | 系统和身份验证日志分析 |
## 🗺️ 项目架构 ``` ┌──────────────────────────────────┐ │ 🖥️ Athena OS Server │ │ │ Browser ────► │ 🌐 Cockpit Web UI (Port 9090) │ │ │ SSH ────────► │ 🔑 SSH Daemon (Port 22) │ │ │ │ 🐳 Docker Services │ │ └─ Containerized apps │ │ │ │ ⚙️ Systemd │ │ └─ Service management │ │ │ │ 📋 Log Monitoring │ │ ├─ journalctl │ │ └─ /var/log/ │ │ │ │ ════════════════════════════ │ │ 🔥 FIREWALLD (Active Gate) │ │ ✅ SSH allowed │ │ ✅ DHCPv6 allowed │ │ ❌ Everything else blocked │ └──────────────────────────────────┘ ``` ## 🎯 关键工作领域 ### 🔥 1. 防火墙管理 配置了 **Firewalld** —— 一个动态的、基于区域的防火墙守护进程 —— 来控制服务器上所有的入站和出站网络流量。 - 应用了**默认拒绝**策略:除非明确允许,否则所有端口均被阻止 - 管理了**区域**,为不同的网络接口定义信任级别 - 仅允许最低限度的必要服务:`SSH` 和 `DHCPv6` - 了解了 Firewalld 如何与底层的 Docker 网络和 iptables 链交互 ### 👥 2. 用户与权限管理 遵循最小权限原则,设置并管理了**用户、组和文件权限**。 - 创建了具有受限 Shell 访问权限和有限 sudo 权限的系统用户 - 配置了**文件和目录权限**(`chmod`、`chown`)以防止未经授权的访问 - 了解了普通用户、服务账户和 root 之间的区别 - 管理了哪些用户可以执行管理操作以及在什么条件下执行 ### 📊 3. 日志监控与分析 积极监控服务器的**系统和身份验证日志**,以识别可疑活动并了解什么是正常行为与异常行为。 - 使用 `journalctl` 按服务、时间范围和优先级查询 systemd 日志 - 审查了 `/var/log/auth.log` 及相关文件,查找失败的 SSH 登录和权限提升 - 使用 **Cockpit** 的内置日志查看器作为实时的基于浏览器的监控仪表板 - 学会了区分噪音(常规事件)和信号(潜在的安全事件) ### 🐳 4. Docker 与容器管理 在服务器上使用 **Docker** 容器部署并管理了各项服务。 - 拉取、配置并运行了容器化应用程序 - 管理了容器网络,并了解了 Docker 如何与宿主机防火墙交互 - 使用 **Systemd** 将 Docker 作为服务进行管理,并确保其在开机时启动 - 通过 CLI 和 Cockpit 管理正在运行的容器 ### 🌐 5. 通过 Cockpit 进行服务器管理 使用了 **Cockpit** —— 一个基于 Web 的 Linux 服务器管理工具 —— 作为日常服务器管理的主要界面。 - 实时监控 CPU、内存、磁盘和网络使用情况 - 通过 UI 管理服务(启动/停止/启用/禁用) - 无需在终端前即可审查系统日志 - 从浏览器管理存储和系统配置 ## 🔐 应用的安全原则 ``` ┌─────────────────────────────────────────────────────────┐ │ SECURITY PRINCIPLES │ ├──────────────────────┬──────────────────────────────────┤ │ Least Privilege │ Users and services get only │ │ │ the access they actually need │ ├──────────────────────┼──────────────────────────────────┤ │ Default Deny │ Firewall blocks everything │ │ │ unless explicitly permitted │ ├──────────────────────┼──────────────────────────────────┤ │ Visibility │ Logs monitored to detect and │ │ │ review suspicious activity │ ├──────────────────────┼──────────────────────────────────┤ │ Defense in Depth │ Multiple layers: firewall + │ │ │ permissions + monitoring │ └──────────────────────┴──────────────────────────────────┘ ``` ## 📂 仓库结构 ``` linux-security-homelab/ │ ├── 📄 README.md ← Project overview (you are here) │ ├── 🔥 firewall/ │ └── README.md ← Firewall rules & configuration walkthrough │ ├── 👥 users/ │ └── README.md ← User management & permission setup │ ├── 📊 logs/ │ └── README.md ← Log monitoring process & findings │ ├── 🐳 docker/ │ └── README.md ← Docker setup & container management │ └── 🌐 cockpit/ └── README.md ← Cockpit setup & administration notes ``` ## ✅ 展示的技能 ``` 🐧 Linux system administration on a real Arch-based machine 🔥 Firewall configuration and zone-based policy management 👥 User and group management with least-privilege principles 📊 System and authentication log monitoring and analysis 🐳 Docker container deployment and service management 🔑 SSH administration and remote server access 🌐 Web-based server administration via Cockpit 🛡️ Security hardening and blue-team thinking ```
*本项目是持续网络安全学习之旅的一部分。* *本仓库中的每个文件夹都记录了特定的工作领域,包括配置、使用的命令和发现。* [![Athena OS](https://img.shields.io/badge/Built%20on-Athena%20OS-1793d1?style=flat-square&logo=archlinux&logoColor=white)](https://athenaos.org) [![Blue Team](https://img.shields.io/badge/Focus-Blue%20Team%20%7C%20Hardening-blue?style=flat-square)]() [![Learning](https://img.shields.io/badge/Type-Homelab%20%7C%20Portfolio-orange?style=flat-square)]()
标签:内存分配, 家庭实验室, 系统运维, 网络安全, 请求拦截, 防火墙, 隐私保护