v2.30.0-pre 7341e0e

auth.md RawHistoryFolder

Authentication Commands

Manage Gordon server authentication tokens and passwords.

gordon auth

Subcommands

Subcommand Description
login Authenticate with a remote Gordon server
token generate Generate a new JWT token
token list List all stored tokens
token revoke Revoke a token by ID (use --all to revoke all tokens)
password hash Generate bcrypt password hash
internal Show internal registry credentials

gordon auth login

Authenticate with a remote Gordon server using password authentication or a pre-generated token.

gordon auth login [options]

Options

Option Description
-r, --remote Remote to authenticate with (defaults to active remote)
-u, --username Username for authentication
-p, --password Password for authentication
-t, --token Authentication token to store for the remote

Description

This command prompts for your username and password, authenticates with the remote server's /auth/password endpoint, and stores the returned token. When pass is available, the token is stored encrypted at gordon/remotes/<name>/token and any plaintext token fields are cleared from remotes.toml. When pass is unavailable, the token is stored in plaintext in remotes.toml with a warning.

If you provide --token, the token is stored directly and verified against /admin/status on a best-effort basis.

The token is a long-lived JWT (7 days) that's used for subsequent CLI operations against the remote.

Note: For token-only servers, you can pass --token here or use gordon remotes set-token.

Examples

# Login using active remote
gordon auth login

# Login to specific remote
gordon auth login --remote prod

# Pre-fill username
gordon auth login --username admin

# Store a pre-generated token
gordon auth login --token <token>

Output

When pass is available:

Username: admin
Password: ********
Authenticating with prod...

✓ Authentication successful!
Token stored in pass for remote 'prod'
Expires in: 604800 seconds

When pass is not available:

Username: admin
Password: ********
Authenticating with prod...

