Skip to content
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

Ability to enforce two-factor authentication #880

Open
minecrafter opened this issue Feb 9, 2017 · 26 comments
Open

Ability to enforce two-factor authentication #880

minecrafter opened this issue Feb 9, 2017 · 26 comments
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/feature Completely new functionality. Can only be merged if feature freeze is not active.

Comments

@minecrafter
Copy link
Contributor

minecrafter commented Feb 9, 2017

Currently, two-factor authentication is optional. It would be nice if we had a global (site) or per-organization setting to enforce two-factor authentication.

  • Global: If you log in and do not have two-factor authentication, you will be forced to enroll when you log in.
  • Organization: You can not join an organization until you enable two-factor authentication. Existing members without two-factor authentication will be forced to turn it on (GitHub removes users from the organization).
@lunny lunny added this to the 1.x.x milestone Feb 9, 2017
@lunny lunny added the type/feature Completely new functionality. Can only be merged if feature freeze is not active. label Feb 9, 2017
@bkcsoft
Copy link
Member

bkcsoft commented Feb 12, 2017

As for per-organization change, I propose that if you login w/o 2FA enabled you're account will be redirected to /user/settings/two_factor with an option to leave the "offending" organization :)

Obviously the 2FA-page would need an update to list orgs (that require 2FA) to leave if you disable 2FA.

@elvarb
Copy link

elvarb commented Dec 12, 2017

This feature is very important for overall security.

Best way to implement it would be to have it a part of Authenticators settings, that way you can for example require 2fa for ldap imported users while having it optional for local users.

@yarumair
Copy link

yarumair commented Dec 3, 2018

Just wondering if this is implemented as i think its pretty nice feature to have within an organization

@stale
Copy link

stale bot commented Feb 3, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale stale bot added the issue/stale label Feb 3, 2019
@lunny lunny added issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented and removed issue/stale labels Feb 3, 2019
@9thWonderAgency
Copy link

I am but a simple Gitea user, would like to voice that my organization would also find this a very important feature. Please!

@zeripath
Copy link
Contributor

Ok if we're gonna do this we need to think about what happens if a user tries to login without two factor.

Is it that they get redirected immediately to the enroll 2fa page similar to the must change password screen?

@tomposmiko
Copy link

It would already be enough if we could enforce the setting for each user one by one.
Would that be easier to implement?

@MOZGIII
Copy link

MOZGIII commented Jul 16, 2020

Ok if we're gonna do this we need to think about what happens if a user tries to login without two factor.

Is it that they get redirected immediately to the enroll 2fa page similar to the must change password screen?

That would be reasonable.
It is also a good idea to allow specifying a time duration since registration until the 2FA requirement starts blocking the access. I.e. you can do some limited things until this 2FA enforcement timeout without 2FA.

@njsubedi
Copy link

njsubedi commented Dec 29, 2020

Ok if we're gonna do this we need to think about what happens if a user tries to login without two factor.
Is it that they get redirected immediately to the enroll 2fa page similar to the must change password screen?

@zeripath I think the best way is to redirect to the 2FA Settings page, and show a message "Your administrator has made 2FA mandatory for all users who use $AUTHENTICATION_SOURCE authentication."

@andreas-bulling
Copy link

Any updates on this? This feature would also be super important for me. Thanks!

@lunny
Copy link
Member

lunny commented Oct 30, 2022

#16880 try to fix this but closed.

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Oct 30, 2022

That's an impossible task at the moment.

See #13606 (comment)

But if you are using Gitea for private usage, you can take the PR #16880 (build your own Gitea) , it works well for that case. I am keeping sync my 2FA branch with main branch.

I closed #16880 to reduce invalid pending PRs and avoid unnecessary CI resource consumption.

@OdinVex
Copy link

OdinVex commented Jan 13, 2023

Would like the ability to easily specify the algorithm, digit count, and period across the server.

@Mikaela
Copy link
Contributor

Mikaela commented Feb 22, 2023

Shouldn't this have been implemented before #22999 and #23023?

If the organisation requires 2FA, then everyone has it enabled and there is no question about it.

@lunny
Copy link
Member

lunny commented Feb 22, 2023

Shouldn't this have been implemented before #22999 and #23023?

If the organisation requires 2FA, then everyone has it enabled and there is no question about it.

Users could enable 2FA in their settings, but no option for the organization/team to enforce that.

@brechtvl
Copy link
Contributor

brechtvl commented Feb 23, 2023

For organizations, I think it would be better to make the member somehow inactive until they enable 2FA. And then users can add 2FA or remove themselves from the organization when they want to.

Organizations shouldn't have the power to disrupt a user's login in my opinion. Also for API application access, one organization adding an 2FA requirement should not block access entirely, so you would need a concept of inactive membership in only some organizations anyway.

Or just removing the member of course, it's just a bit less convenient. Then the member can not fix the problem themselves but rather has to ask the owner to add them again.

@lunny lunny removed this from the 1.x.x milestone Mar 20, 2023
@ruess
Copy link

ruess commented May 22, 2023

For organizations, I think it would be better to make the member somehow inactive until they enable 2FA. And then users can add 2FA or remove themselves from the organization when they want to.

To me this is a logical and easy way to implement this. We don't have to mess with the current login system, but can simply restrict the user's capabilities until they enable 2FA.

@OdinVex
Copy link

OdinVex commented May 22, 2023

I think it might be good to hide the fact that 2FA isn't enabled for a user from other entities, so that Organizations can't probe accounts to figure out if they have 2FA (at least until they become a member with 2FA?)? Rogue Organizations, I'm thinking.

@csteaderman
Copy link

Any status/progress on this issue?

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Aug 25, 2023

No, but you could build your own binary by my patch #16880 (there are design details) / https://github.com/wxiaoguang/gitea/tree/enforce-2fa

@csteaderman
Copy link

No but you could build your own binary by my patch #16880 https://github.com/wxiaoguang/gitea/tree/enforce-2fa

Does your patch enforce site wide 2FA, or is it per-organization? Is there a PR to merge this into the main source?

@rudolphfroger
Copy link

Apparently this feature is now advertised as a Gitea Enterprise edition advantage, so I assume this feature won't happen in the open source edition?

@prologic
Copy link

prologic commented Mar 9, 2024

Why would this be an Enterprise-only feature?

@rudolphfroger
Copy link

Sorry, I didn't include a reference: https://blog.gitea.com/gitea-enterprise/

@techknowlogick
Copy link
Member

It will certainly be added to the project, or at the very least, I hope it will be, as any contribution needs to follow the contribution guidelines and the process outlined in the document. The status of the code in the commercial offering from CommitGo, is that it was developed for a customer, and we are working with them to ensure that the code can and does meet the DCO that Gitea requires of any contribution. I believe the PR linked above can still be applied to a Gitea build, and will meet your needs. From the comments on it, a different approach and changes elsewhere in the system may be the path forward that the project will take, as a proposal for a working group to discuss was suggested.

@prologic
Copy link

Good to hear 👌 I may have to increase my monthly donations 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/feature Completely new functionality. Can only be merged if feature freeze is not active.
Projects
None yet
Development

No branches or pull requests