Skip to content

Add default /etc/aliases for amavis, clamav. Add bsd-mailx.#1709

Closed
MakerMatrix wants to merge 4 commits intodocker-mailserver:masterfrom
MakerMatrix:issue-1701
Closed

Add default /etc/aliases for amavis, clamav. Add bsd-mailx.#1709
MakerMatrix wants to merge 4 commits intodocker-mailserver:masterfrom
MakerMatrix:issue-1701

Conversation

@MakerMatrix
Copy link
Copy Markdown
Contributor

Also fixed dovecot keygen so it doesn't generate an error msg about RANDFILE.

@georglauterbach
Copy link
Copy Markdown
Member

georglauterbach commented Dec 9, 2020

I like these changes - thanks for creating this PR:)

I've added some comments I'd like to resolve first, and I've requested a review from @erik-wramner as weill, which I would like to see before merging.

PS: I find it very nice that the key generation error is fixed! :D

@georglauterbach georglauterbach linked an issue Dec 9, 2020 that may be closed by this pull request
@MakerMatrix
Copy link
Copy Markdown
Contributor Author

On reviewing your comments I think it would be much better if we wrapped the the clamav alias inside an if stmt, to check whether the user asked for that feature or not. I put it in because I noticed that cron job(s) get run as the clamav user. But I guess only if user asked for that feature.

Comment thread Dockerfile Outdated
Comment thread target/start-mailserver.sh
@georglauterbach
Copy link
Copy Markdown
Member

georglauterbach commented Dec 9, 2020

On reviewing your comments I think it would be much better if we wrapped the the clamav alias inside an if stmt, to check whether the user asked for that feature or not. I put it in because I noticed that cron job(s) get run as the clamav user. But I guess only if user asked for that feature.

I accidentally did not press the submit button. You can now see my comments, sorry:) These are the ones I was referring to.

EDIT: But your idea is worth a shot - backwards compatibility and stuff...

@georglauterbach
Copy link
Copy Markdown
Member

In #1706 you mentioned that /etc/aliases is completely emptied on "check-for-changes.sh`-runs. I've already mentioned it in a comment - this causes some headache. I cannot confidently say whether this may break things.

@MakerMatrix
Copy link
Copy Markdown
Contributor Author

MakerMatrix commented Dec 9, 2020

In #1706 you mentioned that /etc/aliases is completely emptied on "check-for-changes.sh`-runs. I've already mentioned it in a comment - this causes some headache. I cannot confidently say whether this may break things.

Fair question, but if you look closely you see that line was already there - I only made the comment, and then added the two lines below to append amavis and clamav. It was always the case that /etc/aliases got recreated from scratch when these functions are called. There are some comments around this and a TODO about how the check-for-changes script overwrites things done by start-mailserver, and also about making these things atomic, here.

@georglauterbach
Copy link
Copy Markdown
Member

Oh my... I totally missed that. I didn't look close enough. Resolved:)

Comment thread target/start-mailserver.sh Outdated
Comment thread target/check-for-changes.sh Outdated
@georglauterbach
Copy link
Copy Markdown
Member

Looks somewhat fine to me now. As mentioned in #1706 I am not sure whether the change now adds the aliases for root, amavis and clam, but I really don't see why this would be case. So is this working?:)

@georglauterbach
Copy link
Copy Markdown
Member

georglauterbach commented Dec 18, 2020

What's the status here? @erik-wramner what do you think?

EDIT: I think it's fine to merge this for the moment. Only when #1721 is done, we will release 7.3, so changes here will definitely be stable after we reworked the aliases system.

Comment thread Dockerfile
@MakerMatrix
Copy link
Copy Markdown
Contributor Author

MakerMatrix commented Dec 21, 2020

Looks somewhat fine to me now. As mentioned in #1706 I am not sure whether the change now adds the aliases for root, amavis and clam, but I really don't see why this would be case. So is this working?:)

Yeah it works. In 1706 I had made some faulty assumptions about the default testing container config, just learning how to build and test. :). It was a simple matter of getting a a couple things configured away from defaults which in any real-world deployment would be the first things somebody would set.

@georglauterbach
Copy link
Copy Markdown
Member

@erik-wramner when you've reviewed this PR, feel free to either merge it or close it. SInce we are working on the alias code anyways, I will leave it up to you what to do with this PR.

Comment thread Dockerfile
Comment thread Dockerfile
chown -R clamav:root /var/log/mail/freshclam.log && \
mkdir -p /var/log/supervisor && \
touch /var/log/supervisor/supervisord.log && \
chown -R syslog:root /var/log/supervisor && \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please explain the need for this as well and how it is related to the aliases. It looks like you are trying to solve something, but what?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's not related to aliases, sorry. I believe I found errors in the logs where supervisord was throwing an error when trying to write to /var/log/supervisor/supervisord.log and it did not exist. I do apologize for not documenting this one better, I see I didn't even put a comment along with the PR and frankly even I cannot remember exactly where I found this one.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'll amend the first sentence of the previous to say that it was tangentially related to aliases in the sense that I found it when trying to discover exactly what was going on with aliases when supervisord brings up the mail service the first time after container creation. There are some conditions where they don't get added, which appear to be based on how some of the environment variables are set. I never narrowed it down further than that but thought it important for supervisord to be able to write its logs "out of the box"

fi

# Append external postifx aliases
if [[ -f /tmp/docker-mailserver/postfix-aliases.cf ]]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is probably fine, but we could check if postfix-aliases.cf has a mapping for amavis. Many existing installations may already have one (mine does). Not a big deal though, perhaps it is better to keep the code simple and write something about it in the README.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hmmm, mine didn't. My /tmp/dockermailserver/postfix-aliases.cf is empty. If that's a better place to do these, then by all means.

then
echo "clamav: ${POSTMASTER_ADDRESS}" >> /etc/aliases
fi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

See previous comment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ditto.

@erik-wramner
Copy link
Copy Markdown
Contributor

@aendeavor @MakerMatrix I don't understand what several of the changes are for. Perhaps the important fixes are done elsewhere? If so let's close this. If not feel free to motivate and perhaps we can merge instead. It feels as if the changes are trying to fix several things that are not related to the alias issue at all?

@georglauterbach
Copy link
Copy Markdown
Member

Very true. There are some hotfixes in here that could probably go in another PR, you're right. @MakerMatrix can explain them and then we can decide if we need another PR.

@MakerMatrix
Copy link
Copy Markdown
Contributor Author

At this point I think this can be closed out without merging. I will try to recreate the supervisord.log issue and open that as a separate PR after the migration to the docker-mailserver github account (will I know when that happens?). I think everything else here including the additional default aliases is being addressed in different fixes.

@MakerMatrix MakerMatrix closed this Jan 8, 2021
@georglauterbach
Copy link
Copy Markdown
Member

At this point I think this can be closed out without merging. I will try to recreate the supervisord.log issue and open that as a separate PR after the migration to the docker-mailserver github account (will I know when that happens?). I think everything else here including the additional default aliases is being addressed in different fixes.

A good decision. You will see when the repository migration is ready in the README and when the other PRs are all closed - just look out for that.

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.

amavis uid does not match ownership of /var/mail/amavis

4 participants