Warning: 'pass' not available. Storing token in plaintext config. Consider installing pass (https://www.passwordstore.org/) for secure token storage.
✓ Authentication successful!
Token stored for remote 'prod'
Expires in: 604800 seconds

gordon auth token generate

Generate a new JWT authentication token for registry access.

gordon auth token generate --subject <name> [options]

Options

Option Default Description
--subject (required) Username/subject for the token
--scopes push,pull Comma-separated scopes
--expiry 30d Duration until expiry (0 = never)
-c, --config Auto Path to config file

Duration Format

Supports human-friendly duration units:

Unit Description Example
d Days (24 hours) 30d
w Weeks (7 days) 2w
M Months (30 days) 6M
y Years (365 days) 1y

Compound durations are also supported: 1y6M, 2w3d, 1d12h

Standard Go durations also work: 24h, 30m, 1h30m

Examples

# CI token that never expires
gordon auth token generate --subject github-actions --expiry 0

# Read-only token for 30 days
gordon auth token generate --subject reader --scopes pull --expiry 30d

# Push-only token for 1 year
gordon auth token generate --subject builder --scopes push --expiry 1y

# Temporary token (24 hours)
gordon auth token generate --subject temp --expiry 24h

# Token for 6 months
gordon auth token generate --subject deploy --expiry 6M

Output

Token generated successfully!
Subject: github-actions
Scopes: push, pull
Expiry: never

Token (use as password with docker login):
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

Usage: docker login -u github-actions -p <token> <registry>

gordon auth token list

List all stored authentication tokens.

gordon auth token list [options]

Output

ID                                    Subject               Expires               Revoked
------------------------------------------------------------------------------------------
a1b2c3d4-e5f6-7890-abcd-ef1234567890  github-actions        never                 no
b2c3d4e5-f6a7-8901-bcde-f12345678901  deploy-bot            2024-02-15 10:30      no
c3d4e5f6-a7b8-9012-cdef-123456789012  old-token             2024-01-01 00:00      yes

gordon auth token revoke

Revoke a token by its ID.

gordon auth token revoke <token-id> [options]
gordon auth token revoke --all  # Revoke all tokens

Example

gordon auth token revoke a1b2c3d4-e5f6-7890-abcd-ef1234567890

Output

Token a1b2c3d4-e5f6-7890-abcd-ef1234567890 has been revoked.

gordon auth password hash

Generate a bcrypt hash for password authentication.

gordon auth password hash

Interactively prompts for a password and outputs the bcrypt hash.

Output

Enter password: ********

Bcrypt hash (store in your secrets backend):
$2a$10$N9qo8uLOickgx2ZMRZoMye...

Then reference the path in your config:
  [auth]
  username = "deploy"
  password_hash = "gordon/auth/password_hash"
  token_secret = "gordon/auth/token_secret"

gordon auth internal

Display the auto-generated internal registry credentials.

gordon auth internal

Gordon generates temporary credentials for loopback-only communication with its local registry. These credentials are useful for manual recovery when debugging deployment issues.

When registry auth is enabled, Gordon also generates a separate service token for its own registry-domain pulls. That token is not exposed via the CLI.

Output

Internal Registry Credentials
==============================
Username: gordon-internal
Password: 8f3a2b1c4d5e6f7a8b9c0d1e2f3a4b5c...

Usage:
  docker login localhost:5000 -u gordon-internal -p 8f3a2b1c4d5e6f7a8b9c0d1e2f3a4b5c...

Notes

  • Credentials are regenerated each time Gordon starts
  • Only available while Gordon is running
  • Used for manual docker pull from the local registry during debugging
  • Separate from the service token used by Gordon core for registry-domain pulls

Use Cases

  • Debugging image pull failures
  • Manual recovery after deployment issues
  • Inspecting images in the local registry

Token Scopes

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

Token Expiry Formats

Format Duration
0 Never expires
24h 24 hours
720h 30 days
8760h 1 year

Workflow Examples

CI/CD Setup

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

# Save token as CI secret
# GitHub: Settings → Secrets → New repository secret
# GitLab: Settings → CI/CD → Variables

Docker Login

# Using generated token
docker login -u ci-bot -p <token> registry.mydomain.com

# In CI/CD
echo "$GORDON_TOKEN" | docker login -u ci-bot --password-stdin registry.mydomain.com

Token Rotation

# Generate new token
gordon auth token generate --subject ci-bot --expiry 0

# Update CI secrets with new token

# Revoke old token
gordon auth token revoke <old-token-id>

Password Setup

# Generate hash
gordon auth password hash
# Enter: mypassword

# Store in pass
pass insert gordon/auth/password_hash
# Paste: $2a$10$...

# Create token secret
pass insert gordon/auth/token_secret
# Enter a random 32+ character string

# Configure gordon.toml
[auth]
enabled = true
secrets_backend = "pass"
username = "deploy"
password_hash = "gordon/auth/password_hash"
token_secret = "gordon/auth/token_secret"
source
1# Authentication Commands
2
3Manage Gordon server authentication tokens and passwords.
4
5## gordon auth
6
7### Subcommands
8
9| Subcommand | Description |
10|------------|-------------|
11| `login` | Authenticate with a remote Gordon server |
12| `token generate` | Generate a new JWT token |
13| `token list` | List all stored tokens |
14| `token revoke` | Revoke a token by ID (use `--all` to revoke all tokens) |
15| `password hash` | Generate bcrypt password hash |
16| `internal` | Show internal registry credentials |
17
18---
19
20## gordon auth login
21
22Authenticate with a remote Gordon server using password authentication or a pre-generated token.
23
24```bash
25gordon auth login [options]
26```
27
28### Options
29
30| Option | Description |
31|--------|-------------|
32| `-r, --remote` | Remote to authenticate with (defaults to active remote) |
33| `-u, --username` | Username for authentication |
34| `-p, --password` | Password for authentication |
35| `-t, --token` | Authentication token to store for the remote |
36
37### Description
38
39This command prompts for your username and password, authenticates with the remote server's `/auth/password` endpoint, and stores the returned token. When [pass](https://www.passwordstore.org/) is available, the token is stored encrypted at `gordon/remotes/<name>/token` and any plaintext token fields are cleared from `remotes.toml`. When `pass` is unavailable, the token is stored in plaintext in `remotes.toml` with a warning.
40
41If you provide `--token`, the token is stored directly and verified against `/admin/status` on a best-effort basis.
42
43The token is a long-lived JWT (7 days) that's used for subsequent CLI operations against the remote.
44
45> **Note:** For token-only servers, you can pass `--token` here or use `gordon remotes set-token`.
46
47### Examples
48
49```bash
50# Login using active remote
51gordon auth login
52
53# Login to specific remote
54gordon auth login --remote prod
55
56# Pre-fill username
57gordon auth login --username admin
58
59# Store a pre-generated token
60gordon auth login --token <token>
61```
62
63### Output
64
65When `pass` is available:
66
67```text
68Username: admin
69Password: ********
70Authenticating with prod...
71
72✓ Authentication successful!
73Token stored in pass for remote 'prod'
74Expires in: 604800 seconds
75```
76
77When `pass` is not available:
78
79```text
80Username: admin
81Password: ********
82Authenticating with prod...
83
84Warning: 'pass' not available. Storing token in plaintext config. Consider installing pass (https://www.passwordstore.org/) for secure token storage.
85✓ Authentication successful!
86Token stored for remote 'prod'
87Expires in: 604800 seconds
88```
89
90---
91
92## gordon auth token generate
93
94Generate a new JWT authentication token for registry access.
95
96```bash
97gordon auth token generate --subject <name> [options]
98```
99
100### Options
101
102| Option | Default | Description |
103|--------|---------|-------------|
104| `--subject` | (required) | Username/subject for the token |
105| `--scopes` | `push,pull` | Comma-separated scopes |
106| `--expiry` | `30d` | Duration until expiry (0 = never) |
107| `-c, --config` | Auto | Path to config file |
108
109### Duration Format
110
111Supports human-friendly duration units:
112
113| Unit | Description | Example |
114|------|-------------|---------|
115| `d` | Days (24 hours) | `30d` |
116| `w` | Weeks (7 days) | `2w` |
117| `M` | Months (30 days) | `6M` |
118| `y` | Years (365 days) | `1y` |
119
120Compound durations are also supported: `1y6M`, `2w3d`, `1d12h`
121
122Standard Go durations also work: `24h`, `30m`, `1h30m`
123
124### Examples
125
126```bash
127# CI token that never expires
128gordon auth token generate --subject github-actions --expiry 0
129
130# Read-only token for 30 days
131gordon auth token generate --subject reader --scopes pull --expiry 30d
132
133# Push-only token for 1 year
134gordon auth token generate --subject builder --scopes push --expiry 1y
135
136# Temporary token (24 hours)
137gordon auth token generate --subject temp --expiry 24h
138
139# Token for 6 months
140gordon auth token generate --subject deploy --expiry 6M
141```
142
143### Output
144
145```
146Token generated successfully!
147Subject: github-actions
148Scopes: push, pull
149Expiry: never
150
151Token (use as password with docker login):
152eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
153
154Usage: docker login -u github-actions -p <token> <registry>
155```
156
157---
158
159## gordon auth token list
160
161List all stored authentication tokens.
162
163```bash
164gordon auth token list [options]
165```
166
167### Output
168
169```
170ID                                    Subject               Expires               Revoked
171------------------------------------------------------------------------------------------
172a1b2c3d4-e5f6-7890-abcd-ef1234567890  github-actions        never                 no
173b2c3d4e5-f6a7-8901-bcde-f12345678901  deploy-bot            2024-02-15 10:30      no
174c3d4e5f6-a7b8-9012-cdef-123456789012  old-token             2024-01-01 00:00      yes
175```
176
177---
178
179## gordon auth token revoke
180
181Revoke a token by its ID.
182
183```bash
184gordon auth token revoke <token-id> [options]
185gordon auth token revoke --all  # Revoke all tokens
186```
187
188### Example
189
190```bash
191gordon auth token revoke a1b2c3d4-e5f6-7890-abcd-ef1234567890
192```
193
194### Output
195
196```
197Token a1b2c3d4-e5f6-7890-abcd-ef1234567890 has been revoked.
198```
199
200---
201
202## gordon auth password hash
203
204Generate a bcrypt hash for password authentication.
205
206```bash
207gordon auth password hash
208```
209
210Interactively prompts for a password and outputs the bcrypt hash.
211
212### Output
213
214```
215Enter password: ********
216
217Bcrypt hash (store in your secrets backend):
218$2a$10$N9qo8uLOickgx2ZMRZoMye...
219
220Then reference the path in your config:
221  [auth]
222  username = "deploy"
223  password_hash = "gordon/auth/password_hash"
224  token_secret = "gordon/auth/token_secret"
225```
226
227---
228
229## gordon auth internal
230
231Display the auto-generated internal registry credentials.
232
233```bash
234gordon auth internal
235```
236
237Gordon generates temporary credentials for loopback-only communication with its local registry. These credentials are useful for manual recovery when debugging deployment issues.
238
239When registry auth is enabled, Gordon also generates a separate service token for its own registry-domain pulls. That token is not exposed via the CLI.
240
241### Output
242
243```
244Internal Registry Credentials
245==============================
246Username: gordon-internal
247Password: 8f3a2b1c4d5e6f7a8b9c0d1e2f3a4b5c...
248
249Usage:
250  docker login localhost:5000 -u gordon-internal -p 8f3a2b1c4d5e6f7a8b9c0d1e2f3a4b5c...
251```
252
253### Notes
254
255- Credentials are regenerated each time Gordon starts
256- Only available while Gordon is running
257- Used for manual `docker pull` from the local registry during debugging
258- Separate from the service token used by Gordon core for registry-domain pulls
259
260### Use Cases
261
262- Debugging image pull failures
263- Manual recovery after deployment issues
264- Inspecting images in the local registry
265
266---
267
268## Token Scopes
269
270| Scope | Permission |
271|-------|------------|
272| `push` | Push images to registry |
273| `pull` | Pull images from registry |
274| `push,pull` | Both push and pull (default) |
275
276## Token Expiry Formats
277
278| Format | Duration |
279|--------|----------|
280| `0` | Never expires |
281| `24h` | 24 hours |
282| `720h` | 30 days |
283| `8760h` | 1 year |
284
285---
286
287## Workflow Examples
288
289### CI/CD Setup
290
291```bash
292# Generate token for CI
293gordon auth token generate --subject ci-bot --scopes push,pull --expiry 0
294
295# Save token as CI secret
296# GitHub: Settings → Secrets → New repository secret
297# GitLab: Settings → CI/CD → Variables
298```
299
300### Docker Login
301
302```bash
303# Using generated token
304docker login -u ci-bot -p <token> registry.mydomain.com
305
306# In CI/CD
307echo "$GORDON_TOKEN" | docker login -u ci-bot --password-stdin registry.mydomain.com
308```
309
310### Token Rotation
311
312```bash
313# Generate new token
314gordon auth token generate --subject ci-bot --expiry 0
315
316# Update CI secrets with new token
317
318# Revoke old token
319gordon auth token revoke <old-token-id>
320```
321
322### Password Setup
323
324```bash
325# Generate hash
326gordon auth password hash
327# Enter: mypassword
328
329# Store in pass
330pass insert gordon/auth/password_hash
331# Paste: $2a$10$...
332
333# Create token secret
334pass insert gordon/auth/token_secret
335# Enter a random 32+ character string
336
337# Configure gordon.toml
338[auth]
339enabled = true
340secrets_backend = "pass"
341username = "deploy"
342password_hash = "gordon/auth/password_hash"
343token_secret = "gordon/auth/token_secret"
344```
345
346## Related
347
348- [CLI Overview](./index.md)
349- [Authentication Configuration](../config/auth.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