Showing posts with label postfix. Show all posts
Showing posts with label postfix. Show all posts

Tuesday, November 07, 2006

Postfix message and mailbox size limits

I learned some more about Postfix today.

This morning I got a call from my client with the new mail server. They were getting an error message when trying to send a file with a 7 MB attachment. Since they send and receive a lot of attachments (of which a 7 meg file would be on the small side) this needed to be fixed. The message they were getting indicated and inability to access a mailbox. I skimmed through /var/log/maillog and found this:


Nov 7 10:48:47 postoffice postfix/local[14046]: 0671D344040: to=, relay=local, delay=33, status=bounced (cannot access mailbox /var/spool/mail/foo for user foo. error writing message: File too large)

I was a bit surprised, since I made sure that /etc/postfix/main.cf did not include any limits on email sizes. After some time searching on Google, it looked like the default value for a mailbox size according to Postfix is 51200000 bytes. I wanted it to be unlimited, so I used postconf to explicitly set the value to 0, for no limit, like so...

% postconf –e mailbox_size_limit=0

... then restarted Postfix.

I then tried to send a 12 MB file from my Gmail account to my test account on the box. I got an SMTP 552 error, “Message too large” back from the box. Again, I skimmed the maillog file and this time came across:

Nov 7 15:51:33 postoffice postfix/postdrop[14200]: warning: uid=48: File too large

Back to Google, whereupon I learnt that the default max message size for Postfix is 10240000 bytes. To fix it I ran:

% postconf –e message_size_limit=0

Again, I restarted Postfix and then resent my test email. This time it went through.

If you want to view the default settings for all the parameters you can configure in main.cf, use postconf –d. The output of postconf –d | grep size looks like:

[root@foo]# postconf -d | grep size
berkeley_db_create_buffer_size = 16777216
berkeley_db_read_buffer_size = 131072
body_checks_size_limit = 51200
bounce_size_limit = 50000
header_size_limit = 102400
mailbox_size_limit = 51200000
message_size_limit = 10240000

As an aside, since Postfix on this box is started by MailScanner, I restarted the MailScanner daemon to restart Postfix, like this:

% /etc/init.d/MailScanner restart

... which stops the inbound and outbound Postfix queus then starts them again.

Monday, November 06, 2006

Mail server migration complete

On Saturday I was able to get my client moved over the new mail server that I'd installed a couple of weeks ago. It went pretty smoothly, although I did have to modify Postfix's main.cf to allow it to accept email to their domain, rather than just to their host.domain.com.

It's amazing how many attempts there are to relay mail through the box. If I login to it and run tail -f /var/log/maillog, and I can sit there and watch relay attempts scroll off the top of my screen. I've done this several times and it just doesn't end.

Theire old box used CommuniGate Pro for mail services. One advantage CGP has is that mail users are different from system users. I.e., you don't need to setup an account on the system for a user to send and receive mail through it (although you can configure it to use system accounts). When using Postfix and Dovecot, and not using virtual domains, mail accounts are system accounts. I wanted to make it more difficult for someone to crack the box. Since my client is using this only for email and system logins aren't needed, I used chsh to change the login shell of each mail user to /sbin/nologin. Now, when someone tries to SSH into the server they get bounced right off.