Sunday 10 July 2011

Postfix Quota for redhat mail user

Postfix does not support mailbox quota. But thanks to Anderson Nadal’s Postfix Virtual Delivery Agent (VDA) patches, it can. To use the Postfix VDA requires two things, first Postfix must be built with the VDA patches and second, virtual user accounts must be used. You can get the Postfix RPM with VDA patches here.
Here are some configuration you can use for your virtual accounts.

Configure Postfix VDA

Edit main.cf1. Edit the postfix configuration file /etc/postfix/main.cf and add the lines below
virtual_mailbox_limit_override = yes
virtual_overquota_bounce = yes
virtual_mailbox_limit_maps = hash:/etc/postfix/vquota
Edit main.cf2. Create the file /etc/postfix/vquota containing the mapping from an email address to the maximum mailbox quota in bytes. If you wish to be exact, 1KB equals 1024 bytes while 1MB equals 1024KB or 1048576 bytes.
johndoe@acme.local 10485760
janedoe@acme.local 2097152
John Doe got a 10MB quota while Jane Doe got 2MB.
After creating this file, execute postmap /etc/postfix/vquota. This will generate /etc/postfix/vquota.db, the actual file that will be used for the lookup.
NoteIf you use Active Directory as your Postfix virtual user accounts source, you can use the maxStorage attribute instead to store the quota. Just copy your ldap-users.cf configuration and save it as ldap-quota.cf. Next change samaccountname to maxstorage in the result_attribute line and remove the result_format line. In your main.cf, use ldap:/etc/postfix/ldap-quota.cf as your virtual_mailbox_limit_maps. In Windows, you can use ADSI Edit to access and modify the value of maxStorage.
Service Configuration3. Restart the Postfix or MailScanner service if you have installed MailScanner. Learn how to start and stop services here.
Terminal4. Test Postfix using Telnet. Try using a very small quota limit so you can test the quota feature.

Saturday 9 July 2011

Postfix Aliases and Mailing List for redhat 6

You can create a text file in Postfix containing an alias email and several destination emails. There are two ways to implement aliasing and mailing list in Postfix depending on how it is configured.

For System Accounts

Your Postfix is configured to use system accounts if your configuration file has something like
mydestination = $mydomain
or sending to a non-existent account gives the error message
Recipient address rejected: User unknown in local recipient table
Edit /etc/aliases
1. Edit the file /etc/aliases. The file has the form
alias: address1,address2
If address has the same domain as yours, you can leave it out. Thus you can use the /etc/aliases file to alias an email address or to build a mailing list.
Terminal2. Type in the command newaliases in a terminal window. This will rebuild the aliases database file.

For Virtual Accounts

Your Postfix is configured to use virtual accounts if your configuration file has something like
virtual_mailbox_domains = $mydomain
or sending to a non-existent account gives the error message
Recipient address rejected: User unknown in virtual mailbox table
Create /etc/postfix/valias
1. Edit the file /etc/aliases. The file has the form
alias address1,address2
postmap /etc/postfix/valias
2. Generate the database file for valias using the command
postmap /etc/postfix/valias
postmap query /etc/postfix/valias
3. Test your database file using the command
postmap -q group@acme.local /etc/postfix/valias
Replace group@acme.local with a valid alias entry. You should see the destination emails.
Edit main.cf
4. Edit the file /etc/postfix/main.cf and add the line below to your virtual settings section
virtual_alias_maps = hash:/etc/postfix/valias
NoteIf you are using virtual accounts, instead of maintaining a text file containing the aliases and mailing list, it would be better if you can work with your virtual accounts source. See the links below for examples

To Test Postfix

Service Configuration1. Restart the Postfix service. But if you installed MailScanner, then restart MailScanner instead. This will immediately reload the aliases database file instead of after a few minutes.
Terminal2. You should now be able to send email to addresses found in your aliases file. See Test Postfix using Telnet and try using the alias email addresses

Friday 8 July 2011

Firewall Configuration Howto for RHEL/CentOS 6 for mail server configuration

Red Hat Enterprise Linux 6 and its derivative CentOS 6 includes a graphical tool called Firewall Configuration for configuring the firewall options. This article describes how to use the Firewall Configuration tool to open up the ports necessary for providing an email server.

Firewall Configuration (GUI)

This section describes how to use the Firewall Configuration tool to configure the firewall.
Firewall Configuration Startup1. Click System, select Administration and click Firewall. This will launch the Firewall Configuration window.
Firewall2. Click Close in the Firewall Configuration Startup window.
Firewall Authenticate3. Type in the root password and click Authenticate.
NoteIf the Firewall Configuration Startup window does not disappear after clicking Close, click the window behind it to bring the Authenticate window into the foreground.
Firewall Configuration4. In the service list, check Mail (SMTP) and WWW (HTTP).
Firewall Configuration - Other Ports5. Click Other Ports and click Add.
Firewall Configuration - Other Ports - Add6. Select 110 tcp pop3 and click Ok. Do the same for 143 tcp imap.
Firewall Configuration - Other Ports7. Finally, click Apply to save your changes.

Firewall Configuration (TUI)

This section describes how to use the Firewall Configuration text user interface (TUI) tool to configure the firewall.
Firewall Configuration1. Launch the Firewall Configuration tool using the command below.
system-config-firewall-tui
Firewall Configuration2. In Firewall Configuration screen, press the Customize button.
Firewall Configuration3. In the service list, check Mail (SMTP) and WWW (HTTP). Press Forward when you are done.
Firewall Configuration4. Press Add to add a custom port.
Firewall Configuration5. Type in 110 to the field Port and tcp to the field Protocol. Press OK when you are done. Do the same for 143:tcp.
Firewall Configuration6. After adding the two ports press Close.
Firewall Configuration7. Finally, press OK and press Yes to confirm overriding of firewall configuration.
 
NoteYou can see the list of service and port numbers using the command below.
getent services