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

Restrict smtp auth to specific domains #1620

Closed
joubertredrat opened this issue Sep 11, 2015 · 12 comments
Closed

Restrict smtp auth to specific domains #1620

joubertredrat opened this issue Sep 11, 2015 · 12 comments
Labels
🎯 feature Categorizes as related to a new feature status: needs feedback Tell me more about it
Milestone

Comments

@joubertredrat
Copy link

Hi guys,

I'm testing Gogs here and it's amazing, I put the smtp authentication and works very fine, but I think I should have the option of restricting by domains optionally.

But, why?

If you have domain on Google Apps or Zoho Mail is necessary to restrict, else all users from this smtp can be login.

On my tests as example, I have 3 domains hosted on Zoho Mail and was possible to auth with all my domains, but I want to auth with only one domain.

Then I think that is good idea to restrict smtp auth with domains if is necessary.

I'm usgin Gogs v0.6.5.0815 Beta, SQLite3, Ubuntu 14.04.

Thanks

@unknwon unknwon added 🎯 feature Categorizes as related to a new feature status: needs feedback Tell me more about it labels Sep 11, 2015
@unknwon unknwon added this to the 0.7.0 milestone Sep 11, 2015
@unknwon
Copy link
Member

unknwon commented Sep 11, 2015

Hi, thanks your feedback!

Just to confirm that set Host value to a domain other than a IP address couldn't help in your case?

@joubertredrat
Copy link
Author

Hi @unknwon ,

I think that doesn't help, because is necessary to restrict by domain.

One example:
smtp.gogs.io have domains binslashbash.net, bsb.org, bsb.com.br, bsbash.me and anothers.

On my Gogs I add smtp.gogs.io and allow only binslashbash.net and bsb.org domains to login, then If I login with me@bsb.org, will login with success, If I login with contact@binslashbash.net, will login with success.
But, If I login with me@bsb.com.br or eu@bsbash.me will not login, because although bsb.com.br and bsbash.me is on smtp.gogs.io, domain bsb.com.br isn't allowed to login, only binslashbash.net and bsb.org is allowed.

@unknwon
Copy link
Member

unknwon commented Sep 11, 2015

@joubertredrat thanks for following up!

Does the following thing is what you want?

  • Add a field in SMTP form to specify a list allowed domains.
  • First check if e-mail address matches one of allowed domain before sending auth request to real SMTP server.

For example:

Allowed domains: binslashbash.net, gogs@binslashbash.net will approve, but gogs@bsbash.me will not.

@joubertredrat
Copy link
Author

Hi @unknwon

Exactly! You liked this? =)

@unknwon
Copy link
Member

unknwon commented Sep 11, 2015

Yes, I do, I'm working on it.

(PS: have to go to class right now)

unknwon added a commit that referenced this issue Sep 11, 2015
@unknwon
Copy link
Member

unknwon commented Sep 11, 2015

OK! Just pushed a quick fix to develop, please help test!

@joubertredrat
Copy link
Author

Hi @unknwon ,

I can develop only in PHP, javascript or bash, but I can help with test and translate :)

I will test here and talk here.

Thanks again

@joubertredrat
Copy link
Author

Hi @unknwon,

I did the tests here, worked very fine, thanks. I will provide Brazilian Portuguese translation for milestone.

There was only one problem in the test, but it is not related to this issue.

On my example I have e-mail redrat@gogs.io, when I login, Gogs creates user redrat. If I try to login with e-mail redrat@gogs.org, will not possible to login because Gogs reports that already exists user redrat, as a log below:

[Macaron] Started POST /user/login for 201.17.202.104
[Macaron] Completed /user/login 200 OK in 2.003552214s
2015/09/11 21:50:51 [W] Failed to login 'bsb@mydomain.top' via 'smtptest': user already exists: [name: bsb]

What do you think @unknwon? I open new issue about this or you think that isn't necessary?

@unknwon
Copy link
Member

unknwon commented Sep 12, 2015

On my example I have e-mail redrat@gogs.io, when I login, Gogs creates user redrat. If I try to login with e-mail redrat@gogs.org, will not possible to login because Gogs reports that already exists user redrat, as a log below:

It is unable to fix at current stage, because username is unique in database table.

@joubertredrat
Copy link
Author

Hi @unknwon,

No problem, this is very very small problem, just did it to see if I had need to inform you about this limitation.

@unknwon thanks again :)

@unknwon
Copy link
Member

unknwon commented Sep 12, 2015

@joubertredrat no problem 😄

@unknwon
Copy link
Member

unknwon commented Sep 13, 2015

Close as implemented.

@unknwon unknwon closed this as completed Sep 13, 2015
@unknwon unknwon modified the milestones: 0.8.0, 0.7.0 Oct 24, 2015
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🎯 feature Categorizes as related to a new feature status: needs feedback Tell me more about it
Projects
None yet
Development

No branches or pull requests

2 participants