Skip to content

Added smtpd_sender_login_maps#825

Closed
TechnicLab wants to merge 12 commits intodocker-mailserver:masterfrom
TechnicLab:master
Closed

Added smtpd_sender_login_maps#825
TechnicLab wants to merge 12 commits intodocker-mailserver:masterfrom
TechnicLab:master

Conversation

@TechnicLab
Copy link
Copy Markdown
Contributor

Added smtpd_sender_login_maps for reject_sender_login_mismatch postfix option.

Added smtpd_sender_login_maps.
@johansmitsnl
Copy link
Copy Markdown
Contributor

This file does not needs to be only set when using ldap?

@TechnicLab
Copy link
Copy Markdown
Contributor Author

Totally forgot about it - yes, this modification is for ldap. Not sure where to find file with those contents without ldap:
"The controlled_envelope_senders table specifies the binding between a sender envelope address and the SASL login names that own that address:

/etc/postfix/controlled_envelope_senders
# envelope sender owners (SASL login names)
[email protected] [email protected]
[email protected] [email protected], [email protected]
postmaster [email protected]
@example.net barney, fred, [email protected], [email protected]
"

@johansmitsnl
Copy link
Copy Markdown
Contributor

So this can be merged or are changes still needed?

@TechnicLab
Copy link
Copy Markdown
Contributor Author

Now it works in my ldap setup. Waiting for tests.

@17Halbe
Copy link
Copy Markdown
Contributor

17Halbe commented Feb 12, 2018

Can you please check if this would work with ldap as well. Otherwise we would have to differentiate between ldap and non ldap builds.

Please see the comments.

@TechnicLab
Copy link
Copy Markdown
Contributor Author

A am a beet confused. You would like me to check your solution from comment in another pull request? I will test it when I will be near PC.

1 similar comment
@TechnicLab
Copy link
Copy Markdown
Contributor Author

A am a beet confused. You would like me to check your solution from comment in another pull request? I will test it when I will be near PC.

@17Halbe
Copy link
Copy Markdown
Contributor

17Halbe commented Feb 12, 2018

