Compare commits
2
Commits
64560b37ae
...
1ceeca785f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1ceeca785f | ||
|
|
df77c3ef6f |
No files matched your search
+10
-1
@@ -13,7 +13,7 @@ The shell environment is modularized:
|
|||||||
- `jump.sh`: Directory navigation and quick jumping.
|
- `jump.sh`: Directory navigation and quick jumping.
|
||||||
- `pdf.sh`: PDF compilation, viewing, and OCR helpers.
|
- `pdf.sh`: PDF compilation, viewing, and OCR helpers.
|
||||||
- `quicklinks.sh`: Shortcuts to primary project directories.
|
- `quicklinks.sh`: Shortcuts to primary project directories.
|
||||||
- `secrets.sh`: SOPS secret retrieval and Wayland clipboard extraction (`gh-token`).
|
- `secrets.sh`: SOPS secret retrieval (`gh-token` clipboard utility, transparent `flarectl` and `hostinger` process wrappers).
|
||||||
- `todo.sh`: Lightweight terminal task tracking.
|
- `todo.sh`: Lightweight terminal task tracking.
|
||||||
- `wayland.sh`: Wayland session environment variables and clipboard helpers.
|
- `wayland.sh`: Wayland session environment variables and clipboard helpers.
|
||||||
|
|
||||||
@@ -39,6 +39,15 @@ The shell environment is modularized:
|
|||||||
| `gl` | `git log --oneline --graph --decorate` | Compact visual commit graph. |
|
| `gl` | `git log --oneline --graph --decorate` | Compact visual commit graph. |
|
||||||
| `ght` | `gh-token` | Copy GitHub repo token from SOPS into Wayland clipboard. |
|
| `ght` | `gh-token` | Copy GitHub repo token from SOPS into Wayland clipboard. |
|
||||||
|
|
||||||
|
### Operator CLI Secret Wrappers (`home/shell/secrets.sh`)
|
||||||
|
| Command / Function | Injected Environment Variables | Source Secret Key (`~/Config/secrets.yaml`) |
|
||||||
|
| :--- | :--- | :--- |
|
||||||
|
| `flarectl` | `CF_API_TOKEN`, `CF_ACCOUNT_ID` | `["cloudflare"]["api_token"]`, `["cloudflare"]["account_id"]` |
|
||||||
|
| `hostinger` | `HOSTINGER_API_TOKEN` | `["hostinger"]["api_token"]` |
|
||||||
|
| `gh-token` (`ght`) | *(Copies directly to Wayland clipboard)* | `["system"]["gh_repo_token"]` (from Homelab `Core`) |
|
||||||
|
|
||||||
|
*Note: Environment variables are set exclusively for the child process lifecycle and do not persist in your interactive shell.*
|
||||||
|
|
||||||
### Directory Navigation Jumps (`home/shell/jump.sh`)
|
### Directory Navigation Jumps (`home/shell/jump.sh`)
|
||||||
| 2-Letter | Word Alias | Target Directory | Description |
|
| 2-Letter | Word Alias | Target Directory | Description |
|
||||||
| :--- | :--- | :--- | :--- |
|
| :--- | :--- | :--- | :--- |
|
||||||
|
|||||||
+50
-11
@@ -32,19 +32,58 @@ graph LR
|
|||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
### Roles & Boundaries
|
### Two-Tier Secrets Architecture
|
||||||
1. **Workstation (`Config`)**:
|
|
||||||
- Holds **zero** declarative system secrets (`sops-nix` is not imported).
|
The infrastructure enforces a strict separation between **Operator Secrets** (workstation) and **Runtime Workload Secrets** (server):
|
||||||
- Provides operator CLI packages (`sops`, `age`, `rbw`) in `home/dev.nix`.
|
|
||||||
- Stores the operator's personal age identity in `~/.config/sops/age/keys.txt`.
|
| Attribute | Workstation Operator Secrets (`Config`) | Server Runtime Secrets (`Core`) |
|
||||||
2. **Server (`Core`)**:
|
| :--- | :--- | :--- |
|
||||||
- Headless consumer running Docker containers, databases, and Traefik.
|
| **Ciphertext File** | `Config/secrets.yaml` | `Core/nixos/secrets.yaml` |
|
||||||
- Decrypts secrets at boot into a secure ramfs (`/run/secrets/`) using `/etc/ssh/ssh_host_ed25519_key`.
|
| **Scope** | Personal operator tokens (Cloudflare, Hostinger, GitHub) | Service runtime credentials (Traefik, DBs, Docker daemons) |
|
||||||
- Unprivileged SSH sessions cannot edit secrets directly on the server.
|
| **Tenancy** | Multi-project across account domains | Scoped strictly to homelab infrastructure workloads |
|
||||||
|
| **Decryption Model** | In-memory on-demand via `sops -d --extract` in shell wrappers | Automated boot-time ramfs mount via `sops-nix` (`/run/secrets/`) |
|
||||||
|
| **Key Identity** | Personal age identity (`~/.config/sops/age/keys.txt`) | Server host SSH key (`/etc/ssh/ssh_host_ed25519_key`) |
|
||||||
|
| **Daemon Overhead** | **Zero** (`sops-nix` module intentionally omitted) | Managed via root systemd units |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 2. Operator Workflow: Authoring & Rotating Secrets
|
## 2. Workstation Operator Secrets (`Config/secrets.yaml`)
|
||||||
|
|
||||||
|
Operator CLI tools (such as `flarectl` and `hostinger`) manage cloud infrastructure across multiple projects. To maintain least-privilege for the server, these credentials are kept on the workstation:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# Config/secrets.yaml (encrypted with operator age key)
|
||||||
|
cloudflare:
|
||||||
|
api_token: "..."
|
||||||
|
account_id: "..."
|
||||||
|
|
||||||
|
hostinger:
|
||||||
|
api_token: "..."
|
||||||
|
```
|
||||||
|
|
||||||
|
### Process-Scoped In-Memory Decryption
|
||||||
|
Rather than exporting tokens into global interactive shells or writing plaintext config files to disk, shell wrappers in `home/shell/secrets.sh` extract credentials into the child process environment on demand:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Example: flarectl wrapper in home/shell/secrets.sh
|
||||||
|
flarectl() {
|
||||||
|
local secrets_file="$HOME/Config/secrets.yaml"
|
||||||
|
if [[ -f "$secrets_file" ]] && command -v sops >/dev/null 2>&1; then
|
||||||
|
CF_API_TOKEN=$(sops -d --extract '["cloudflare"]["api_token"]' "$secrets_file" 2>/dev/null) \
|
||||||
|
CF_ACCOUNT_ID=$(sops -d --extract '["cloudflare"]["account_id"]' "$secrets_file" 2>/dev/null) \
|
||||||
|
command flarectl "$@"
|
||||||
|
else
|
||||||
|
command flarectl "$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
* **Security**: Decryption occurs strictly in RAM (~17ms overhead).
|
||||||
|
* **Isolation**: The environment variables exist only for the life of `flarectl "$@"` and do not persist in the parent interactive shell.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 3. Homelab Server Runtime Secrets (`Core/nixos/secrets.yaml`)
|
||||||
|
|
||||||
To rotate or add a secret for homelab services:
|
To rotate or add a secret for homelab services:
|
||||||
|
|
||||||
@@ -74,7 +113,7 @@ The server evaluates the new ciphertext, decrypts it into `/run/secrets/`, and r
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 3. Backing Up & Restoring the Operator Age Key
|
## 4. Backing Up & Restoring the Operator Age Key
|
||||||
|
|
||||||
The operator key is your cryptographic identity for managing homelab infrastructure:
|
The operator key is your cryptographic identity for managing homelab infrastructure:
|
||||||
|
|
||||||
|
|||||||
@@ -37,3 +37,25 @@ gh-token() {
|
|||||||
|
|
||||||
echo "GitHub repo token copied to clipboard (marked sensitive)."
|
echo "GitHub repo token copied to clipboard (marked sensitive)."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
flarectl() {
|
||||||
|
local secrets_file="$HOME/Config/secrets.yaml"
|
||||||
|
if [[ -f "$secrets_file" ]] && command -v sops >/dev/null 2>&1; then
|
||||||
|
CF_API_TOKEN=$(sops -d --extract '["cloudflare"]["api_token"]' "$secrets_file" 2>/dev/null) \
|
||||||
|
CF_ACCOUNT_ID=$(sops -d --extract '["cloudflare"]["account_id"]' "$secrets_file" 2>/dev/null) \
|
||||||
|
command flarectl "$@"
|
||||||
|
else
|
||||||
|
command flarectl "$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
hostinger() {
|
||||||
|
local secrets_file="$HOME/Config/secrets.yaml"
|
||||||
|
if [[ -f "$secrets_file" ]] && command -v sops >/dev/null 2>&1; then
|
||||||
|
HOSTINGER_API_TOKEN=$(sops -d --extract '["hostinger"]["api_token"]' "$secrets_file" 2>/dev/null) \
|
||||||
|
command hostinger "$@"
|
||||||
|
else
|
||||||
|
command hostinger "$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
+9
-2
@@ -16,6 +16,13 @@ gitea:
|
|||||||
anne_droid_token: ENC[AES256_GCM,data:RHr/11OMd6PdqTq9dlBSGhcwVyvT/Pxbm9AC3Y13DDCzCitDWTpowg==,iv:Hdd+OioVULvK8PZLEAMW5xAXUNl2KWXZRTItivrf9ys=,tag:LhJEHilX0bUksUBdt1ZiWw==,type:str]
|
anne_droid_token: ENC[AES256_GCM,data:RHr/11OMd6PdqTq9dlBSGhcwVyvT/Pxbm9AC3Y13DDCzCitDWTpowg==,iv:Hdd+OioVULvK8PZLEAMW5xAXUNl2KWXZRTItivrf9ys=,tag:LhJEHilX0bUksUBdt1ZiWw==,type:str]
|
||||||
login_token: null
|
login_token: null
|
||||||
runner_token: ENC[AES256_GCM,data:QOT+YpsgsY+QWUGv0Y5rY6rYJc8lX63XOng531/zgnbZkCySB5BQHA==,iv:u7KFsHaqDB0P+ss+VW7/P8jrcaCDUqJ9S5AQdKAlLHY=,tag:6PMHlbrG4WssiLx1t/Q+Vg==,type:str]
|
runner_token: ENC[AES256_GCM,data:QOT+YpsgsY+QWUGv0Y5rY6rYJc8lX63XOng531/zgnbZkCySB5BQHA==,iv:u7KFsHaqDB0P+ss+VW7/P8jrcaCDUqJ9S5AQdKAlLHY=,tag:6PMHlbrG4WssiLx1t/Q+Vg==,type:str]
|
||||||
|
cloudflare:
|
||||||
|
account_name: ENC[AES256_GCM,data:gu8/pC4DdZji,iv:sQ7xt8GF6lABaIYB1OSdS/mKFqZiTHIPk5x6QLFg8uw=,tag:H7op0A/q5jPUYxeHx8ARHA==,type:str]
|
||||||
|
glob_api_key: ENC[AES256_GCM,data:IO9XkH3toADq+rBIMLZHg9lGf65LkgdD1A+CTnVp5QpF4OeOLcATcISQPK85RtPr/3FbaA==,iv:DekbqrWLQuKHph42/DVjp/PgPnzFPP6WduSgEjX7fIY=,tag:j2iLK1q5QrV1lZT4wrebLA==,type:str]
|
||||||
|
api_token: ENC[AES256_GCM,data:g6irVv5rgn2dWOW4FV45fBgqjlc9kGb0Iki8VoXPUFwlcktWLlvnZh/RdwzndZ6nA8a6Qkw=,iv:WceP4SoxmVQcAWyvO/XHYgS25bz5ZWZvpb/aKS3JF6M=,tag:O+/JsBxq/TxSs6zgthBY0w==,type:str]
|
||||||
|
account_id: ENC[AES256_GCM,data:1bhLLvsdEpkLoXfWo8d2Yvo7ja0p91DbLdGCG+KljIk=,iv:nsxp+xJaT3gi0icGXs1rDsfQYAjM1mrfErmdoQr4824=,tag:id8XUM+S0ufUtoRNylk73w==,type:str]
|
||||||
|
hostinger:
|
||||||
|
api_token: ENC[AES256_GCM,data:R4vVUsMrnC9j5wtFGy7HoLv7rVOZnH0FxjINmYmuTH2/S5Cr0wvvj9+2eYl0J4Wm,iv:m7n8+79qlgw2WR2D7EZSai4lV04Qbf6xKjbYOPU4Ifc=,tag:HAjxPkC46wFxD/WQIbIF1w==,type:str]
|
||||||
sops:
|
sops:
|
||||||
age:
|
age:
|
||||||
- enc: |
|
- enc: |
|
||||||
@@ -27,7 +34,7 @@ sops:
|
|||||||
cjauUtjiE5pYEyfUDnmih/dQiZUOI2h+GrwfpZborTuQ4ahoYLormw==
|
cjauUtjiE5pYEyfUDnmih/dQiZUOI2h+GrwfpZborTuQ4ahoYLormw==
|
||||||
-----END AGE ENCRYPTED FILE-----
|
-----END AGE ENCRYPTED FILE-----
|
||||||
recipient: age1pln9sxy5j93lklqklfwp3qepx7x4cs4y2w63n9y3ykt68qgra5ysqleesg
|
recipient: age1pln9sxy5j93lklqklfwp3qepx7x4cs4y2w63n9y3ykt68qgra5ysqleesg
|
||||||
lastmodified: "2026-10-16T02:06:31Z"
|
lastmodified: "2026-10-21T16:38:25Z"
|
||||||
mac: ENC[AES256_GCM,data:Ergjd6rYKpL2tGqTueCkX1f8gn5xM3xJXO+oc+jTajK/yQiP1m4ZARM9if6FQEd/blrAsyPr+cM3RTeMjUopgYxP5FiizySBaUHqvQdX466wCdIhxwZVxn6bldtsf4okUdTSosxWhs40YRc/fs4SWfFM6bX7nhXhewQR+PY8FTY=,iv:kKLT7XfS8485nxqRLOdbVL9pC6Shj+rdoTJXzZGClqc=,tag:9Pv+zpswCugVxBKfeq8o+g==,type:str]
|
mac: ENC[AES256_GCM,data:FCaHrTSMtqjE/W/qTY8BuT45Qy8Iw/SXWEzdnBj0XIHxovJAkozCgbpg9OFmd8Ez8GzXrnJ0sNhhNbePVrnikE+d6mKokjpiofnFleiqv5ThmSOyu+4JA91VwRfH/ZvXFjY+k6/1fQ/pfX9cfv1nOB+C5se6hElVE9lkQ0FPD2k=,iv:1cixNZ0Mcme3qeAhAOr01DkoMpm7kjPZ2cDXJ61jT6c=,tag:hOf0+wfsdAhZyyT6O/VMgw==,type:str]
|
||||||
unencrypted_suffix: _unencrypted
|
unencrypted_suffix: _unencrypted
|
||||||
version: 3.13.3
|
version: 3.13.3
|
||||||
Reference in new issue
Block a user