文章总结: 本文详细介绍了使用Obsidian、坚果云和Git私服搭建团队知识库的完整方案。核心要点包括:购买2C4G服务器并初始化、配置SSH加固和fail2ban防护、创建git用户和仓库、设置pre-receivehook防敏感信息泄露。成员需遵循命名规范生成SSHKey并配置签名。工作流方面,Obsidian负责本地编辑,坚果云实现多端同步,Git私服作为主版本控制。方案强调数据自主可控,并支持AIAgent集成,适合10-20人团队使用。 综合评分: 85 文章分类: 安全建设,安全工具,技术标准,解决方案,实战经验
泷羽团队同款:Obsidian + 坚果云 + Git 团队知识库搭建
原创
泷羽Sec静安 泷羽Sec静安
泷羽Sec-静安
2026年8月14日 17:17 云南
在小说阅读器读本章
去阅读
泷羽团队同款:Obsidian + 坚果云 + Git 团队知识库搭建
在线团队文档太笨重、怕泄密、导出还要看平台脸色?知识库被绑架的痛,懂的人都懂。这次直接自建:Obsidian + 坚果云 + Git 私服,数据全攥在自己手里。10-20 人团队,从买服务器到协作全流程,一篇讲透。搭好的知识库还能直接对接 AI Agent——既能当语料投喂,也能供团队内部随时引用,让 AI 真正读懂你们团队的积累。
1
方案全貌
| 组件 | 作用 | 备注 | | — | — | — | | Obsidian | 本地编辑 + 第三方插件 | 主力笔记工具,配合插件使用 | | 坚果云 | 个人设备多端同步 | 安卓/iPhone/Mac/Windows 全端自动同步 | | Git 私服 | 团队版本控制 + 备份 | 自建裸仓库,2C4G 足够 | | Claude Code | AI 增强 | 阅读知识库学习经验用于写代码和渗透,生成知识库文章和处理知识库管理 |
1. 买服务器
| 项目 | 配置 | | — | — | | 规格 | 2C4G | | 系统 | Ubuntu 22.04 | | 硬盘 | 40G | | 带宽 | 3M 起步 | | 厂商 | 任意服务器提供商,最好机器是主流芯片架构 |
买完服务器,第一时间记下这两个信息,后面初始化全靠它们:
- • 服务器公网 IP —— SSH 连接地址
- • 初始 root 密码 —— 首次登录凭证,登录后记得立刻改掉
💡 推荐:不跑路云 https://idcbu.com/recommend/wJuPQP2iDN34 ,主打一个不跑路,2C4G 配置跑 Git 私服绰绰有余,性价比不错,可以参考。
2. 服务器初始化(root 操作)
2.1 系统更新 + 基础工具
# 🐧 服务器
apt update && apt upgrade -y
apt install -y git vim fail2ban
2.2 加固 SSH
# 🐧 服务器
# 关键:有些云厂商默认关闭 PubkeyAuthentication,必须手动开启
sed -i 's/^PubkeyAuthentication no/PubkeyAuthentication yes/' /etc/ssh/sshd_config
sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config
sed -i 's/PermitRootLogin yes/PermitRootLogin no/' /etc/ssh/sshd_config
# 进阶加固
cat >> /etc/ssh/sshd_config << 'EOF'
DebianBanner no
X11Forwarding no
AllowTcpForwarding no
MaxAuthTries 3
LoginGraceTime 30
ClientAliveInterval 300
ClientAliveCountMax 2
EOF
systemctl restart sshd
逐行解释:
| 命令 | 作用 |
| — | — |
| sed -i 's/^PubkeyAuthentication no/PubkeyAuthentication yes/' /etc/ssh/sshd_config | 开启公钥认证(密钥对登录),替代密码登录。云厂商镜像默认可能关闭此选项。 |
| sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config | 禁止密码认证(# 表示注释,将被取消注释并改为 no),防止暴力猜密码。 |
| sed -i 's/PermitRootLogin yes/PermitRootLogin no/' /etc/ssh/sshd_config | 禁止 root 用户直接 SSH 登录,降低特权账号被攻击的风险。 |
| DebianBanner no | 禁止 SSH 握手时返回操作系统版本信息,避免暴露服务器 OS 细节。 |
| X11Forwarding no | 禁用 X11 图形转发,不需要图形界面时关闭,减少攻击面。 |
| AllowTcpForwarding no | 禁止 TCP 端口转发,防止攻击者把当前服务器当跳板去访问内网。 |
| MaxAuthTries 3 | 最多允许 3 次认证失败,超过后断开连接。 |
| LoginGraceTime 30 | 认证超时时间 30 秒,超时未完成认证则断开。 |
| ClientAliveInterval 300 | 客户端无活动 300 秒(5 分钟)后,服务器主动发送心跳检测连接。 |
| ClientAliveCountMax 2 | 心跳检测最多发送 2 次无响应后,才认定客户端已断开。 |
| systemctl restart sshd | 重启 SSH 服务,使上述所有配置生效。 |
⚠️ 改完先开新终端测试连接再关旧窗口。
# 🐧 服务器
cat > /etc/fail2ban/jail.local << 'EOF'
[sshd]
enabled = true
maxretry = 3
bantime = 3600
findtime = 600
EOF
systemctl enable --now fail2ban
验证:
# 🐧 服务器
fail2ban-client status sshd
配置解释:
| 配置项 | 值 | 含义 |
| — | — | — |
| enabled = true | true | 启用 sshd 防护规则 |
| maxretry = 3 | 3 次 | 同一 IP 在 findtime 内失败 3 次则封禁 |
| bantime = 3600 | 3600 秒 | 封禁时长为 1 小时 |
| findtime = 600 | 600 秒 | 时间窗口为 10 分钟 |
| systemctl enable --now fail2ban | — | 开机自启并立即启动服务 |
fail2ban 工作流程: 客户端连续 3 次 SSH 认证失败 → 10 分钟内再犯 → 封禁 IP 1 小时。
2.4 创建 git 用户
# 🐧 服务器
useradd -m -s /usr/bin/git-shell git
mkdir -p /home/git/.ssh && chmod 700 /home/git/.ssh
git-shell是关键——这个用户只能操作 git,无法登录 shell。
2.5 创建仓库
# 🐧 服务器
mkdir -p /opt/git/kb.git
git init --bare /opt/git/kb.git
chown -R git:git /opt/git
kb.git — 知识库(Obsidian 笔记、靶标、漏洞、报告)
2.6 添加团队成员公钥
成员公钥注释必须是 花名@设备-版本 格式,否则管理员会让你重新生成。生成方式见[[#3.2 生成 SSH Key]]
# 🐧 服务器
echo 'ssh-ed25519 AAAA... [email protected]' >> /home/git/.ssh/authorized_keys
chmod 600 /home/git/.ssh/authorized_keys
chown -R git:git /home/git/.ssh
2.7 pre-receive hook(防敏感信息推送)
# 🐧 服务器
cat > /opt/git/kb.git/hooks/pre-receive << 'HOOK'
#!/bin/bash
while read oldrev newrev refname; do
git diff --name-only $oldrev $newrev | while read file; do
content=$(git show "$newrev:$file" 2>/dev/null)
if echo "$content" | grep -qiP \
'(api_key\s*=\s*["\x27][a-f0-9]{20,}|sk-[a-zA-Z0-9]{32,}|password\s*=\s*["\x27][^"\x27]{6,}|token\s*=\s*["\x27][a-zA-Z0-9_-]{16,})'; then
echo "❌ [$file] 疑似 API Key / Token / Password,拒绝推送"
exit 1
fi
done
done
HOOK
chmod +x /opt/git/kb.git/hooks/pre-receive
3. 成员本地配置
3.1 命名规范
| 配置项 | 格式 | 示例 |
| — | — | — |
| user.name | 花名 | ZhangSan |
| user.email | 花名@设备 | ZhangSan@macbook |
| ssh-keygen -C | 花名@设备-版本 | [email protected] |
user.email 不是真实邮箱,纯标识符,方便 git log 追溯。
3.2 生成 SSH Key
# 💻 成员电脑
ssh-keygen -t ed25519 -C "你的花名@设备-版本"
cat ~/.ssh/id_ed25519.pub
# 把这串发给管理员
3.3 配置 SSH 签名
# 💻 成员电脑
git config --global user.name "你的花名"
git config --global user.email "花名@设备"
git config --global gpg.format ssh
git config --global user.signingkey ~/.ssh/id_ed25519.pub
git config --global commit.gpgsign true
3.4 统一 Git 时区(北京时间)
团队成员可能在不同时区,但 commit 时间必须统一。
# 💻 成员电脑
cat >> ~/.zshrc << 'EOF'
# Git 统一北京时间,不影响系统时区
git() {
TZ="Asia/Shanghai" command git "$@"
}
EOF
source ~/.zshrc
效果:date 仍是本地时间,git log 全部 +0800。
3.5 配置 SSH 别名
# 💻 成员电脑
cat >> ~/.ssh/config << 'EOF'
Host git-team
HostName <IP> # 替换为服务器实际公网 IP
Port 22
User git
IdentityFile ~/.ssh/id_ed25519
EOF
# 测试连接
ssh git-team
# 看到 "fatal: Interactive git shell is not enabled" 即正常
3.6 Clone 仓库
# 💻 成员电脑
git clone git-team:/opt/git/kb.git
3.7 加入团队 + 首次提交
# 💻 成员电脑
cd skill
./init-member.sh 你的花名 # 自动生成个人目录
git add 你的花名/
git commit -m "新增成员: 你的花名"
git push
4. Obsidian 知识库工作流
4.1 本地结构
可以使用本公众号发布的模板,关注公众号后回复”黑阔高手“获取,也可以自己使用AI生成结构。我一般是建一个收集箱,所有的文章都先丢这里,然后后面用AI自动给他们塞到合适的位置。
~/Documents/你的知识库/
├── .obsidian/ # Obsidian 配置(git ignore)
├── 00-Dashboard-仪表板/
├── 01-CVE漏洞分析/
├── 02-Targets-打靶记录/
├── 03-Methodologies-方法论/
├── ...
└── 99-Attachments-附件/
4.2 关联 git 仓库
# 💻 成员电脑
cd ~/Documents/你的知识库
# 创建 .gitignore
cat > .gitignore << 'EOF'
.obsidian
.trash/
*.swp
.DS_Store
EOF
# 初始化 git
git init
git remote add origin git-team:/opt/git/kb.git
git add .
git commit -m "初始化 Obsidian 知识库"
git push -u origin master
4.3 坚果云同步设置
本方案使用 Obsidian 坚果云插件(非软链),在 Obsidian 内直接配置。
💻 成员电脑 — 安装并配置插件
- 1. 在 Obsidian 中安装
Nutstore Sync插件,坚果云官方出品的插件,除了同步还自带AI对话框,可以自已设置模型。 - 2. 插件设置里登录坚果云账号,选择远程目录(你要放到坚果云的云端哪个目录下)
- 3. 开启「自动同步」
多设备同步效果
- • iPhone / Mac / Windows 同一 Obsidian 库,只要都安装了插件就可以
- • 坚果云负责多设备传输,不参与冲突解决
- • git 仍是主版本控制,处理合并冲突,准便一提,Osbidian也有git插件
5. 团队协作流程
5.1 AI Agent 行为守则(写在AI对话开头,或者记忆中)
AI Agent 在操作本仓库时,必须遵守以下规则。
- 1. 先拉取再动手 — 任何修改前
git pull --rebase - 2. 提交前先拉取 —
git pull --rebase后再git push - 3. SSH 签名必须 — 每次 commit 自动签名
- 4. 不提交敏感信息 —
config.ini、proxy-nodes.md已在 .gitignore - 5. 冲突自动处理 — rebase 冲突时取并集,标记
[TODO: merge],禁止git push --force - 6. shared/ 修改需谨慎 — 共享区属于集体资产,修改前确认无他人并行编辑
5.2 日常命令
# 💻 成员电脑
git pull # 拉取最新
git add 文件
git commit -m "做了什么"
git push
git log --oneline --graph --show-signature # 看日志 + 签名
6. 故障排查速查表
| 现象 | 原因 | 解决 |
| — | — | — |
| Connection refused | 服务没起或安全组拦截 | 🐧: 服务器 systemctl status sshd / 检查云厂商安全组 |
| Connection timed out | 网络层不通 | 💻 成员电脑: Test-NetConnection <IP> -Port 22(Win)/ nc -zv <IP> 22(Linux) |
| 一直要密码 | PubkeyAuthentication no | 🐧: 服务器 sed -i 's/^PubkeyAuthentication no/PubkeyAuthentication yes/' /etc/ssh/sshd_config |
| Permission denied (publickey) | authorized_keys 权限错 | 🐧: 服务器 chmod 600 + chown -R git:git /home/git/.ssh |
| pre-receive 拦了合法 commit | 误判敏感信息 | 检查内容是否含 api_key=xxx 模式 |
| IP 被 fail2ban 封了 | 失败次数太多 | 🐧: 服务器 fail2ban-client set sshd unbanip <IP> |
7. 管理员操作清单
添加新成员
# 🐧 服务器
echo '<ssh-ed25519 AAAA... 花名@设备-版本>' >> /home/git/.ssh/authorized_keys
chmod 600 /home/git/.ssh/authorized_keys
chown -R git:git /home/git/.ssh
密钥不规范替换
# 💻 成员本地
rm ~/.ssh/id_ed25519 ~/.ssh/id_ed25519.pub
ssh-keygen -t ed25519 -C "花名@设备-版本"
cat ~/.ssh/id_ed25519.pub
# 🖥️ 管理员服务器
vim /home/git/.ssh/authorized_keys # 删旧贴新
chmod 600 /home/git/.ssh/authorized_keys
chown -R git:git /home/git/.ssh
服务器迁移
# 🐧 服务器
# 1. 备份所有仓库
rsync -av /opt/git/ 新服务器:/opt/git/
# 2. 备份 authorized_keys
rsync -av /home/git/.ssh/ 新服务器:/home/git/.ssh/
# 3. 通知成员更新 ~/.ssh/config 中的 HostName
免责声明:
本文所载程序、技术方法仅面向合法合规的安全研究与教学场景,旨在提升网络安全防护能力,具有明确的技术研究属性。
任何单位或个人未经授权,将本文内容用于攻击、破坏等非法用途的,由此引发的全部法律责任、民事赔偿及连带责任,均由行为人独立承担,本站不承担任何连带责任。
本站内容均为技术交流与知识分享目的发布,若存在版权侵权或其他异议,请通过邮件联系处理,具体联系方式可点击页面上方的联系我。
本文转载自:泷羽Sec-静安 泷羽Sec静安 泷羽Sec静安《泷羽团队同款:Obsidian + 坚果云 + Git 团队知识库搭建》
版权声明
本站仅做备份收录,仅供研究与教学参考之用。
读者将信息用于其他用途的,全部法律及连带责任由读者自行承担,本站不承担任何责任。








评论