Overview
When is postfix used?
Postfix can be used for the following functionality:
- Masquerading
- Shunting queue
The Postfix solution is not secured and hence should be used after the qmail server. Postfix can be put in front of qmail only on internal servers which are not exposed to direct hits from the Internet or LAN.
What is a shunting queue?
- Consider a Connect Xf server which routes mail to other servers in the network.
- For example a mail router which accepts mail from the MX server and depending on the location of the recipients mail box, routes the mail to that server.
- Some times, if the connection to the destination server is experiencing problems, then mails for that server remain in the queue. The queue size grows and affects the delivery of mail to other locations where there is no problem with connectivity.
- To solve this problem, you can install ‘shunting queues’ for each of the destination IPs/domains.
- The working of the shunting queue can be explained as follows:
-
- The mail arrives in the main queue. Depending on the destination, the mail is routed to a shunting queue which accepts this mail and then in turn delivers to the destination server.
- Shunting queues can be used when you want to deliver mail to the following destinations using a separate queue:
-
- Outgoing mail (mail to external domains)
- Mail to hosted domains whose mailboxes are hosted on other servers.
- Mail to a host (forward to host)
- Mail to other mailbox locations.
- Mails can be delivered via shunting queues either by configuring SMTP Routes or by configuring Prequeue Routing
.
Can I have more than one shunting queues?
Yes you can have one shunting queue per destination server.
What is the maximum number of shunting queues that I can install?
To keep the complexity of trouble shooting and mail tracing to a minimum, it is advisable to have minimum shunting queues. We do not recommend over 20 shunting queues.
Which MTA is used for shunting queues?
The Postfix MTA is used for shunting queues.
What is masquarading?
- Consider an oranization which has standardized the email ids to firstname.lastname.
- However prior to this policy, email ids were created in a random format.
- This organization may need to do a phased roll out of the new nomemclature and would like only the mail to go with the new ids. In which case the od ids have to masquarade as new ids.
- This is only one example of masqurading. Another may be when the mail on a domain has to be sent to servers hosting a sub a sub domain. In which case email ids from the parent domain have to be translated to email ids in the sub domain.
Installation
- The postfix component gets automatically installed on installing Connect Xf 3.8+.
Configuration
How do I configure a postfix shunting queue?
- Connect Xf 3.8 introduces new postfix templates which will help you configure the postfix shunting queues.
- The instructions for installing these shunting queues are available in the following files:
-
-
-
Shunting queue for Resource Domain - /mithi/mcs/modules/mithi-bl/binconf/postfixTemplates/domainBasedShuntingQueueConfiguration.txt
Forward to host - /mithi/mcs/modules/mithi-bl/binconf/postfixTemplates/forwardToHostBasedShuntingQueueConfiguration.txt
mailboxlocation - /mithi/mcs/modules/mithi-bl/binconf/postfixTemplates/mailBoxLocationBasedShuntingQueueConfiguration.txt
Outgoing - /mithi/mcs/modules/mithi-bl/binconf/postfixTemplates/outgoingMailShuntingQueueConfiguration.txt
-
-
How do I ensure that the postfix service auto starts on server reboot?
- Refer to the following file on the Connect Xf 3.8 server
/mithi/mcs/modules/mithi-bl/binconf/postfixTemplates/configurePostfixStartUp.txt
How do i take the backup of the postfix configuration?
- The backup of the postfix queue configuration is now part of the system data backup.
- For details on how to configure a backup, refer to the following topic:
Configuring Backup
How do i configure relay host in postfix?
The following settings can be added to the end of the “/etc/connectxfpostfix/postfix-<queueid>/main.cf” file.
#Note the relay host server ip should be in square brackets. relayhost = [<ip of the relayserver>] smtp_sasl_password_maps = hash:/etc/connectxfpostfix/postfix-<queueid>/sasl_passwd
In the “/etc/connectxfpostfix/postfix-<queueid>/sasl_passwd” file make the following entries
#Note the relay host server ip should be in square brackets. [<ip of relayserver>] <userid>:<password>
Run the commands
postmap /etc/connectxfpostfix/postfix-<queueid>/sasl_passwd postmap //etc/connectxfpostfix/postfix-<queueid>/transport /etc/init.d/postfix-<queueid> reload
How do i configure fallback relay in postfix?
- Find the configuration directory of a shunting queue
ll /etc/connectxfpostfix/postfix-<queueid>
- To setup a fallback or failover smtp add the following line to the main.cf in the configuration directory of a Shunting queue
fallback_relay= comma seperated ip address of failover relays
- Save the file
- Reload postfix
/etc/init.d/postfix-<queueid> reload
How to change the smtp concurrency
- Open the mail.cf file
vi /etc/connectxfpostfix/postfix-<queueid>/main.cf
- Search for the following lin
#default_destination_concurrency_limit = 20
- Uncomment the line and change the concurrency according to your requirent
- Refresh postfix
postmap /etc/connectxfpostfix/postfix-<queueid>/main.cf /etc/init.d/postfix-<queueid> reload
How do I set maximum size of a message in the postfix?
- Find the configuration directory of a shunting queue
ll /etc/connectxfpostfix/postfix-<queueid>
- To set the maximum size of message, add/modify the following option in the main.cf in the configuration directory of a Shunting queue
message_size_limit = <Number of Bytes>
- Eg.
message_size_limit = 20480000
- Save the file
- Reload postfix
/etc/init.d/postfix-<queueid> reload
I want to configure Postfix to listen on port 25 of one IP and qmail to listen on port 25 of another IP assigned to the server
- By default qmail will listen on Port 25 of all the IPs assigned to the server.
- To enable Postfix to run on port 25 of another IP assigned to the server, in addition to binding postfix to the required IP, we have to explicitely bind qmail to only one IP.
- The instructions to How to bind qmail to an IP is given here .
How do I delete a postfix queue?
1. stop the postfix queue
/etc/init.d/postfix-<queueid> stop
2. Ensure queue is empty
postqueue -p -c /etc/connectxfpostfix/postfix-<queueid>
3. Remove folders
rm -rf /etc/connectxfpostfix/postfix-<queueid> rm -rf /var/spool/postfix-<queueid> rm -f /etc/init.d/postfix-<queueid>
4. Delete from auto start
chkconfig --del postfix-<queueid>
How do I copy the postfix configurations from another server?
- Install the postfix rpm as per the instructions given above.
- Copy the etc postfix folders from the MCS server on which postfix has been installed, by running the following command on it
scp /etc/connectxfpostfix/postfix-<queueid>* <IP of the NEW SERVER>:
- Make a backup of the postfix information in the spool folder from the MCS server on which postfix is already installed
cd /var/spool/ tar -czvf /root/mithiwork/postfix.spool.tar.gz postfix* --no-recursion
- Copy the tar file to the target server
- On the target server run the following commands
cd /var/spool/ tar -xzvf /root/mithiwork/postfix.spool.tar.gz postfix* --no-recursion
- Copy info int /etc/init.d/postfix folder
scp /etc/init.d/postfix* <IP of new server>:/etc/init.d/
- On the target server, for every postfix queue copied, run the following commands
postmap /etc/connectxfpostfix/postfix-<queueid>/transport /etc/init.d/postfix-<queueid> restart
- To test whether the postfix queues copied are work check using telnet
telnet localhost <ports defined in master.cf>
How do I configure masquarading?
- Setup a postfix shunting queue as mentioned above.
- Add the following lines to main.cf of the shunting queue
- Change the following parameters (if the lines are not found add them)
vi /etc/connectxfpostfix/postfix-<queuename>/main.cf
myhostname = mcs.<domain name> mydomain = mcs. <domain name> inet_interfaces = <ip for interfacing with lotus> local_recipient_maps = local_header_rewrite_clients = static:all masquerade_classes = envelope_recipient, envelope_sender, header_sender, header_recipient masquerade_domains = <domainname> masquerade_exceptions = transport_maps = hash:/etc/connectxfpostfix/postfix-<queuename>/transport best_mx_transport = smtp relay_domains = $mydestination local_recipient_maps = mynetworks_style = host mynetworks = <List of ips which will send mail> (This will consist of the Lotus machine ip/ips) canonical_classes = envelope_sender, envelope_recipient, header_sender, header_recipient canonical_maps = hash:/etc/connectxfpostfix/postfix-<queuename>/canonical relay_transport = relay
- Modify the file /etc/connectxfpostfix/posfix-<queueid>/canonical
vi /etc/connectxfpostfix/posfix-<queueid>/canonical and add entries in the format given below email id 1 email id 2 email id 3 email id 4
The above will translate email id 1 to email id 2 and email id 3 to email id 4
- To masquerade an entire domain, add the following line
@domain1 @domain2
The above will translate all ids from domain1 to corresponding ids in domain2
- Save the file
- Run postmap
postmap /etc/connectxfpostfix/postfix-<queueid>/main.cf postmap /etc/connectxfpostfix/postfix-<queueid>/canonical postmap /etc/connectxfpostfix/postfix-<queueid>/sender_canonical postmap /etc/connectxfpostfix/postfix-<queueid>/recipient_canonical
- Reload postfix
service postfix-<queueid> reload or /etc/init.d/postfix-<queueid> reload
How to update the database after changing the canonical files
If the cannonical file is modified, to update the database file run the command
postmap /etc/connectxfpostfix/postfix-<queueid>/sender_canonical postmap /etc/connectxfpostfix/postfix-<queueid>/recipient_canonical
Reload the postfix service using the command
/etc/init.d/postfix reload
How do I configure the postfix for the Virtual IP assigned to a MCS setup with DRBD and heartbeat?
Assuming that the postfix has been configured without DRBD and now we are setting DRBD with heart beat, the following changes have to be made:
- In the file /etc/connectxfpostfix/postfix-<QUEUEID>/main.cf file, change the following line
inet_interfaces = 127.0.0.1
to
inet_interfaces = <Virtual IP>
- In the same file, add the virtual IP, to the mynetworks. The IP has to be added to the list of comma seperated IPs already present.
- Save the file
- Run postmap
postmap /etc/connectxfpostfix/postfix-<QUEUEID>/main.cf postmap /etc/connectxfpostfix/postfix-<QUEUEID>/master.cf
- Restart postfic
/etc/init.d/postfix-<QUEUEID> restart
How do I rename a postfix queue?
1. stop the postfix queue
/etc/init.d/postfix-<QUEUE> stop
2. Rename folders
mv /etc/connectxfpostfix/postfix-<QUEUE> /etc/connectxfpostfix/postfix-<QUEUENEW> mv /var/spool/postfix-<QUEUE> /var/spool/postfix-<QUEUENEW> mv /etc/init.d/postfix-<QUEUE> /etc/init.d/postfix-<QUEUENEW>
3. update conf file
vi /etc/connectxfpostfix/postfix-<QUEUENEW>/main.cf find <QUEUE> and replace with <QUEUENEW> confirm the following queue_directory = /var/spool/postfix-<QUEUENEW> alternate_config_directories = /etc/connectxfpostfix/postfix-<QUEUENEW> mail_name = Postfix-<QUEUENEW> transport_maps = hash:/etc/connectxfpostfix/postfix-<QUEUENEW>/transport syslog_name = postfix-<QUEUENEW>
4. update startup script
vi /etc/init.d/postfix-<QUEUENEW> find <QUEUE> and rename to <QUEUENAME>
5. start postfix
/etc/init.d/postfix-<QUEUENEW> start
6. Check telnet to the port of QUEUENEW
telnet localhost <QUEUENEW PORT>
7. check maillog
tail -f /var/log/maillog | grep <QUEUENEW>
Operations
How do i check messages in the postfix queue?
postqueue -p
How do i get the number of active mails in the postfix queue?
postqueue -p | grep "^[0-9A-Z]" | grep -v '!' | wc -l
For checking mail in different postfix queues the command will look like the following
postqueue -p -c /etc/connectxfpostfix/postfix-<queuename> | grep "^[0-9A-Z]" | grep -v '!' | wc -l
In which log file, are the postfix transactions logged?
/var/log/maillog
How do i alarm the postfix queue?
postsuper -r ALL
How do I flush the postfix queue?
postqueue -f
In case you have more than one postfix queues (as in case of multiple shunting queues, then to flush a particular queue, use the following command
postqueue -f -c /etc/connectxfpostfix/postfix-<queuename>
How do I stop and start postfix?
/etc/init.d/postfix stop /etc/init.d/postfix start
How do I set routing for postfix?
The routing is set in the file /etc/connectxfpostfix/postfix-<queueid>/transport
To set default routes
vi /etc/connectxfpostfix/postfix-<queueid>/transport
- At the end add the lines with the *, as follows
* smtp:<IP of the outgoingserver>:<Port>
- Save the file.
- Run the command
postmap /etc/connectxfpostfix/postfix-<queueid>/transport
To set specific routes
vi /etc/connectxfpostfix/postfix-<queueid>/transport
- Before the default route (if any), add the lines as follows
<domain name> smtp:[<ip to which mails are to be routed]:25
- Such lines can be added to route the mails for the respective domains
- Save the file.
- Run the command
postmap /etc/connectxfpostfix/postfix-<queueid>/transport
How do i hold messages sent to a destination?
In the /etc/connectxfpostfix/postfix-<queueid>/transport add
destination_domain defer:[ip address]:[port]
Ensure that there no other entry of the the domain in the file
Save the file and Rebuild transport map
postmap /etc/connectxfpostfix/postfix-<queueid>/transport
restart postfix
service postfix restart
Releasing the queue
In the /etc/connectxfpostfix/postfix-<queueid>/transport change defer to smtp for the destination domain
destination_domain smtp:[ip address]:[port]
Save the file and Rebuild transport map
postmap /etc/connectxfpostfix/postfix-<queueid>/transport
restart postfix
service postfix-<queueid> restart
flush queue
postqueue -f
How do i hold/release messages sent from a email id?
- To hold mail from or to an email id, use the following command
/mithi/mcs/bin/pfqueuehold-shunting.pl <emailid> <queueid> where <emailid> is the email id and <queueid> is the postfix queue
- To release mail, use the following command
/mithi/mcs/bin/pfqueuerelese-shunting.pl <emailid> <queueid> where <emailid> is the email id and <queueid> is the postfix queue
How do i delete messages sent from a email id?
- Call the following command
/mithi/mcs/bin/pfqueuedelete-shunting.pl <emailid> <queueid> where <emailid> is the email id and <queueid> is the postfix queue
Troubleshooting
Postfix service is not starting and throws an error “Segmentation fault”
Symptom
- The Postfix service is not starting
- Shows an error “Segmentation fault”
Cause The host names entries in /etc/hosts for IPs and Host names don’t match. This could be because the host file may have been copied from another server or the server is rebuilt by making a clone and these entries are not changed.
Remedy Correct the entries in /etc/hosts pertaining to this IP and the hostname
Postfix service is not starting
Symptom
- The Postfix service is not working
- The maillog shows the lines similar to ones given below
Sep 1 20:19:33 mail postfix/postfix-script: starting the Postfix mail system Sep 1 20:19:33 mail postfix/master[974]: fatal: bind 172.16.1.6 port 25: Address already in use Sep 1 20:22:21 mail postfix/postfix-script: fatal: the Postfix mail system is not running Sep 1 20:23:15 mail postfix/postfix-script: fatal: the Postfix mail system is not running
Cause
- Qmail is running on the same IP as the Postfix. This is the default behavior of qmail which binds itself to all IPs assigned to the server.
Remedy
- Stop qmail
- Stop postfix
- Bind Qmail to the required IP
- Confirm that Postfix is bound to correct IP
- Start postfix
- Start qmail
Postfix start shows “OK” but Postix status shows “Stopped”
Check the /var/log/maillog for the following errors and apply the remidies the error message
check if Qmail is already runing and is also bound to the Postfix inet_address If yes, bind qmail to a seperate IP and port, And postfix to another IP and Port
How do i check the version of postfix installed on my server
Run the following command to get the version of postfix installed on the server.
postconf -d | grep mail_version
How to add relay client in postfix
1. Edit the main.cf
vi /etc/connectxfpostfix/postfix-<queueid>/main.cf
2. search for a line similar to
mynetworks = 192.168.31.2,192.168.1.100, ...
(Where all the ips mentioned are allowed to relay through postfix)
3. Press “i” to insert
4. Go to the end of line. and insert the IP address with comma separated.
5. Press ESC + :wq then press
6. Restart postfix
/etc/init.d/postfix restart
I changed the cannonical file, but the changes are not taking any effect
The queue has to be reloaded and the postmap command executed as mentioned in the masquarading section.
Mail via postfix and not being delivered and the lailog shows the following error: “Unknown mail transport error”
Symptoms:
When you check the maillog, there are errors generated by the postfix service. For example the following command
cat /var/log/maillog | grep 'postfix'
gives the following error
Unknown mail transport error
Probable cause
- Misconfiguration of the transport file.
- Corrupt the master.cf file
Resolution
In the file /etc/connectxfpostfix/postfix-<QUEUEID>/transport, there should be no blank lines in the section which specifies the routes.
- Check the last line, if is a blank line, remove it.
- Mark the end of the file with a comment
- Save the file.
- Run the following command
postmap /etc/connectxfpostfix/postfix-<QUEUEID>/transport
Note: the string <QUEUEID> has to be replaced by the queue name.
How to debug postfix
This document describes how to debug parts of the Postfix mail system when things do not work according to expectation. The methods vary from making Postfix log a lot of detail, to running some daemon processes under control of a call tracer or debugger.
The text assumes that the Postfix main.cf and master.cf configuration files are stored in directory /etc/connectxfpostfix/postfix-<QUEUEID>. You can use the command “postconf config_directory” to find out the actual location of this directory on your machine.
Listed in order of increasing invasiveness, the debugging techniques are as follows:
- Look for obvious signs of trouble
- Debugging Postfix from inside
- Try turning off chroot operation in master.cf
- Verbose logging for specific SMTP connections
- Record the SMTP session with a network sniffer
- Making Postfix daemon programs more verbose
- Manually tracing a Postfix daemon process
- Automatically tracing a Postfix daemon process
- Running daemon programs with the interactive ddd debugger
- Running daemon programs with the interactive gdb debugger
- Running daemon programs under a non-interactive debugger
- Unreasonable behavior
- Reporting problems to postfix-users@postfix.org
Look for obvious signs of trouble
Postfix logs all failed and successful deliveries to a logfile. The file is usually called /var/log/maillog or /var/log/mail; the exact pathname is defined in the /etc/syslog.conf file.
When Postfix does not receive or deliver mail, the first order of business is to look for errors that prevent Postfix from working properly:
% <b>egrep '(warning|error|fatal|panic):' /some/log/file | more</b>
Note: the most important message is near the BEGINNING of the output. Error messages that come later are less useful.
The nature of each problem is indicated as follows:
- “panic” indicates a problem in the software itself that only a programmer can fix. Postfix cannot proceed until this is fixed.
- “fatal” is the result of missing files, incorrect permissions, incorrect configuration file settings that you can fix. Postfix cannot proceed until this is fixed.
- “error” reports an error condition. For safety reasons, a Postfix process will terminate when more than 13 of these happen.
- “warning” indicates a non-fatal error. These are problems that you may not be able to fix (such as a broken DNS server elsewhere on the network) but may also indicate local configuration errors that could become a problem later.
Debugging Postfix from inside
With Postfix version 2.1 and later you can ask Postfix to produce mail delivery reports for debugging purposes. These reports not only show sender/recipient addresses after address rewriting and alias expansion or forwarding, they also show information about delivery to mailbox, delivery to non-Postfix command, responses from remote SMTP servers, and so on.
Postfix can produce two types of mail delivery reports for debugging:
- What-if: report what would happen, but do not actually deliver mail. This mode of operation is requested with:
% <b>/usr/sbin/sendmail -bv address...</b> Mail Delivery Status Report will be mailed to <your login name>.
- What happened: deliver mail and report successes and/or failures, including replies from remote SMTP servers. This mode of operation is requested with:
% <b>/usr/sbin/sendmail -v address...</b> Mail Delivery Status Report will be mailed to <your login name>.
These reports contain information that is generated by Postfix delivery agents. Since these run as daemon processes that cannot interact with users directly, the result is sent as mail to the sender of the test message. The format of these reports is practically identical to that of ordinary non-delivery notifications.
For a detailed example of a mail delivery status report, see the debugging section at the end of the ADDRESS_REWRITING_README document.
Try turning off chroot operation in master.cf
A common mistake is to turn on chroot operation in the master.cf file without going through all the necessary steps to set up a chroot environment. This causes Postfix daemon processes to fail due to all kinds of missing files.
The example below shows an SMTP server that is configured with chroot turned off:
/etc/connectxfpostfix/postfix-<QUEUEID>/master.cf: # ============================================================= # service type private unpriv chroot wakeup maxproc command # (yes) (yes) (yes) (never) (100) # ============================================================= smtp inet n - n - - smtpd
Inspect master.cf for any processes that have chroot operation not turned off. If you find any, save a copy of the master.cf file, and edit the entries in question. After executing the command “postfix reload“, see if the problem has gone away.
If turning off chrooted operation made the problem go away, then congratulations. Leaving Postfix running in this way is adequate for most sites. If you prefer chrooted operation, see the Postfix BASIC_CONFIGURATION_README file for information about how to prepare Postfix for chrooted operation.
Verbose logging for specific SMTP connections
In /etc/connectxfpostfix/postfix-<queueid>/main.cf, list the remote site name or address in the debug_peer_list parameter. For example, in order to make the software log a lot of information to the syslog daemon for connections from or to the loopback interface:
/etc/connectxfpostfix/postfix-<queueid>/main.cf: debug_peer_list = 127.0.0.1
You can specify one or more hosts, domains, addresses or net/masks. To make the change effective immediately, execute the command “postfix reload“.
Record the SMTP session with a network sniffer
This example uses tcpdump. In order to record a conversation you need to specify a large enough buffer with the “-s” option or else you will miss some or all of the packet payload.
tcpdump -w /file/name -s 0 host example.com and port 25
Older tcpdump versions don’t support “-s 0“; in that case, use “-s 2000” instead.
Run this for a while, stop with Ctrl-C when done. To view the data use a binary viewer, ethereal, or good old less.
Making Postfix daemon programs more verbose
Append one or more “-v” options to selected daemon definitions in /etc/connectxfpostfix/postfix-<QUEUEID>/master.cf and type “postfix reload“. This will cause a lot of activity to be logged to the syslog daemon. For example, to make the Postfix SMTP server process more verbose:
/etc/connectxfpostfix/postfix-<QUEUEID>/master.cf: smtp inet n - n - - smtpd -v
To diagnose problems with address rewriting specify a “-v” option for the cleanup and/or trivial-rewrite daemon, and to diagnose problems with mail delivery specify a “-v” option for the qmgr or oqmgr queue manager, or for the lmtp, local, ipe, smtp, or virtual delivery agent.
Manually tracing a Postfix daemon process
Many systems allow you to inspect a running process with a system call tracer. For example:
trace -p process-id (SunOS 4) strace -p process-id (Linux and many others) truss -p process-id (Solaris, FreeBSD) ktrace -p process-id (generic 4.4BSD)
Even more informative are traces of system library calls. Examples:
ltrace -p process-id (Linux, also ported to FreeBSD and BSD/OS) sotruss -p process-id (Solaris)
See your system documentation for details.
Tracing a running process can give valuable information about what a process is attempting to do. This is as much information as you can get without running an interactive debugger program, as described in a later section.
Automatically tracing a Postfix daemon process
Postfix can attach a call tracer whenever a daemon process starts. Call tracers come in several kinds.
- System call tracers such as trace, truss, strace, or ktrace. These show the communication between the process and the kernel.
- Library call tracers such as sotruss and ltrace. These show calls of library routines, and give a better idea of what is going on within the process.
Append a -D option to the suspect command in /etc/connectxfpostfix/postfix-<queueid>/master.cf, for example:
/etc/connectxfpostfix/postfix-<queueid>/master.cf: smtp inet n - n - - smtpd -D
Edit the debugger_command definition in /etc/connectxfpostfix/postfix-<queueid>/main.cf so that it invokes the call tracer of your choice, for example:
/etc/connectxfpostfix/postfix-<queueid>/main.cf: debugger_command = PATH=/bin:/usr/bin:/usr/local/bin; (truss -p $process_id 2>&1 | logger -p mail.info) & sleep 5
Type “postfix reload” and watch the logfile.
Running daemon programs with the interactive ddd debugger
If you have X Windows installed on the Postfix machine, then an interactive debugger such as ddd can be convenient.
Edit the debugger_command definition in /etc/connectxfpostfix/postfix-<queueid>/main.cf so that it invokes ddd:
/etc/connectxfpostfix/postfix-<queueid>/main.cf: debugger_command= PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
Be sure that gdb is in the command search path, and export XAUTHORITY so that X access control works, for example:
% setenv XAUTHORITY ~/.Xauthority (csh syntax) $ export XAUTHORITY=$HOME/.Xauthority (sh syntax)
Append a -D option to the suspect daemon definition in /etc/connectxfpostfix/postfix-<queueid>/master.cf, for example:
/etc/connectxfpostfix/postfix-<queueid>/master.cf: smtp inet n - n - - smtpd -D
Stop and start the Postfix system. This is necessary so that Postfix runs with the proper XAUTHORITY and DISPLAY settings.
Whenever the suspect daemon process is started, a debugger window pops up and you can watch in detail what happens.
Running daemon programs with the interactive gdb debugger
If you have the screen command installed on the Postfix machine, then you can run an interactive debugger such as gdb as follows.
Edit the debugger_command definition in /etc/connectxfpostfix/postfix-<queueid>/main.cf so that it runs gdb inside a detached screen session:
/etc/connectxfpostfix/postfix-<queueid>/main.cf: debugger_command = PATH=/bin:/usr/bin:/sbin:/usr/sbin; export PATH; HOME=/root; export HOME; screen -e^tt -dmS $process_name gdb $daemon_directory/$process_name $process_id & sleep 2
Be sure that gdb is in the command search path.
Append a -D option to the suspect daemon definition in /etc/connectxfpostfix/postfix-<queueid>/master.cf, for example:
/etc/connectxfpostfix/postfix-<queueid>/master.cf: smtp inet n - n - - smtpd -D
Execute the command “postfix reload” and wait until a daemon process is started (you can see this in the maillog file).
Then attach to the screen, and debug away:
# HOME=/root screen -r gdb) continue gdb) where
Running daemon programs under a non-interactive debugger
If you do not have X Windows installed on the Postfix machine, or if you are not familiar with interactive debuggers, then you can try to run gdb in non-interactive mode, and have it print a stack trace when the process crashes.
Edit the debugger_command definition in /etc/connectxfpostfix/postfix-<queueid>/main.cf so that it invokes the gdb debugger:
/etc/connectxfpostfix/postfix-<queueid>/main.cf: debugger_command = PATH=/bin:/usr/bin:/usr/local/bin; export PATH; (echo cont; echo where; sleep 8640000) | gdb $daemon_directory/$process_name$process_id 2>&1 >$config_directory/$process_name.$process_id.log & sleep 5
Append a -D option to the suspect daemon in /etc/connectxfpostfix/postfix-<queueid>/master.cf, for example:
/etc/connectxfpostfix/postfix-<queueid>/master.cf: smtp inet n - n - - smtpd -D
Type “postfix reload” to make the configuration changes effective.
Whenever a suspect daemon process is started, an output file is created, named after the daemon and process ID (for example, smtpd.12345.log). When the process crashes, a stack trace (with output from the “where” command) is written to its logfile.
Unreasonable behavior
Sometimes the behavior exhibited by Postfix just does not match the source code. Why can a program deviate from the instructions given by its author? There are two possibilities.
- The compiler has erred. This rarely happens.
- The hardware has erred. Does the machine have ECC memory?
In both cases, the program being executed is not the program that was supposed to be executed, so anything could happen.
There is a third possibility:
- Bugs in system software (kernel or libraries).
Hardware-related failures usually do not reproduce in exactly the same way after power cycling and rebooting the system. There’s little Postfix can do about bad hardware. Be sure to use hardware that at the very least can detect memory errors. Otherwise, Postfix will just be waiting to be hit by a bit error. Critical systems deserve real hardware.
When a compiler makes an error, the problem can be reproduced whenever the resulting program is run. Compiler errors are most likely to happen in the code optimizer. If a problem is reproducible across power cycles and system reboots, it can be worthwhile to rebuild Postfix with optimization disabled, and to see if optimization makes a difference.
In order to compile Postfix with optimizations turned off:
% make tidy % make makefiles OPT=
This produces a set of Makefiles that do not request compiler optimization.
Once the makefiles are set up, build the software:
% make % su Password:# make install
If the problem goes away, then it is time to ask your vendor for help.
While installing postfix rpm following error is coming.
While installing postfix rpm following error is coming.
[root@mcsmail ~]# rpm -ivh postfix-2.1.5-2.3.RHEL4.1.i386.rpm –nodeps warning: postfix-2.1.5-2.3.RHEL4.1.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e Preparing… ########################################### [100%]
1:postfix warning: group postdrop does not exist – using root warning: group postdrop does not exist – using root warning: group postdrop does not exist – using root warning: group postdrop does not exist – using root
Solution:
Create the group postdrop manually. After that run the following,
rpm -ivh postfix-2.1.5-2.3.RHEL4.1.i386.rpm –nodeps
Recent Comments