Why Ollama SSO is needed before anyone else can reach the API
The local Ollama API on port 11434 has no authentication, so any client that can reach that port can list models, run inference and read responses. Once a team has Ollama running and wants staff to use it under corporate identity, access control and attribution have to be added around the API, not inside it. The default bind to 127.0.0.1 keeps the server reachable only from the same machine, which is a safe starting point but does not serve a team. Setting OLLAMA_HOST changes the bind address, and the Ollama FAQ describes exposing the service through proxies such as Nginx. Widening the bind address without a proxy in front of it is the step that turns a private tool into an open endpoint on the network.
Do not confuse the local API with direct cloud inference. The local API at localhost:11434 needs no key, while direct calls to ollama.com/api and ollama.com/v1 require an API key sent as a Bearer token, as described in the Ollama API authentication docs. A team that adds a Bearer key to its own gateway may believe the local endpoint is protected when it is not. Confirm with your own tests which paths your proxy forwards, whether cloud features are enabled on the server, and whether any client bypasses the gateway by calling port 11434 directly.
This is harder than it looks for two reasons. First, identity has to be enforced at the edge, meaning the reverse proxy or identity-aware gateway must check a user's session or key before any request reaches Ollama, and it must block direct access to the backend. Second, Ollama does not tell you which person made a request. Its logs record the server's activity, not the signed-in user, so attribution must be carried by the layer in front of it. Before go-live, ask your team to verify that an unauthenticated request is refused, that a named user's request appears in your logs with their identity, and that no route skips the proxy.
Which components make up an Ollama identity layer
Ollama's local API accepts requests without authentication, so the identity layer is built around it rather than inside it. Each component below controls one link in the path from a staff member's browser to a model response, and the gaps between them are where access control and logging can fail.
Ollama server and REST API
The Ollama server listens on 127.0.0.1 port 11434 by default and exposes a REST API with no authentication of its own. The bind address is set with OLLAMA_HOST. Keep the default bind unless a proxy runs on the same host, and confirm that no other network path reaches port 11434. Any client that can reach the port can run inference, so this is the control the rest of the layer exists to protect.
Reverse proxy or API gateway
The proxy is the only component that can enforce authentication in front of Ollama. It terminates TLS, checks an SSO session or API key on every request, and forwards only approved routes to the upstream server. Confirm that the proxy blocks direct access to port 11434 from user networks, and that it does not pass through headers a client could forge to impersonate another user.
Identity provider for SSO
The identity provider authenticates staff and issues the tokens or assertions the proxy validates. Decide which group claims map to Ollama access, how sessions expire, and how a leaver's access is removed. Ollama itself has no user directory, so every per-user decision lives here or in the proxy's policy. Ask the proxy vendor or platform team which token format it validates before choosing a provider.
Chat front end for staff
Most staff will reach models through a chat interface, not the raw API. The front end must send requests through the proxy, never directly to the Ollama server, and it should use the SSO session rather than a shared password. Check whether the front end stores conversation history, where it keeps that history, and whether administrators can see other users' chats. These answers shape your data handling review.
Log sink for request records
Ollama's own logs do not establish which user sent which request, so the proxy must write that record. Log the authenticated identity, timestamp, route, model name and response status for each call, and send the records to a store the application team cannot edit. Confirm retention periods with your compliance team and test that a sample request produces one complete entry.
Optional cloud API key path
Direct cloud inference at ollama.com uses an API key sent as a Bearer token, which is a separate credential path from the local API. If local-only traffic is required, set OLLAMA_NO_CLOUD=1 or the equivalent server configuration to turn cloud features off. If cloud models are approved, store the key in a secrets manager, scope it to named users or services, and log its use alongside the proxy records.
Which access pattern fits: SSO at the proxy, API keys or a chat front end
This table compares four ways to put identity in front of a self-hosted Ollama server: SSO at a reverse proxy, API keys at a gateway, a chat front end with its own accounts, and network-only access. Read each row against your user population, your client applications and the operating work each option adds. Confirm each front end's SSO and logging features against its own documentation before you choose.
| Pattern | When it fits | Operational cost | Clients supported |
|---|---|---|---|
| SSO at a reverse proxy | Staff use browser tools or a small set of internal apps and your identity provider already covers them | Proxy configuration and TLS certificates, session lifetime settings, group mapping, and access logs that record the authenticated user | Browser-based tools and apps that can pass a session cookie or token through the proxy; confirm header and token handling for each client |
| API keys validated at a gateway | Scripts, services and developer tools call the API directly and need per-application credentials | Someone owns key issuance, rotation and revocation, token lifetimes must be set, and onboarding needs a documented request path | Any client that can send an Authorization header, including SDK-based code; confirm the gateway's key format and rotation features |
| Chat front end with its own accounts | Many business users need a chat interface and per-user history, and you want the front end to handle login | Account lifecycle runs in the front end, SSO setup must be verified against its documentation, and chat logs may hold sensitive prompts | Usually browser and desktop chat use only; confirm which Ollama endpoints it calls and whether it exposes an API for other clients |
| Network-only access for a small trusted group | A handful of named users on a private network with no external exposure | Low setup effort, but no per-user attribution in Ollama logs, and access changes depend on network administration | Clients on the allowed network segment; this does not identify individual users, so it is weak for audit needs |
How a staff request passes through identity and reaches Ollama
A staff request starts in a chat front end or client on the user's device, where the user signs in with the company identity provider and receives a token. The reverse proxy at the network edge checks that token or API key before forwarding the request, and it writes an access log entry that records who sent it. The proxy then forwards the request to Ollama, which listens on 127.0.0.1:11434 or a private interface. Check that the Ollama port accepts traffic only from the proxy and never from user networks, because Ollama itself does not authenticate local API calls.
Request path from user to Ollama, with the trust boundary at the proxy.
How to build SSO in front of Ollama in six steps
This sequence places a single authenticated entry point in front of an Ollama server that has no login of its own, so each request is tied to a person or an API key and can be traced in the access log. Each step ends with a check that the previous control holds before the next one is added.
Confirm the Ollama bind address and port
Start by checking where the Ollama server currently listens. By default it binds to 127.0.0.1 on port 11434, which means only processes on the same host can reach the API. Your platform or infrastructure engineer should confirm the value of OLLAMA_HOST in the service configuration, including any container or systemd override, and record the address and port in the build notes. The step is done when the listening address shown by the host's network tools matches the documented value and an unauthenticated request from another machine fails. Note that the local API has no authentication, so any network path to it is a path around the proxy.
Keep the API off user networks
Leave Ollama on the default loopback address, or set OLLAMA_HOST to a private interface that only the proxy host can reach. Do not bind it to all interfaces on a machine that sits on a user network. Confirm the firewall or security group allows port 11434 only from the proxy. The check is a connection test from a user workstation and from the proxy host: the workstation should be refused and the proxy should succeed. Record the result, since it is the control that makes the proxy meaningful.
Register the proxy hostname and TLS certificate
Assign a stable internal hostname to the front door, such as a name your identity and certificate teams already manage, and issue a TLS certificate for it from your internal or public certificate authority. Coordinate DNS with the network team. The check is that the name resolves to the proxy, the certificate chain validates from a client device, and the certificate expiry date is recorded in your renewal calendar. Confirm the certificate process with your certificate authority, since the required steps depend on your environment.
Require identity or API keys at the proxy
Configure the reverse proxy to refuse any request that lacks a valid credential. The Ollama FAQ describes exposing the server through proxies such as Nginx, and that pattern is one option. For SSO, the proxy or an authentication gateway in front of it validates a token issued by your identity provider. For programmatic clients, the proxy can check an API key issued to the client. Confirm the exact method your proxy supports with its own documentation. The check is that a request with no credential returns an authorization error, a request with a valid token or key succeeds, and an expired or invalid token is refused.
Connect chat front ends and clients through the proxy
Point the chat front end and any application or SDK client at the proxy hostname instead of localhost:11434. Pass the user's token or key in the request path the proxy expects. Where the client is a browser front end, check how it forwards the session cookie or token to the backend. Test one named user from each client type, including the Python or JavaScript SDK if used. The check is that each client completes a request through the proxy, and that a client using no credential or the wrong one cannot reach a model.
Confirm user identity reaches the access log
Verify that every proxied request writes a log line that identifies the caller. Depending on the setup, that is the subject claim from the token, the username the gateway resolved, or the API key identifier. Ollama's own logs record the server activity but are not a substitute for the proxy record, so check that the proxy log carries the identity field and that logs are shipped to a location your security team can query. The check is to send a test request as two different users and confirm each entry names the right user with a timestamp and the requested path. Confirm with your security team which retention period applies, since that is set by your policy.
How to log which user sent which Ollama request
Attribution has to come from the layer in front of Ollama. The local API at port 11434 does not identify callers, so the proxy or front end that authenticates users is the only place where a request can be tied to a person or service account. Capture the authenticated subject, the request time, the path (for example /api/chat or /api/generate), the model name from the request body, the HTTP status, and the client address as seen by the proxy. If the proxy sits behind a load balancer, confirm which header carries the original client address and whether the proxy trusts it, because a spoofed forwarded header will corrupt the log. Check which of these fields your chosen proxy and front end actually emit by default, since many log the path and status but not the model name or the authenticated subject, and dashboards built on fields that do not exist will fail silently.
Proxy logs and front-end logs record different parts of the same exchange, so they need a shared key to be useful together. Ask the proxy to generate or pass a request ID and have the front end log the same value, or correlate on subject, timestamp and path within a short window if no shared ID is available. Test this with a scripted sequence of requests from two known accounts before trusting any report. Keep in mind that the front end knows the conversation and the user, while the proxy knows the raw request, so neither log alone answers the question of who sent which request.
Avoid storing prompts and responses by default. Request bodies often carry customer data, source code or personal information, so logging them turns the log store into a sensitive data store with its own access and retention needs. Log metadata unless your data classification and policy explicitly allow content capture for a defined purpose. Log retention periods and who may read these logs are decisions for your privacy and compliance owners to confirm, and they should be written down before the first dashboard is built. Also confirm that the front end's own conversation history, which many chat interfaces store, is covered by the same rules as the proxy logs.
How the identity setup changes by environment
On a single workstation or lab host, Ollama usually keeps its default bind to 127.0.0.1:11434, so the API is reachable only from that machine. Adding identity means deciding whether anyone else needs access at all. If they do, the usual pattern is a reverse proxy such as Nginx on the same host, which Ollama's FAQ describes as a way to expose the server, with the proxy listening on the network interface and Ollama left on loopback. The identity provider is reached over the public internet or the lab network from the proxy, and certificates are often self-signed or issued by a small internal authority, which makes trust errors more likely on client machines.
- Exposure: Only the proxy port should listen beyond loopback. Confirm that
OLLAMA_HOSTis not set to an address that bypasses the proxy. - Proxy placement: The proxy and Ollama share one host, so a single failure or update affects both.
- Certificates: Self-signed certificates tend to be accepted by one tester and rejected by others. Distribute the CA to every client.
- Identity provider reach: Confirm that the host can resolve and reach the identity provider's metadata and token endpoints.
- Hard to verify: Behavior with other users' machines and browsers, since lab tests often use a single account.
Before relying on this setup, test login from a machine that was not used to build it and confirm that a direct request to port 11434 from another host fails.
On a container host, Ollama runs inside Docker or a similar runtime, and the bind address and port mapping decide what is exposed. Ollama's FAQ describes setting the bind address with OLLAMA_HOST, and inside a container that value must be set so the process listens on an interface the container network can reach. The proxy is usually a separate container on the same network, or a host-level proxy that forwards to the container. Identity configuration lives in container configuration, environment files and secrets, which changes how certificates and client secrets are mounted and rotated.
- Exposure: Publish only the proxy's port with the container runtime. Avoid publishing 11434 to the host network interfaces.
- Proxy placement: Run the proxy as its own container or on the host, and keep it on a defined internal network with Ollama.
- Certificates: Mount certificate files read-only and document the path. Rebuilding the image should not be the only way to replace a certificate.
- Identity provider reach: Container DNS and egress rules often differ from the host, so test name resolution from inside the proxy container.
- Hard to verify: Whether model storage and proxy configuration survive container recreation, and whether a restart changes which configuration is active.
Confirm the image version you run, since Ollama publishes frequent releases, and test the full login path again after each image change.
In a private or air-gapped network, the identity provider may sit on the same internal network as Ollama, so the login path stays inside the organization and does not need internet egress. That removes some risks but adds others: there is no public certificate authority to fall back on, updates and metadata must be moved in by approved means, and the network team often controls the firewall rules that decide whether the proxy can reach the identity provider. Ollama's FAQ states that cloud features can be disabled with OLLAMA_NO_CLOUD=1 or the server configuration file, which matters when the host must not make outbound calls.
- Exposure: Restrict access to the proxy by network segment and confirm that no other service path reaches port 11434.
- Proxy placement: Place the proxy in a zone that can reach both the users and the identity provider, and keep Ollama in a zone that only the proxy can reach.
- Certificates: Use the internal certificate authority and confirm how revocation checks behave without internet access.
- Identity provider reach: Confirm which internal endpoints the proxy needs, including metadata, keys and token endpoints, and record them in the firewall change.
- Hard to verify: Behavior after a certificate renewal or identity provider key rotation, which may not be visible until users are locked out.
Set OLLAMA_NO_CLOUD=1 where cloud features are not wanted, then confirm with the network team that the host makes no unexpected outbound connections.
What drives the effort of adding Ollama SSO
This table lists the factors that change how much work it takes to put single sign-on and per-user logging in front of Ollama, with a way to keep each one down. No price or duration is given here, so read it as a checklist for scoping, not as an estimate. A fixed-scope quote should list each driver in writing with its assumed value.
| Driver | Why it changes effort | How to keep it down |
|---|---|---|
| Number of users and groups | Each group needs a mapping from the identity provider to an access rule on the proxy or front end, and more groups mean more testing of who can reach which model. | Reuse existing directory groups and map a small number of roles, such as general users and administrators. |
| Number of client applications and front ends | Every application that calls Ollama, or every chat front end, may need its own authentication setup, headers or API key handling. | Standardize on one chat front end and one gateway so that all traffic passes through a single control point. |
| Existing identity provider and integration status | If the identity provider already serves other internal apps through OpenID Connect or SAML, the work is configuration. If not, a new client registration and trust setup is needed. | Confirm early whether the identity provider already issues tokens for your proxy or front end and reuse that integration. |
| Need for per-user logs | Attributing each request to a person requires the proxy or front end to pass a verified user identity into logs, and log retention rules must be defined. | Decide which fields are required (user, model, time, request size) and use one log destination for all environments. |
| Number of environments (lab, test, production) | Each environment needs its own hostnames, client registrations, certificates and test users, so the setup is repeated and verified separately. | Keep the same proxy configuration in every environment and change only hostnames and secrets through variables. |
| Network and certificate work | The Ollama server listens on 127.0.0.1 port 11434 by default, so exposing it through a proxy changes bind addresses, firewall rules and TLS certificates. Each change needs review by the network team. | Keep Ollama on the local bind where possible, place the proxy in front of it on the same host or a single private subnet, and use certificates from your existing issuer. |
| Compliance evidence required | If an assessor needs records of access reviews, log samples or configuration baselines, the team must produce and retain them, which adds documentation and testing time. | Ask the assessor early which evidence they expect and build log and configuration exports into the initial design. |
| API key handling for non-browser clients | Scripts and services that cannot complete a browser login need separate keys, their own rotation process and a way to revoke them. | Limit the number of automated clients and issue one key per service with a named owner. |
How to secure the identity layer and its secrets
Ollama's local API has no authentication of its own, so the identity layer you put in front of it carries the whole access decision. The controls below connect the network path, the proxy, the credentials and the cloud settings, and each one should be tested before users depend on it.
Keep the Ollama port off user networks
Ollama binds to 127.0.0.1 on port 11434 by default. When you change the bind address with OLLAMA_HOST so the reverse proxy can reach it, confirm that the port is reachable only from the proxy host or private subnet and not from user networks. A direct connection that skips the proxy bypasses every SSO and key check in front of it. Test this from a user network and from outside the perimeter, and expect the connection to fail.
Ollama FAQEnforce TLS at the proxy
Terminate TLS at the reverse proxy so that bearer tokens, API keys and prompts never cross the network in clear text. Use certificates issued by your internal or public CA, disable older protocol versions, and confirm that plain HTTP on the same listener is refused or redirected. Ollama itself does not supply this layer, so the proxy configuration is the control to review and retest after every change.
Validate credentials on every request
The proxy should check a token or API key on each request, not only when a session starts. Confirm that expired, revoked and malformed credentials are rejected, that the check covers streaming and OpenAI-compatible routes as well as the native API, and that no route is left open by a path rule. Test with each route your clients use, since a single unprotected path exposes the model to anyone who finds it.
Ollama API authenticationStore keys and client secrets in a vault
Keep API keys and OIDC client secrets in a secrets manager, not in proxy config files, shell profiles or client applications. Set a rotation schedule, and make sure you can revoke one user's key or one client's secret without a restart that affects everyone. Ask who can read the secret store, and confirm that revoked credentials stop working at the proxy within the time you expect.
Strip identity headers from inbound traffic
If the proxy passes a user identity to Ollama or to a chat front end in a header, any client can send that header itself and claim to be someone else. Configure the proxy to remove identity headers from inbound requests and set them only after authentication succeeds. Test by sending a request with a forged user header from an authenticated low-privilege account and checking that the logs record the real user.
Disable cloud features for local-only use
Ollama's cloud features call an external service, and direct cloud inference uses an API key sent as a Bearer token. Where the deployment must stay local, set OLLAMA_NO_CLOUD=1 or the equivalent in the server configuration file, then confirm that the server does not reach out to external endpoints and that no cloud model can be selected from a client. Keep this setting under configuration management so an upgrade does not silently reset it.
Ollama FAQHow to test that Ollama SSO works and fails closed
The point of this section is that a reviewer should be able to show, with recorded results, that nobody reaches the model without an identity, that the identity is logged, and that failures deny access. Start with the paths that should be refused. Send an unauthenticated request to the proxy's public address and expect a refusal. From a user network, send a direct request to the Ollama port, which listens on 127.0.0.1:11434 by default, and to any address where the server was bound with OLLAMA_HOST. Because the local API has no authentication of its own, the only acceptable result is a failed connection. Record the exact command, the source network, the response code and the time of each test.
Next, test the credentials. Use an expired or revoked API key or an expired SSO session and confirm the proxy refuses it. Then use a valid credential for a named user and confirm the request succeeds. Check the access log entry for that request and confirm it carries that user's identity, not a shared service account. Finally, disable or remove a test user in the identity provider, wait for the session or token to lapse, and confirm access stops. Build the matrix so each client path (the browser chat front end, SDK calls, scripts and any OpenAI-compatible application) gets its own row, since each may authenticate differently. Keep the results with timestamps as evidence for the security review.
Finally, test failure modes. Stop the proxy or its identity dependency and confirm that requests fail closed: the Ollama port must still be unreachable from user networks, and no fallback path should serve traffic without authentication. Repeat the test after restarts and after a configuration reload. Ask your implementation partner or internal team to confirm in writing how the proxy behaves when the identity provider cannot be reached, because that behavior depends on the chosen proxy and is not something this page can assume. Keep these results with the others so the evidence shows both the normal path and the failure path.
Questions teams ask about Ollama SSO and identity integration
Does Ollama have built-in user login or SSO?
No. The local Ollama API at localhost:11434 does not require authentication, so anyone who can reach that port can send requests. Ollama binds to 127.0.0.1 by default, which limits access to the local machine. Once you expose it to a network, you need a layer in front of it that checks identity. That layer is usually a reverse proxy such as Nginx, combined with SSO through your identity provider or with API keys issued by the proxy. Ollama itself does not provide user accounts, group mapping or login pages, so plan for these controls to live outside the Ollama process.
Can our own team build Ollama SSO without a partner?
Often yes, if your team already runs a reverse proxy and manages an identity provider. The work is standard in shape: move Ollama off the default bind address, put a proxy with TLS in front of it, connect the proxy to your identity provider, and add logging. The hard parts are usually not the Ollama settings but the details around them: correct group-to-access mapping, token handling for the chat front end, and making sure no route bypasses the proxy. Teams without these skills in-house, or with a tight deadline for a security review, often bring in an outside implementer for a fixed scope. Decide based on who will own the configuration after go-live.
What does the work need from our side?
Expect to provide four things. First, administrative access or a named owner for your identity provider, so the team can register the Ollama proxy as an application and map groups to access. Second, network changes approved by your network and security teams, such as which hosts may reach the Ollama server and which ports the proxy listens on. Third, a log destination, meaning your SIEM or central log store, with a retention period set by your security policy. Fourth, a small set of test users in each access group, so you can confirm that allowed users succeed and others are refused. Ask for this list in writing before the work starts.
How long does Ollama SSO integration take, and what drives it?
The duration depends on the factors below more than on Ollama itself, so no fixed figure applies across environments. The main drivers are the number of identity providers and groups, whether you need SSO, API keys or both, how many clients and front ends connect, how quickly your network and change approvals move, and how complete your log pipeline already is. Each of these adds review and testing time. Ask any implementer for a schedule that lists these dependencies separately, and confirm which of them your organization controls. A fixed-scope quote should state what is in and out of the integration.
Can we use Ollama cloud API keys instead of building our own login?
Not for this purpose. Ollama's documentation describes API keys for direct cloud inference at ollama.com/api and ollama.com/v1, where the key is sent as a Bearer token. Those keys authenticate requests to Ollama's hosted service, not your local server. Using them would send your prompts to the cloud, which conflicts with running models on your own hardware. If you need to control who can call a local Ollama server, the controls must sit in your proxy and identity provider. Cloud keys and the pricing plans, including the Enterprise plan's model access controls and per-user budgets, are separate decisions that apply to cloud models only.
What should we confirm with a chat front end vendor before buying?
Confirm how the front end authenticates users before you buy. Ask whether it supports your identity provider protocol, whether it can pass identity through to the proxy, and whether it can use an OpenAI-compatible or Ollama endpoint behind your gateway. Ask where chat history and uploaded files are stored, who can read them, and how they are deleted. Check whether the vendor's logs record the user, model and request time, and whether they can be exported. Finally, ask how the product handles updates, since its release cycle may not match Ollama's. Get the answers in writing and test them against a non-production environment first.
How do we log which user sent which request to Ollama?
Ollama's local API does not record user identity, so the record must come from the layer in front of it. Configure the reverse proxy to log the authenticated user, the client address, the time, the path and the response status for each request. Forward those logs to your central store and set retention according to your policy. Be aware that request bodies may contain sensitive prompts, so decide whether to log content at all and restrict access to the logs. Test the setup by sending requests as two different users and confirming that each entry names the correct person.
How DeployOpen scopes, builds and hands over Ollama identity work
DeployOpen plans and builds Ollama SSO and identity integration inside your own infrastructure, placing an authenticated layer in front of the local API that has no authentication of its own. Each engagement starts with a written scope, and the work ends with documentation and a handover your team can run.
How we scope
- Confirm which identity provider, user groups and login flows the Ollama front end must accept.
- Map which users, teams and applications need model access, and which need only API keys.
- Agree in writing the proxy, chat front end, logging destination and test scope before work starts.
How we build
- Keep Ollama bound to its local address and place the reverse proxy as the only network entry point.
- Configure SSO or API key checks at the proxy, then connect the chat front end to the same identity source.
- Enable request logging that records the user identity for each call, and test the access rules before go-live.
How we hand over
- Deliver configuration files, proxy rules and a record of which groups map to which model access.
- Document the logging fields, where logs are stored and how to review who sent which requests.
- Walk your operations and security teams through the runbook, including how to add or remove users.
How we support
- Engagements are fixed-scope, with deliverables and timelines agreed in writing before work starts.
- Ongoing support, upgrades and continuous testing are available as a retainer after handover.
- Ask us to confirm how identity changes will be retested when Ollama or the proxy is upgraded.

