Postfix Install Notes

Postfix Install Notes

Postby stephen » Wed Jan 28, 2009 9:17 pm

To install Postfix on FreeBSD Version 7

# cd /usr/ports/mail/postfix-current
# make install clean
Tick Options
PCRE perl Compatible Regular Expressions
SASL2 Cyrus SASLv2 (Simple Auth. and Sec. Laayer
DOVECOT Dovecot SASL authentication method
TLS Enable SSL and TLS support

startup script installed at
/usr/local/etc/rc.d/postfix

Add the following to /etc/rc.conf
sendmail_enable="NO"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"
postfix_enable="YES"

Create a link from /etc to postfix
# cd /etc
# ln -s /usr/local/etc/postfix

vi main.cf
Paste under mynetworks:
Code: Select all
####### smtp auth
smtpd_tls_auth_only = no
smtp_use_tls = yes
smtpd_sasl_auth_enable =   yes
smtpd_sasl_type = cyrus
local_recipient_maps =
smtpd_use_tls = yes
smtp_tls_note_starttls_offer   = yes
smtpd_tls_key_file =   /etc/ssl/private/www.xxxxxx.com.au.nopassword.key
smtpd_tls_cert_file =   /etc/ssl/certs/www.xxxxxx.com.au.cert
smtpd_tls_CAfile =   /etc/ssl/certs/cacert.pem
smtpd_tls_loglevel = 1
smtpd_tls_received_header   = yes
smtpd_tls_session_cache_timeout   = 3600s
tls_random_source =   dev:/dev/urandom
########


vi master.cf
Paste under smtp:
Code: Select all
smtps   inet n   -   n   - - smtpd
      -o smtpd_sasl_auth_enable=yes
      -o smtpd_reject_unlisted_sender=yes
      -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
      -o broken_sasl_auth_clients=yes


Reload the config:
Code: Select all
 
postfix reload


locate smtpd.conf
????vi /usr/local/lib/sasl2/smtpd.conf
vi /usr/local/lib/sasl2/Sendmail.conf
Delete the contents of the file and paste into it:
Code: Select all
pwcheck_method: saslauthd
mech_list: plain login


check if saslauthd is started
saslauthd -V

to install saslauthd
see http://freebsd.munk.me.uk/archives/212-Installing-Exim,-SASLAuthd,-ClamAV-and-SpamAssassin-on-FreeBSD-6.2.html
cd /usr/ports/security/cyrus-sasl2-saslauthd
make install clean

vi /etc/rc.conf
add
Code: Select all
saslauthd_enable="YES"
saslauthd_flags="-a getpwent"


to start sasluthd
Code: Select all
/usr/local/etc/rc.d/saslauthd start


Test the saslauthd
Code: Select all
 /usr/local/etc/rc.d# testsaslauthd -u user -p pass
0: OK "Success."


I cannot get saslauthd to run with start command
i receive
saslauthd no authentication mechanism specified

but this command works
saslauthd -m /var/run/saslauthd -r -c -a getpwent
it does not seem to be picking up the flags from rc.conf
fix was to reboot the server



modify master.cf for use with ASSP Anti-Spam SMTP proxy Server
# vi /etc/postfix/master.cf
change
smtp inet n - n - - smtpd
to
localhost:smtp inet n - n - - smtpd


Postfix web site
http://www.postfix.org/

The postfix documentation can be found here
http://www.postfix.org/documentation.html

Install Postfix on FreeBSD
http://www.scriptinstallation.in/freebsd_postfix_install.html

Postfix SMTP Authentication - On The Secure Port Only
use this site to get help in testing the authentication
http://www.howtoforge.com/postfix-smtp-authentication-on-the-secure-port-only

Postfix and Dovecot on Ubuntu Dapper Drake
http://adomas.org/2006/08/postfix-dovecot/

To see the current postfix settings type
Code: Select all
postconf -n


Debian Mail Server Setup with Postfix + Dovecot + SASL + Squirrel Mail
http://www.debianadmin.com/debian-mail-server-setup-with-postfix-dovecot-sasl-squirrel-mail.html

PostFix Howto
http://wiki.archlinux.org/index.php/PostFix_Howto#Step_3.1_myhostname

Postfix FAQ
http://www.seaglass.com/postfix/faq.html#erlpbk

the error in the /var/log/maillog file.
fatal: main.cf configuration error: mailbox_size_limit is smaller than message_size_limit

when I run postconf -n
it shows
mailbox_size_limit = 1048576000
message_size_limit = 104857600

The change to main.cf does not seem to be recognised immediately
stephen
 
Posts: 507
Joined: Thu Feb 09, 2006 9:37 am
Location: Brisbane

Postfix and ASSP Notes

Postby stephen » Thu Jan 29, 2009 6:55 am

Code: Select all
Edit /etc/postfix/master.cf

Change :
Code: Select all
smtp      inet  n       -       n       -       -       smtpd

to:
Code: Select all
localhost:smtp   inet  n       -       n       -       -       smtpd
stephen
 
Posts: 507
Joined: Thu Feb 09, 2006 9:37 am
Location: Brisbane

fatal: open database /etc/aliases.db: No such file or direct

Postby stephen » Thu Jan 29, 2009 10:31 pm

fatal: open database /etc/aliases.db: No such file or directory
solution here
http://www.howtoforge.com/forums/archive/index.php/t-652.html

If /etc/aliases exists (don't mix it up with /etc/aliases.db!), delete /etc/aliases.db, then run newaliases:
rm -f /etc/aliases.db
newaliases
This will create /etc/aliases.db from /etc/aliases. Then restart Postfix.
stephen
 
Posts: 507
Joined: Thu Feb 09, 2006 9:37 am
Location: Brisbane

postfix mailq and postsuper

Postby stephen » Mon Feb 09, 2009 9:38 pm

the
mailq

command shows thousands of junk emails in the queue

the junk emails had text in them that was similar tp this 210-210-110-206.xxxx.net.au

// to remove jobs from postfix queue
mailq | awk '/210-210-110-206.xxxx.net.au/ { print $1 }' |tr -d '*!' |postsuper -d -

Note the mail queues are stored in /var/spool/postfix folder
stephen
 
Posts: 507
Joined: Thu Feb 09, 2006 9:37 am
Location: Brisbane

do not list domain in BOTH mydestination and virtual_alias_d

Postby stephen » Wed Feb 11, 2009 9:42 pm

To fix this error
Feb 11 03:31:18 server postfix/trivial-rewrite[99874]:
warning: do not list domain mail.xxxxx.com.au in BOTH mydestination and virtual_alias_domains


/usr/local/etc/postfix/main.cf had this code
Code: Select all
myhostname= mail.xxxxx.com.au
mydestination = myhostname
virtual_alias_maps = hash:/etc/postfix/virtual
virtual_alias_domains = $virtual_alias_maps



and /usr/local/etc/etc/postfix/virtual
had this line
mail.xxxxx.com.au anything


fix was to remove
Code: Select all
mail.xxxxx.com.au   anything


from the /etc/postfix/virtual file
stephen
 
Posts: 507
Joined: Thu Feb 09, 2006 9:37 am
Location: Brisbane


Return to Linux Server Configuration Notes

Who is online

Users browsing this forum: No registered users and 3 guests

cron