[PR #11574] server: add authorized_keys file #24126

Open
opened 2026-04-19 17:23:57 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/11574
Author: @pdevine
Created: 7/30/2025
Status: 🔄 Open

Base: mainHead: pdevine/authorizedkeys


📝 Commits (3)

📊 Changes

6 files changed (+525 additions, -31 deletions)

View changed files

📝 api/client.go (+19 -18)
📝 api/client_test.go (+0 -10)
📝 auth/auth.go (+35 -0)
auth/authorized_keys.go (+254 -0)
auth/authorized_keys_test.go (+133 -0)
📝 server/routes.go (+84 -3)

📄 Description

This change adds an "authorized_keys" file similar to sshd which can control access to an Ollama server. The file itself is very simple and consists of various entries for Ollama public keys.

The format is:

[,...]

Examples:

ssh-ed25519 AAAAC3NzaC1lZDI1NT... bob /api/tags,/api/ps,/api/show,/api/generate,/api/chat

Use the "*" wildcard symbol to substitute any value, e.g.:

To grant full access to "bob":

ssh-ed25519 AAAAC3NzaC1lZDI1NT... bob *

To allow all callers to view tags (i.e. "ollama ls"):

* * * /api/tags
  • The key format must be set to "ssh-ed25519" or set to the wildcard character.
  • The public key must be an ssh based ed25519 (Ollama) public key or set to the wildcard character.
  • Name can be any string you wish to associate with the public key. Note that if a public key is used in more than one entry in the file, the first instance of the name will be used and subsequent name values will be ignored.
  • Endpoints is a comma separated list of Ollama Server API endpoints or the wildcard character. The HTTP method is not currently needed, but could be added in the future.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/11574 **Author:** [@pdevine](https://github.com/pdevine) **Created:** 7/30/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `pdevine/authorizedkeys` --- ### 📝 Commits (3) - [`5968989`](https://github.com/ollama/ollama/commit/5968989a7f91817989984b9a40703f0993a16288) server: add authorized_keys file - [`be04fcd`](https://github.com/ollama/ollama/commit/be04fcde16612afdb7d9ebbd218e3ca8dc7749fa) feed the linter - [`53a5370`](https://github.com/ollama/ollama/commit/53a53702e03830c96fd9d6958676be8c8090ca9a) gofumpt the file ### 📊 Changes **6 files changed** (+525 additions, -31 deletions) <details> <summary>View changed files</summary> 📝 `api/client.go` (+19 -18) 📝 `api/client_test.go` (+0 -10) 📝 `auth/auth.go` (+35 -0) ➕ `auth/authorized_keys.go` (+254 -0) ➕ `auth/authorized_keys_test.go` (+133 -0) 📝 `server/routes.go` (+84 -3) </details> ### 📄 Description This change adds an "authorized_keys" file similar to sshd which can control access to an Ollama server. The file itself is very simple and consists of various entries for Ollama public keys. The format is: <key format> <public key> <name> [<endpoint>,...] Examples: ``` ssh-ed25519 AAAAC3NzaC1lZDI1NT... bob /api/tags,/api/ps,/api/show,/api/generate,/api/chat ``` Use the "*" wildcard symbol to substitute any value, e.g.: To grant full access to "bob": ``` ssh-ed25519 AAAAC3NzaC1lZDI1NT... bob * ``` To allow all callers to view tags (i.e. "ollama ls"): ``` * * * /api/tags ``` - The key format must be set to "ssh-ed25519" or set to the wildcard character. - The public key must be an ssh based ed25519 (Ollama) public key or set to the wildcard character. - Name can be any string you wish to associate with the public key. Note that if a public key is used in more than one entry in the file, the first instance of the name will be used and subsequent name values will be ignored. - Endpoints is a comma separated list of Ollama Server API endpoints or the wildcard character. The HTTP method is not currently needed, but could be added in the future. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-19 17:23:57 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#24126