-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to disable local login #13606
Comments
+1. 1 year and still no response from the Gitea team. For how long we'll be waiting? This request is pretty valid. |
Unfortunately none of us are paid to work on Gitea, we are all volunteers. Alternatively, putting a bounty on an issue has worked to get things done more quickly in the past. |
Oh, fair enough. I'll try to give it a shot, I'm starting to move from GitLab and I'm in the process of securing everything first. I think a bounty could be useful for this too, it's a good idea to disable local logins once you've set up another authentication mechanism. If something fails you still have |
@darkguy2008 we are facing the same problem I think. Just share some background here: The login module of Gitea is quite complex, and it is more complex now because more options are introduced like I just proposed a PR about Enforce 2FA (#16880) but it seems difficult to be merged into main branch, so I just use my patch for my private server. To resolve the login problems fundamentally, I think we should make a global plan and design first, otherwise many features may conflict or may bring security risks. Maybe we also need a leader for login related features. 😊 |
This sounds very useful maybe I'll work on it in the near future? |
Maybe just add a option to hide it and put it on a different URL. So its still available but most users wont see it. |
In the meantime, you could use an http redirect from …
labels:
…
- "traefik.http.routers.gitea.middlewares=gitea-login-redirect"
- "traefik.http.middlewaresgitea-login-redirect.redirectregex.regex=^https://gitea.redacted.tld/user/login*"
- "traefik.http.middlewares.gitea-login-redirect.redirectregex.replacement=https://gitea.redacted.tld/user/oauth2/Authentik-oid"
…
I imagine this would work for other webservers and reverse proxies as well. |
@dodedodo For authentik are you using the oidc connector for gitea logins ? |
@techknowlogick Yes I am. There's a very detailed guide in the authentik documentation. |
@dodedodo oh wow. Thanks for linking that <3 |
Really surprised I didn't think of using a redirect on my reverse proxy. Thanks 👍 |
Thank you, this works. For anyone using Caddy, I did it like this:
Authelia is the name of the authentication provider I configured in Gitea, change it accordingly. |
For anyone using NGINX as a proxy, use this:
Or at |
Sign Out -> Homepage -> Login -> Again Logged In ) |
What's your point? Be clear please. |
Can't sign out, instant redirect by chain above |
If you mean that, when you manually click on login, you are automatically logged in without needing to do anything, then that's normal. You are still logged in with your oauth2 provider and thus, when you go to the login page and are getting redirected to So by the process of logging out of gitea and then clicking login, you will most likely, unless your auth provider is set up to always ask you for permission, be logged in without needing to do anything. If you wish that logging out of gitea will require entering a password etc. to log back in, you need to log out of your oauth2 provider too. oauth2 can do this automatically, but it seems like gitea does not fully support that yet. See #14270. I am still a noob when it comes to oauth2 and that whole realm, so I might be totally wrong here. The way I described it is the way it works on my server. |
Works like a charm. Might not be an option if you use multiple OAuth2/OpenID providers. |
How would you do this for apache2, can't seem to figure it out
|
Here's a resource definition for k8s apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
ingressClassName: nginx
nginx.ingress.kubernetes.io/rewrite-target: /user/oauth2/<your oauth2 provider name>/$2
nginx.ingress.kubernetes.io/use-regex: "true"
name: rewrite
namespace: gitea
spec:
rules:
- host: <gitea url>
http:
paths:
- backend:
service:
name: gitea-http
port:
number: 3000
path: /user/login.*$
pathType: Prefix
tls:
- hosts:
- <gitea url>
secretName: <gitea url>-tls |
For anyone using Nginx Proxy Manager you can add the following in the Advanced tab of your Proxy Host:
|
Gitea 1.21.5, Keycloak 23.0.7, Traefik 2.10.5, Kubernetes.
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
name: gitea
spec:
routes:
- kind: Rule
match: Host(`gitea.example.org`)
services:
- name: gitea
port: http
- kind: Rule
match: Host(`gitea.example.org`) && Path(`/user/login`)
middlewares:
- name: gitea-login-replace
services:
- name: gitea
port: http apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: gitea-login-replace
spec:
replacePath:
path: /user/oauth2/keycloak |
@tuxmainy Theres a tiny typo in your second label, the dot is missing. Got confused because it did not work properly in my project |
Hi and thanks for all your suggestions.
Any idea? |
Looks like it works with redirect instead of last (don't know what last does). Regards, Flo. |
Closed by #31535 |
I was mistaken - this isn't fully closed, but there should now be enough supporting code that implementing this would not be too difficult if someone wants to take this on. |
@flotpg, I faced the same issue with |
Description
When using gitea in an environent (e.g. corporate deployment) when SSO login is required, it would be nice to have a way to disable local login, to not have a confusing login-page, which can't be used.
A nice extra would be that, when only one authentication-source is configured, clicking on the "Sign in" button on the header automatically redirects to the IdP/SSO.
The text was updated successfully, but these errors were encountered: