#685725 stunnel4: When postfix is used with stunnel, stunnel needs to be restarted before mails will send

Package:
stunnel4
Source:
stunnel4
Description:
Universal SSL tunnnel for network daemons - compatibility package
Submitter:
David Jarvie
Date:
2014-10-28 21:09:05 UTC
Severity:
normal
#685725#5
Date:
2012-08-23 23:12:19 UTC
From:
To:
I have to use stunnel with postfix in order to achieve TLS wrapper mode for sending mails. Each time after booting, mails get deferred instead of sent. This continues to happen until I run '/etc/init.d/stunnel4 restart'. From then on, mails are sent successfully.

The stunnel4 and postfix startup scripts are installed as S21stunnel4 and S22postfix. Perhaps the solution would be to change the stunnel4 script to S23stunnel4 instead, so as to change the order of their startup? (I haven't yet tried this, so I don't know.)

My postfix configuration file is as follows.
/etc/postfix/main.cf:
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
append_dot_mydomain = no
readme_directory = no

#=====Options for using stunnel wrapper for TLS=======
smtp_use_tls = no
smtp_enforce_tls = no
relayhost = [127.0.0.1]:11125
#=====End stunnel Options=======
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options =
smtp_sasl_auth_soft_bounce = no

myhostname = abcdefg
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = abcdefg, localhost.localdomain, localhost
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter =
inet_interfaces = all
inet_protocols = ipv4

#685725#10
Date:
2012-12-02 00:41:40 UTC
From:
To:
I tried reordering the postfix and stunnel services at bootup, by renaming /etc/rc*.d/S21stunnel4 to /etc/rc*.d/S23stunnel4. This makes no difference to the problem. Mails to be sent still get deferred until I execute '/etc/init.d/stunnel4 restart'.
#685725#15
Date:
2013-09-08 22:36:11 UTC
From:
To:
Just to confirm that this bug still happens in Wheezy.

stunnel4  3:4.53-1.1
postfix  2.9.6-2

#685725#20
Date:
2014-10-28 21:05:20 UTC
From:
To:
Hi David,

It is difficult to say anything conclusive without the logs of stunnel
and postfix.

Mike