v2.6.0 fe25b4f

auth.md RawHistoryFolder

Authentication

Configure authentication for the Gordon registry and Admin API.

Quick Start

Authentication is enabled by default for security. Gordon will not start without authentication configured.

Option 1: Password Authentication (simplest)

# 1. Generate password hash
gordon auth password hash
# Enter your password, copy the bcrypt hash

# 2. Save hash to secrets file
mkdir -p ~/.gordon/secrets
echo '$2a$10$...' > ~/.gordon/secrets/password_hash

# 3. Add to config.toml
cat >> ~/.gordon/config.toml << 'EOF'
[auth]
password_hash = "password_hash"
EOF

Option 2: Disable Authentication (development only)

[auth]
enabled = false

Configuration

[auth]
enabled = true
type = "token"
secrets_backend = "pass"
token_secret = "gordon/auth/token_secret"
token_expiry = "30d"

Options

Option Type Default Description
enabled bool true Enable authentication
type string "password" Auth type: "password" or "token"
secrets_backend string "unsafe" Secrets backend: "pass", "sops", or "unsafe"
username string - Username for password auth
password_hash string - Path to bcrypt hash in secrets backend
token_secret string - Path to JWT signing secret in secrets backend
token_expiry string "30d" Token validity duration (0 = never expires)

Secrets Backend

The secrets_backend option determines how Gordon retrieves sensitive values like token_secret and password_hash:

Backend Description
pass Unix password manager (GPG-encrypted)
sops Mozilla SOPS encrypted files
unsafe Plain text files (development only)

See Secret Providers for detailed configuration of each backend.

Authentication Types

JWT-based authentication, ideal for CI/CD pipelines:

[auth]
enabled = true
type = "token"
secrets_backend = "pass"
token_secret = "gordon/auth/token_secret"
token_expiry = "30d"

Setup:

# Create token secret (random 32+ characters)
pass insert gordon/auth/token_secret

# Generate a token
gordon auth token generate --subject ci-bot --scopes push,pull --expiry 0

Usage:

# Docker login with token
docker login -u ci-bot -p <token> registry.mydomain.com

Token Management:

# List all tokens
gordon auth token list

# Revoke a specific token
gordon auth token revoke <token-id>

# Revoke all tokens
gordon auth token revoke --all

Password Authentication

Simple username/password authentication:

[auth]
enabled = true
type = "password"
secrets_backend = "pass"
username = "deploy"
password_hash = "gordon/auth/password_hash"

Setup:

# Generate bcrypt hash
gordon auth password hash
# Enter password when prompted

# Store hash in secrets backend
pass insert gordon/auth/password_hash
# Paste the bcrypt hash

Usage:

docker login -u deploy -p <password> registry.mydomain.com

Token Scopes

Tokens can have different permission levels:

Registry Scopes

Scope Permission
push Push images to registry
pull Pull images from registry
push,pull Both push and pull (default)

Admin Scopes

For remote CLI access via the Admin API:

Scope Permission
admin:*:* Full admin access
admin:routes:read Read-only routes access
admin:routes:write Routes write access
admin:config:read Read-only config access
admin:config:write Config write access
admin:status:read Read-only status/health
admin:secrets:read List secret keys
admin:secrets:write Set/delete secrets

Examples:

# Pull-only token (for read-only access)
gordon auth token generate --subject reader --scopes pull --expiry 30d

# Push-only token (for CI builds)
gordon auth token generate --subject builder --scopes push --expiry 0

# Full admin access (for remote CLI)
gordon auth token generate --subject admin --scopes "push,pull,admin:*:*" --expiry 0

Token Expiry

Control how long tokens remain valid. Supports human-friendly units:

Unit Description
d days (24 hours)
w weeks (7 days)
M months (30 days)
y years (365 days)

Compound durations work too: 1y6M, 2w3d

# Never expires (for CI/CD)
gordon auth token generate --subject ci --expiry 0

# Expires in 1 year
gordon auth token generate --subject deploy --expiry 1y

# Expires in 30 days
gordon auth token generate --subject temp --expiry 30d

Instance-Specific Tokens

Tokens are signed with the token_secret, which is unique to each Gordon instance:

  • Tokens from one Gordon instance won't work on another
  • Changing the token_secret invalidates all existing tokens
  • Each environment (dev, staging, prod) should have different secrets

