mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2026-04-25 09:25:55 +03:00
[PR #433] [MERGED] Add the ability to secure proxy hosts with OpenID Connect #3247
Labels
No labels
awaiting feedback
bug
cannot reproduce
dns provider request
duplicate
enhancement
enhancement
enhancement
good first issue
help wanted
invalid
need more info
no certbot plugin available
product-support
pull-request
question
stale
troll
upstream issue
v2
v2
v2
v3
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/nginx-proxy-manager-NginxProxyManager#3247
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/NginxProxyManager/nginx-proxy-manager/pull/433
Author: @Subv
Created: 5/29/2020
Status: ✅ Merged
Merged: 6/8/2020
Merged by: @jc21
Base:
openidc← Head:oidc📝 Commits (10+)
46a2911Add UI tab for specifying OpenID Connect options for proxy hosts.102571fAdd database columns to store OpenID Connect information for Proxy Hosts.a2992aeUse OpenResty instead of plain nginx to support OpenID Connect authorization.69b56aeAdd a field to specify a list of allowed emails when using OpenID Connect auth.5a41fe9Allow limiting OpenID Connect auth to a list of users.8e1bfe5Manually set the default values for the OpenID Connect columns.4428b52Fix conditionals in the liquid template for OpenID Connect conf.878e164Updated the docs to add a section about OpenID Connectfe280a3Use localized strings for the OpenID Connect texts.9ee912bOpenIDC: Trigger the change event of the "restrict users" toggle when enabling/disabling oidc.📊 Changes
15 files changed (+495 additions, -5 deletions)
View changed files
➕
backend/migrations/20200522113248_openid_connect.js(+48 -0)➕
backend/migrations/20200522144240_openid_allowed_users.js(+40 -0)➕
backend/migrations/20200523114256_openid_default_values.js(+36 -0)📝
backend/models/proxy_host.js(+12 -1)📝
backend/schema/definitions.json(+37 -0)📝
backend/schema/endpoints/proxy-hosts.json(+96 -0)➕
backend/templates/_openid_connect.conf(+47 -0)📝
backend/templates/proxy_host.conf(+2 -0)📝
docker/Dockerfile(+1 -1)📝
docker/rootfs/etc/nginx/nginx.conf(+10 -0)📝
docs/advanced-config/README.md(+23 -0)📝
frontend/js/app/nginx/proxy/form.ejs(+66 -0)📝
frontend/js/app/nginx/proxy/form.js(+59 -2)📝
frontend/js/i18n/messages.json(+10 -1)📝
frontend/js/models/proxy-host.js(+8 -0)📄 Description
What is this?
This PR implements OpenID Connect authentication for proxy hosts using the lua-resty-openidc library, now that NPM uses OpenResty instead of vanilla nginx.
What is OpenID Connect?
OpenID Connect is an identity layer on top of OAuth2 that lets you do Single-Sign-On (SSO) using an identity provider (IdP) like Azure AD or KeyCloak.
How does this benefit me as an NPM user?
You will now be able to restrict access to your proxy hosts only to users who can successfully authenticate with the IdP. For example, only allow users in your Azure Active Directory to access your
internal-tool.example.comsubdomain.Work in progress
I would like to ask for some help with the UI layout, it currently looks kind of out of place (screenshots below).
Future improvements
These are things that could be improved upon but will probably be added in a separate PR.
openid email profile.id_tokenclaims to pass to the backend application, or maybe simply forward the entireid_token.client_secret_postandclient_secret_basic.Related issues
How to use it
You will need a few things to get started with OpenID Connect:
A registered application with your identity provider, they will provide you with a
Client IDand aClient Secret. Public OpenID Connect applications (without a client secret) are not yet supported.A redirect URL to send the users to after they login with the identity provider, this can be any unused URL under the proxy host, like
https://<proxy host url>/private/callback, the server will take care of capturing that URL and redirecting you to the proxy host root. You will need to add this URL to the list of allowed redirect URLs for the application you registered with your identity provider.The well-known discovery endpoint of the identity provider you want to use, this is an URL usually with the form
https://<provider URL>/.well-known/openid-configuration.After you have all this you can proceed to configure the proxy host with OpenID Connect authentication.
You can also add some rudimentary access control through a list of allowed emails in case your identity provider doesn't let you do that, if this option is enabled, any email not on that list will be denied access to the proxied host.
The proxy adds some headers based on the authentication result from the identity provider:
X-OIDC-SUB: The subject identifier, according to the OpenID Coonect spec:A locally unique and never reassigned identifier within the Issuer for the End-User.X-OIDC-EMAIL: The email of the user that logged in, as specified in theid_tokenreturned from the identity provider. The same value that will be checked for the email whitelist.X-OIDC-NAME: The user's name claim from theid_token, please note that not all id tokens necessarily contain this claim.Screenshots
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.