Copy library / What got built / Grok Bot
A locked-down SSH user for the Grok Bot box over WireGuard
# 给 Grok Bot 云电脑开一个只走 WireGuard 的受限 SSH 账号 Source: https://github.com/carpenike/nix-config/pull/1354 Author: carpenike 这个 NixOS 配置 PR 在主机 forge 上新增无特权用户 grokbot,供作者的云端助理电脑登录:只接受来自 WireGuard 地址 10.8.0.4 的密钥登录,禁用密码和各类转发,不在 wheel 组,只能读普通用户可读的文件。配套 PR 只让该地址访问 forge 的 22 端口;合并前不生效。
- What it does
- This NixOS PR adds an unprivileged grokbot user on the host forge for the author’s cloud assistant box. It accepts key login only from WireGuard address 10.8.0.4, with no password and no forwarding, is not in wheel, and can read only what an ordinary user can. A companion PR lets that peer reach only forge:22. Nothing changes until merged.
- Scenarios
- Watch PRs / repos
- What the source covers
- Author & original linkYes
- What it doesYes
- Verbatim source excerptYes
- Screenshots / mediaNot in source
- Steps / chaptersYes
- Verbatim prompt / configNot in source
- Results / numbersNot in source
- Risk notesYes
- Related entriesYes
— means the source doesn't say; we don't fill it in.
- Verbatim source excerpt
feat(forge): add unprivileged grokbot SSH user restricted to WireGuard peer
## Purpose
Adds a dedicated, unprivileged SSH login on **forge** for Ryan's cloud assistant box. Goes with **carpenike/network-config#44**, which adds the WireGuard peer `10.8.0.4` and only lets it reach `forge:22`. This PR covers the host side: an account that can log in from that tunnel address and nowhere else.Show full post
**Not deployed.** Nothing changes on forge until this is merged and switched.
## Change (`hosts/forge/core/users.nix`)
```nix
users.users.grokbot = {
isNormalUser = true;
description = "Cloud assistant box (SSH via WireGuard 10.8.0.4)";
group = "grokbot";
extraGroups = [ ];
shell = pkgs.bash;
hashedPassword = "!"; # locked: no password login
openssh.authorizedKeys.keys = [
''from="10.8.0.4",no-agent-forwarding,no-X11-forwarding,no-port-forwarding ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC+/aS6swwQyZhz6lpazJj2BFhequRtAyJIHvjTvJN/w grokbot-box''
];
};
users.groups.grokbot = { };
```
## Decisions for Ryan
- **Username `grokbot`.** Rename it if you like. The username, group, and key comment are only used here.
- **No privilege by default.** The user is not in `wheel`, so the default `:wheel` doas rule doesn't apply, and the `nopass` doas rule covers only `ryan`. It has no service or admin groups. Its primary group is its own `grokbot`, not the shared `users` group, so it doesn't pick up anything group-readable by `users`.
- **Extent of access.** The user can read only what an ordinary non-root user can on forge: world-readable files and its own home. Service data dirs (`media` 0750, and so on) stay closed to it.
- Option, **not added**: putting it in `systemd-journal` would let it run `journalctl` for system logs. Add `"systemd-journal"` to `extraGroups` only if you want that.
## Key restrictions
- `from="10.8.0.4"`: sshd rejects the keycarpenike · · Open original ↗ From the project README, verbatim and untranslated.
- Steps / points from the source
- Highlights
- Repository Structure
- Architecture
- Operational Commands
- My Systems
- Services on Forge
- Observability Stack
- Backup Architecture
Verbatim from the source, untranslated.
- Prompt
The source does not include a prompt you can copy verbatim.
- How to copy
- Open the repo: github.com/carpenike/nix-config/pull/1354 ↗
- Read the README, send the repo link to your Bot and have it reproduce it
- Get it working small first, then add a routine
- Risks and limits
- Uses a browser or website login: the costliest kind of step, so prefer a connector where one exists
- The author's result may not reproduce for you; the original post is the reference
- Usage estimate
- Estimate with the metal calculator