Development Setup

For local development without authentication:

[auth]
enabled = false

Examples

CI/CD Setup

[auth]
enabled = true
type = "token"
secrets_backend = "pass"
token_secret = "gordon/auth/token_secret"
# Generate CI token
gordon auth token generate --subject github-actions --scopes push,pull --expiry 0

In GitHub Actions:

- name: Login to Gordon Registry
  run: docker login -u github-actions -p ${{ secrets.GORDON_TOKEN }} ${{ secrets.GORDON_REGISTRY }}

Production with Password

[auth]
enabled = true
type = "password"
secrets_backend = "pass"
username = "deploy"
password_hash = "gordon/auth/password_hash"

Enterprise with SOPS

[auth]
enabled = true
type = "token"
secrets_backend = "sops"
token_secret = "gordon/auth/token_secret"

Internal Registry Auth

Gordon generates internal credentials automatically when auth is enabled. These are used for loopback pulls when deploying containers and are regenerated on each restart.

To view internal credentials (for troubleshooting):

gordon auth internal
source
1# Authentication
2
3Configure authentication for the Gordon registry and Admin API.
4
5## Quick Start
6
7Authentication is **enabled by default** for security. Gordon will not start without authentication configured.
8
9**Option 1: Password Authentication (simplest)**
10```bash
11# 1. Generate password hash
12gordon auth password hash
13# Enter your password, copy the bcrypt hash
14
15# 2. Save hash to secrets file
16mkdir -p ~/.gordon/secrets
17echo '$2a$10$...' > ~/.gordon/secrets/password_hash
18
19# 3. Add to config.toml
20cat >> ~/.gordon/config.toml << 'EOF'
21[auth]
22password_hash = "password_hash"
23EOF
24```
25
26**Option 2: Disable Authentication (development only)**
27```toml
28[auth]
29enabled = false
30```
31
32## Configuration
33
34```toml
35[auth]
36enabled = true
37type = "token"
38secrets_backend = "pass"
39token_secret = "gordon/auth/token_secret"
40token_expiry = "30d"
41```
42
43## Options
44
45| Option | Type | Default | Description |
46|--------|------|---------|-------------|
47| `enabled` | bool | `true` | Enable authentication |
48| `type` | string | `"password"` | Auth type: `"password"` or `"token"` |
49| `secrets_backend` | string | `"unsafe"` | Secrets backend: `"pass"`, `"sops"`, or `"unsafe"` |
50| `username` | string | - | Username for password auth |
51| `password_hash` | string | - | Path to bcrypt hash in secrets backend |
52| `token_secret` | string | - | Path to JWT signing secret in secrets backend |
53| `token_expiry` | string | `"30d"` | Token validity duration (0 = never expires) |
54
55## Secrets Backend
56
57The `secrets_backend` option determines how Gordon retrieves sensitive values like `token_secret` and `password_hash`:
58
59| Backend | Description |
60|---------|-------------|
61| `pass` | Unix password manager (GPG-encrypted) |
62| `sops` | Mozilla SOPS encrypted files |
63| `unsafe` | Plain text files (development only) |
64
65See [Secret Providers](./secrets.md) for detailed configuration of each backend.
66
67## Authentication Types
68
69### Token Authentication (Recommended)
70
71JWT-based authentication, ideal for CI/CD pipelines:
72
73```toml
74[auth]
75enabled = true
76type = "token"
77secrets_backend = "pass"
78token_secret = "gordon/auth/token_secret"
79token_expiry = "30d"
80```
81
82**Setup:**
83```bash
84# Create token secret (random 32+ characters)
85pass insert gordon/auth/token_secret
86
87# Generate a token
88gordon auth token generate --subject ci-bot --scopes push,pull --expiry 0
89```
90
91**Usage:**
92```bash
93# Docker login with token
94docker login -u ci-bot -p <token> registry.mydomain.com
95```
96
97**Token Management:**
98```bash
99# List all tokens
100gordon auth token list
101
102# Revoke a specific token
103gordon auth token revoke <token-id>
104
105# Revoke all tokens
106gordon auth token revoke --all
107```
108
109### Password Authentication
110
111Simple username/password authentication:
112
113```toml
114[auth]
115enabled = true
116type = "password"
117secrets_backend = "pass"
118username = "deploy"
119password_hash = "gordon/auth/password_hash"
120```
121
122**Setup:**
123```bash
124# Generate bcrypt hash
125gordon auth password hash
126# Enter password when prompted
127
128# Store hash in secrets backend
129pass insert gordon/auth/password_hash
130# Paste the bcrypt hash
131```
132
133**Usage:**
134```bash
135docker login -u deploy -p <password> registry.mydomain.com
136```
137
138## Token Scopes
139
140Tokens can have different permission levels:
141
142### Registry Scopes
143
144| Scope | Permission |
145|-------|------------|
146| `push` | Push images to registry |
147| `pull` | Pull images from registry |
148| `push,pull` | Both push and pull (default) |
149
150### Admin Scopes
151
152For remote CLI access via the Admin API:
153
154| Scope | Permission |
155|-------|------------|
156| `admin:*:*` | Full admin access |
157| `admin:routes:read` | Read-only routes access |
158| `admin:routes:write` | Routes write access |
159| `admin:config:read` | Read-only config access |
160| `admin:config:write` | Config write access |
161| `admin:status:read` | Read-only status/health |
162| `admin:secrets:read` | List secret keys |
163| `admin:secrets:write` | Set/delete secrets |
164
165**Examples:**
166```bash
167# Pull-only token (for read-only access)
168gordon auth token generate --subject reader --scopes pull --expiry 30d
169
170# Push-only token (for CI builds)
171gordon auth token generate --subject builder --scopes push --expiry 0
172
173# Full admin access (for remote CLI)
174gordon auth token generate --subject admin --scopes "push,pull,admin:*:*" --expiry 0
175```
176
177## Token Expiry
178
179Control how long tokens remain valid. Supports human-friendly units:
180
181| Unit | Description |
182|------|-------------|
183| `d` | days (24 hours) |
184| `w` | weeks (7 days) |
185| `M` | months (30 days) |
186| `y` | years (365 days) |
187
188Compound durations work too: `1y6M`, `2w3d`
189
190```bash
191# Never expires (for CI/CD)
192gordon auth token generate --subject ci --expiry 0
193
194# Expires in 1 year
195gordon auth token generate --subject deploy --expiry 1y
196
197# Expires in 30 days
198gordon auth token generate --subject temp --expiry 30d
199```
200
201## Instance-Specific Tokens
202
203Tokens are signed with the `token_secret`, which is unique to each Gordon instance:
204
205- Tokens from one Gordon instance won't work on another
206- Changing the `token_secret` invalidates all existing tokens
207- Each environment (dev, staging, prod) should have different secrets
208
209## Development Setup
210
211For local development without authentication:
212
213```toml
214[auth]
215enabled = false
216```
217
218## Examples
219
220### CI/CD Setup
221
222```toml
223[auth]
224enabled = true
225type = "token"
226secrets_backend = "pass"
227token_secret = "gordon/auth/token_secret"
228```
229
230```bash
231# Generate CI token
232gordon auth token generate --subject github-actions --scopes push,pull --expiry 0
233```
234
235In GitHub Actions:
236```yaml
237- name: Login to Gordon Registry
238  run: docker login -u github-actions -p ${{ secrets.GORDON_TOKEN }} ${{ secrets.GORDON_REGISTRY }}
239```
240
241### Production with Password
242
243```toml
244[auth]
245enabled = true
246type = "password"
247secrets_backend = "pass"
248username = "deploy"
249password_hash = "gordon/auth/password_hash"
250```
251
252### Enterprise with SOPS
253
254```toml
255[auth]
256enabled = true
257type = "token"
258secrets_backend = "sops"
259token_secret = "gordon/auth/token_secret"
260```
261
262## Internal Registry Auth
263
264Gordon generates internal credentials automatically when auth is enabled. These are used for loopback pulls when deploying containers and are regenerated on each restart.
265
266To view internal credentials (for troubleshooting):
267```bash
268gordon auth internal
269```
270
271## Related
272
273- [Secret Providers](./secrets.md)
274- [CLI Commands](../cli/commands.md)
275- [GitHub Actions Deployment](../deployment/github-actions.md)

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 7

Tags 106

↑↓ moveenter openesc close