jackby03/hardbox

GitHub: jackby03/hardbox

hardbox 是一个用 Go 编写的交互式 Linux 服务器安全加固工具包,通过 TUI 界面和模块化设计帮助团队快速实现 CIS、PCI-DSS 等多框架合规,并提供干运行预览、一键回滚和审计报告功能。

Stars: 2 | Forks: 0

hardbox hero banner **专为 IT、Cloud、Infrastructure 和 Security 团队打造的终极 Linux 加固工具包。** [![Pre-release](https://img.shields.io/github/v/release/jackby03/hardbox?display_name=tag&include_prereleases&sort=semver&style=flat-square&label=pre-release&color=3b82f6)](https://github.com/jackby03/hardbox/releases) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square)](LICENSE) [![Go Version](https://img.shields.io/badge/Go-1.22+-00ADD8?style=flat-square&logo=go&logoColor=white)](go.mod) [![CIS Benchmarks](https://img.shields.io/badge/CIS-Level%201-2563EB?style=flat-square)](docs/COMPLIANCE.md) [![Build](https://img.shields.io/github/actions/workflow/status/jackby03/hardbox/quality-gates.yaml?style=flat-square&label=quality)](https://github.com/jackby03/hardbox/actions) [![Platforms](https://img.shields.io/badge/platform-Ubuntu%20%7C%20Debian%20%7C%20RHEL%20%7C%20Rocky%20%7C%20Amazon%20Linux-475569?style=flat-square)]() [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](CONTRIBUTING.md) [![Code of Conduct](https://img.shields.io/badge/conduct-Contributor%20Covenant-5865F2?style=flat-square)](CODE_OF_CONDUCT.md) [![ACS compatible](https://img.shields.io/badge/ACS-compatible%20v1.0-4CAF50?style=flat-square)](https://acs.jackby03.com)
## 什么是 hardbox? **hardbox** 是一个开源的、TUI 驱动的 Linux 服务器加固工具包,专为现代基础设施团队设计。它将复杂且易出错的 Linux 服务器安全加固过程转化为一个**引导式、可审计且可重复的工作流** —— 无论您是正在锁定云 VM、裸机服务器、Kubernetes 节点,还是开发者工作站。 它覆盖了安全堆栈的每一层:kernel 参数、SSH、防火墙、PAM、文件系统权限、审计日志、加密、服务加固,以及针对行业框架(CIS、NIST、STIG、PCI-DSS、ISO 27001)的完整合规性映射。 ## 为什么选择 hardbox? | 痛点 | hardbox 解决方案 | |:---|:---| | 加固工作手动、缓慢且不一致 | 具备 dry-run 和 rollback 功能的自动化模块 | | 脚本在不同发行版间中断 | 具备统一 API 的发行版感知引擎 | | 对变更内容缺乏可见性 | 完整审计追踪 + 结构化 HTML/JSON 报告 | | 合规性框架令人不知所措 | 内置配置文件:CIS L1、production、dev(路线图中将增加更多) | | 需要深厚的安全专业知识 | 现代 TUI —— 无需任何专业知识即可上手 | | 云环境有独特的要求 | 针对 AWS、GCP、Azure 的云原生配置文件(路线图中) | ## 核心功能 | 功能 | 描述 | |:---|:---| | **Modern TUI** | 交互式终端 UI (Bubble Tea)。导航、配置并应用加固,无需记忆命令 | | **Modular Architecture** | 独立启用或禁用任何模块。随意组合配置文件 | | **11 Built-in Profiles** | `cis-level1`、`cis-level2`、`pci-dss`、`stig`、`hipaa`、`iso27001`、`cloud-aws`、`cloud-gcp`、`cloud-azure`、`production`、`development` —— 路线图中将增加更多 | | **Dry Run Mode** | 在应用之前预览每一个确切的变更。可安全地在生产服务器上运行 | | **One-command Rollback** | 每次变更都会生成快照。立即还原任何模块或整个会话 | | **Audit Reports** | JSON、HTML 和 Markdown 输出 —— 机器可读且 CI/CD 友好 | | **Compliance Mapping** | 100+ 项检查映射到 CIS、NIST 800-53、STIG、PCI-DSS、HIPAA 和 ISO 27001 | | **Headless / CI Mode** | 通过配置文件进行无人值守运行 —— 支持 Ansible、Terraform、cloud-init、GitHub Actions | | **Distro-aware** | Ubuntu、Debian、RHEL、Rocky Linux、AlmaLinux、Amazon Linux、Fedora | ## 快速开始 ### 安装 ``` # 一键安装(自动检测 linux/amd64 或 linux/arm64) curl -fsSL https://hardbox.jackby03.com/install.sh | bash # 安装特定版本或预发布版本 curl -fsSL https://hardbox.jackby03.com/install.sh | HARDBOX_VERSION=v0.1.0 bash # 验证安装 hardbox --version ``` ### 使用 ``` # 启动交互式 TUI sudo hardbox # 审计您的系统 — 不进行任何更改 sudo hardbox audit --profile cis-level1 --format html --output ~/audit.html # 应用前预览所有更改(dry run) sudo hardbox apply --profile production --dry-run # 执行加固并生成报告 sudo hardbox apply --profile production --report ./hardbox-$(date +%Y%m%d).html # Headless / CI-CD 模式 sudo hardbox apply --config /etc/hardbox/config.yaml --non-interactive # 回滚上次会话 sudo hardbox rollback apply --last ```