Sorry for the confusion..
Yes, exactly! That would be great.
Your PR is only working for ldap users. So in case we would implement smtpd_sender_login_maps for everyone else as well, we would have to distinguish upon server start, which mapping file we need to use.
(Depending if that's a ldap or a "standard" setup)
So, if the regex suggestion works for you/ldap as well, than we just need this one mapping file for everyone.

I hope this was less confusing!

@johansmitsnl
Copy link
Copy Markdown
Contributor

@TechnicLab could you fix the conflict?

@johansmitsnl
Copy link
Copy Markdown
Contributor

Almost all tests fail, looks like a typo somewhere?

Comment thread target/postfix/main.cf Outdated
smtpd_sasl_path = /var/spool/postfix/private/auth
smtpd_sasl_type = dovecot

smtpd_sender_login_maps = ldap:/etc/postfix/ldap-senders.cf
Copy link
Copy Markdown
Contributor

@17Halbe 17Halbe Feb 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try to exchange this line with this:

smtpd_sender_login_maps = pcre:/etc/postfix/ldap-senders.cf

Does it still work with those changes?

Comment thread target/postfix/ldap-senders.cf Outdated
search_base = ou=people,dc=domain,dc=com
server_host = mail.domain.com
start_tls = no
version = 3
Copy link
Copy Markdown
Contributor

@17Halbe 17Halbe Feb 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And replace this file with just this one line:

/^(.*)$/   ${1}

@17Halbe
Copy link
Copy Markdown
Contributor

17Halbe commented Feb 12, 2018

I'm sorry, I didn't commit the Review process.. I'm feeling your confusion now!! :D My apologies!

Is it clearer now with the code changes I suggested?

@TechnicLab
Copy link
Copy Markdown
Contributor Author

TechnicLab commented Feb 13, 2018

Actually there was no confusion anymore, it was too late in my time zone. Unfortunately stilll not near PC(

@TechnicLab
Copy link
Copy Markdown
Contributor Author

Unfortunately it is not working with my ldap setup. I guess we need to separate ldap and simple configurations.

@johansmitsnl
Copy link
Copy Markdown
Contributor

I personally use ldap but I don't encounter any issues at the moment with master. Does this mean the restriction is not working?

ps. I have extracted the ldap service in this project in it own docker: https://hub.docker.com/r/jsmitsnl/docker-openldap-postfix-book

@TechnicLab
Copy link
Copy Markdown
Contributor Author

TechnicLab commented Feb 14, 2018

I manually added changes from 17Halbe and they lead to inability to send any mail. In current master you can still send messages from any email. This pull originally fixed this issue but only for ldap setups.

@johansmitsnl
Copy link
Copy Markdown
Contributor

Ok, why do the tests for this PR fail do you know why?

@TechnicLab
Copy link
Copy Markdown
Contributor Author

Actually I have no idea.

@17Halbe
Copy link
Copy Markdown
Contributor

17Halbe commented Feb 15, 2018

Ok thanks for trying.. Shouldn't this be the default(not letting every signed in user spoof its address)?

@TechnicLab
Copy link
Copy Markdown
Contributor Author

No, this is not the default behavior.

@17Halbe
Copy link
Copy Markdown
Contributor

17Halbe commented Feb 15, 2018

I know, but IMHO it should be!
\So it has to be implemented for everyone else as well!

@TechnicLab
Copy link
Copy Markdown
Contributor Author

I absolutely agree with you, but maybe there is a reason for such default configuration?

@TechnicLab
Copy link
Copy Markdown
Contributor Author

warning: pcre map /etc/postfix/sender.cf, line 1: no closing regexp delimiter "+": ignoring this rule. It looks like there is an error with your regexp.

@17Halbe
Copy link
Copy Markdown
Contributor

17Halbe commented Feb 15, 2018

You copied the + from the comment as well.. Which is actually great, since this leaves a silverlining, that it will still probably work. ;o)
Just remove the leading + from the expression! Does it work?

@TechnicLab
Copy link
Copy Markdown
Contributor Author

TechnicLab commented Feb 15, 2018

Great! It is working now.

@TechnicLab
Copy link
Copy Markdown
Contributor Author

Well, this pull request can be merged when we will determine why it is causing tests failitures.

@17Halbe
Copy link
Copy Markdown
Contributor

17Halbe commented Feb 16, 2018

Can you add a testcase for a user spoofing it's address?

Edit: Do the tests pass on your machine?

@TechnicLab
Copy link
Copy Markdown
Contributor Author

I am making changes mainly online on GitHub without cloning repo, so I can’t check whatever test work locally or not. I will look into projects’s tests closer and will try to create spoofing test.

@17Halbe
Copy link
Copy Markdown
Contributor

17Halbe commented Feb 17, 2018

Did you check, if you could still receive mail from a foreign address? I think this is actually be blocking anyone sending mails to the server, except those logged in.
If that's the case(which I am pretty sure of), try replacing reject_sender_login_mismatch with reject_authenticated_sender_login_mismatch

@TechnicLab
Copy link
Copy Markdown
Contributor Author

Looks like you are right, my test container rejects mail from foreign addresses.

@17Halbe
Copy link
Copy Markdown
Contributor

17Halbe commented Feb 18, 2018

and reject_authenticated_sender_login_mismatch? Does that work as expected?

@TechnicLab
Copy link
Copy Markdown
Contributor Author

TechnicLab commented Feb 18, 2018

Sorry, it was late yesterday. Replaced reject_sender_login_mismatch with reject_authenticated_sender_login_mismatch.

@17Halbe
Copy link
Copy Markdown
Contributor

17Halbe commented Feb 18, 2018

/etc/postfix/senders.cf: No such file or directory
Modify the Dockerfile to copy that file over to the container

@TechnicLab
Copy link
Copy Markdown
Contributor Author

Thats's strange: ldap tests failed but it works locally.

@johansmitsnl
Copy link
Copy Markdown
Contributor

@TechnicLab Could you fix the conflict and update the branch for a retest?

@TechnicLab
Copy link
Copy Markdown
Contributor Author

Well, it should work now. I will add tests today.

@johansmitsnl
Copy link
Copy Markdown
Contributor

johansmitsnl commented Mar 2, 2018

@TechnicLab love to merge the PR, could you inform me about the state of adding tests?
Does it change default behaviour when this is merged?

@TechnicLab
Copy link
Copy Markdown
Contributor Author

I’m sorry, I am currently ill and was not in great working condition.

@johansmitsnl
Copy link
Copy Markdown
Contributor

@TechnicLab hope you get well soon

@17Halbe
Copy link
Copy Markdown
Contributor

17Halbe commented Mar 3, 2018

@TechnicLab Would you mind, if I give it a try?

@17Halbe
Copy link
Copy Markdown
Contributor

17Halbe commented Mar 4, 2018

@TechnicLab I hope you don't consider this being rude, I just needed some distraction from work and for a change wanted to contribute to something useful! 😉
So I continued your work and provided a PR here: #872

@17Halbe
Copy link
Copy Markdown
Contributor

17Halbe commented Mar 7, 2018

Since #872 has been merged, this can be closed, right?

@erik-wramner
Copy link
Copy Markdown
Contributor

Closing due to no response, probably fixed by #872.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants