Jump to content

Getting phpmail to function


VirusZero
 Share

Recommended Posts

So this is an issue I've been struggling with for a while. I figured I'd put it out here to see if maybe anyone has any ideas on how to fix it. 


The problem is that, for whatever reason, I cannot get phpmail to function. Whenever an email is supposed to be sent it doesn't go. I've checked my logs for: MyBB (tools->email logs, system logs, etc...) and var/spool/mail/ but there's nothing there. Checking /var/logs/maillog reveals this:

 

Mar 16 21:13:38 server sendmail[14968]: u2H1Dcq0014968: from=apache, size=825, class=0, nrcpts=1, msgid=<201603170113.u2H1Dcq0014968@localhost.localdomain>, relay=apache@localhost

Mar 16 21:13:38 server postfix/smtpd[14950]: connect from localhost.localdomain[127.0.0.1]

Mar 16 21:13:38 server postfix/smtpd[14950]: NOQUEUE: reject: RCPT from localhost.localdomain[127.0.0.1]: 454 4.7.1 <endlessfightforum@gmail>: Relay access denied; from=<apache@localhost.localdomain> to=<endlessfightforum@gmail> proto=ESMTP helo=<localhost.localdomain>


Mar 16 21:13:38 server sendmail[14968]: u2H1Dcq0014968: to=endlessfightforum@gmail, ctladdr=apache (48/48), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30825, relay=[127.0.0.1] [127.0.0.1], dsn=4.7.1, stat=Deferred: 454 4.7.1 <endlessfightforum@gmail>: Relay access denied


Mar 16 21:13:38 server postfix/smtpd[14950]: disconnect from localhost.localdomain[127.0.0.1]

 

I have an MX record set in my DNS directing mail to mail.endlessfight.net. I have a ptr record set up for any reverse DNS lookups (sometimes needed for mail servers). In my /etc/postfix/main.cf I have my $mydomain (endlessfight.net) and $myhostname (mail.endlessfight.net) declared as they should be. So it really shouldn't be setting localhost.localdomain for anything to begin with. But even though it is, I also have a Canonical list set so that anytime it says localhost.localdomain it should instead replace that with endlessfightforum@gmail.  (But it doesn't seem to be doing that either.)

 

 

For some extra technical details...

Spoiler

I originally ran CSF for my firewall, but after a component called LFD started throwing all kinds of excessive errors (I mean it was filling my error logs in less than an hour which then caused /var/spool/mail/myuser to fill up...) so I removed that completely and reverted to IPtables (using this guide). 

 

VPS type: OpenVZ 
OS: CentOS 6.5. 

 

Apache version: 2.2.15
PHP version: 5.5.29

MySQL version: 14.14 distribution 5.5.45

 

Control panel: zPanel 10.1.1. 

Postfix version: 2.6.6

 

Furthermore I have a Roundcube email installed also and it works just fine. I can send and receive emails with it no problem. So this issue seems isolated to phpmail.

 

So at this point I'm kind of at a loss as to what's wrong. I've considered taking a backup of everything and then reinstalling the OS/Panel to basically wipe the slate clean and start over... But I have no idea if that'd even work or if I'd just end up back where I am now. 

"There are three sides to every story... Your side, their side, and then somewhere in the middle is the truth."
Link to comment
Share on other sites

  • Admin

I'm not sure a reinstall will fix it. It looks like an issue with the /etc/postfix/main.cf configuration that I can tell. Would you mind posting the contents of that here for me @VirusZero?

0_mainsignature.jpg

image.png

Profile set made by myself and original Artwork by Fae Merriman, my daughter.

 

 

Link to comment
Share on other sites

That's what I thought too (about reinstalling not fixing things... Though if I were going to do it, I'd probably use Sentora panel instead of zPanel simply because Sentora is more up to date).

 

Sure, the contents of main.cf are:

# postfix config file

# uncomment for debugging if needed
soft_bounce=yes

# postfix main
mail_owner = postfix
setgid_group = postdrop
delay_warning_time = 4

# postfix paths
html_directory = no
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
queue_directory = /var/spool/postfix
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.2.2/samples
readme_directory = /usr/share/doc/postfix-2.2.2/README_FILES

# network settings
inet_interfaces = all
mydomain = endlessfight.net
myhostname = mail.endlessfight.net
mynetworks = all
mydestination = $myhostname
# localhost.localdomain, localhost
relay_domains = proxy:mysql:/etc/zpanel/configs/postfix/mysql-relay_domains_maps.cf
myorigin = $myhostname

# mail delivery
recipient_delimiter = +

# mappings
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
transport_maps = hash:/etc/postfix/transport
#local_recipient_maps =

# virtual setup
virtual_alias_maps = proxy:mysql:/etc/zpanel/configs/postfix/mysql-virtual_alias_maps.cf,
                     regexp:/etc/zpanel/configs/postfix/virtual_regexp
virtual_mailbox_base = /var/zpanel/vmail
virtual_mailbox_domains = proxy:mysql:/etc/zpanel/configs/postfix/mysql-virtual_domains_maps.cf
virtual_mailbox_maps = proxy:mysql:/etc/zpanel/configs/postfix/mysql-virtual_mailbox_maps.cf

virtual_mailbox_limit_maps = proxy:mysql:/etc/zpanel/configs/postfix/mysql-virtual_mailbox_limit_maps.cf
virtual_minimum_uid = 101
virtual_uid_maps = static:101
virtual_gid_maps = static:12
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1

# debugging
debug_peer_level = 2
debugger_command =
         PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
         xxgdb $daemon_directory/$process_name $process_id & sleep 5

# authentication
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
broken_sasl_auth_clients = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth

# tls config
smtp_use_tls = no
smtpd_use_tls = no
#smtp_tls_note_starttls_offer = yes
#smtpd_tls_loglevel = 1
#smtpd_tls_received_header = yes
#smtpd_tls_session_cache_timeout = 3600s
#tls_random_source = dev:/dev/urandom
#smtp_tls_session_cache_database = btree:$data_directory/smtp_tls_session_cache
# Change mail.example.com.* to your host name
#smtpd_tls_key_file = /etc/pki/tls/private/mail.example.com.key
#smtpd_tls_cert_file = /etc/pki/tls/certs/mail.example.com.crt
# smtpd_tls_CAfile = /etc/pki/tls/root.crt

# rules restrictions
smtpd_client_restrictions =
smtpd_helo_restrictions =
smtpd_sender_restrictions =
smtpd_recipient_restrictions = permit_sasl_authenticated,
        permit_mynetworks,
        reject_unauth_destination,
        reject_non_fqdn_sender,
        reject_non_fqdn_recipient,
        reject_unknown_recipient_domain
# uncomment for realtime black list checks
#       ,reject_rbl_client zen.spamhaus.org
#       ,reject_rbl_client bl.spamcop.net
#       ,reject_rbl_client dnsbl.sorbs.net

smtpd_helo_required = yes
unknown_local_recipient_reject_code = 550
disable_vrfy_command = yes
smtpd_data_restrictions = reject_unauth_pipelining

sender_canonical_maps = hash:/etc/postfix/canonical

 

"There are three sides to every story... Your side, their side, and then somewhere in the middle is the truth."
Link to comment
Share on other sites

  • Admin

Alright, it looks fine but can you run this and show me the results:

echo $(hostname).$(awk -F' = ' '/^mydomain/{print$2}' /etc/postfix/main.cf)

I want to see what it outputs (if anything).

0_mainsignature.jpg

image.png

Profile set made by myself and original Artwork by Fae Merriman, my daughter.

 

 

Link to comment
Share on other sites

That's strange... it's outputting:

 

server.endlessfight.net.endlessfight.net


 

"There are three sides to every story... Your side, their side, and then somewhere in the middle is the truth."
Link to comment
Share on other sites

  • Admin

That's probably the root issue. Let me see if I can find a fix.

0_mainsignature.jpg

image.png

Profile set made by myself and original Artwork by Fae Merriman, my daughter.

 

 

Link to comment
Share on other sites

  • Admin

@VirusZero

Can you get me the contents of this file:

/etc/zpanel/configs/postfix/mysql-relay_domains_maps.cf

0_mainsignature.jpg

image.png

Profile set made by myself and original Artwork by Fae Merriman, my daughter.

 

 

Link to comment
Share on other sites

Sure, it's:

 

hosts = localhost
user = postfix
password = <removed for privacy/security sake>
dbname = zpanel_postfix
query = SELECT domain FROM domain WHERE domain='%s' and backupmx = '1'

 

Edited by VirusZero
"There are three sides to every story... Your side, their side, and then somewhere in the middle is the truth."
Link to comment
Share on other sites

  • Admin

Alright. Lets try this. In the main.cnf file change the mydestination line to this:

mydestination = localhost.$mydomain, localhost

 

0_mainsignature.jpg

image.png

Profile set made by myself and original Artwork by Fae Merriman, my daughter.

 

 

Link to comment
Share on other sites

Ok, I've changed that (and did the reload / restart of the service to ensure changes are implemented). I sent a test email, but never received anything. 

 

I've checked MyBB's email logs and there's nothing there. I checked var/log/maillog and no errors there now. Similarly, /var/spool/mail/myuser is empty. (Also the mailq is empty.) So it just seems to have vanished into the aether...

 

Also

2 hours ago, Morrigan said:

echo $(hostname).$(awk -F' = ' '/^mydomain/{print$2}' /etc/postfix/main.cf)

is still reporting

2 hours ago, VirusZero said:

server.endlessfight.net.endlessfight.net

 

"There are three sides to every story... Your side, their side, and then somewhere in the middle is the truth."
Link to comment
Share on other sites

  • Admin

Okay, lets try this because it has to do with that hostname (I think what you are showing is in your DNS) change this line to what is your hostname:

myorigin = endlessfight.net

 

0_mainsignature.jpg

image.png

Profile set made by myself and original Artwork by Fae Merriman, my daughter.

 

 

Link to comment
Share on other sites

Didn't work (saved changes, reloaded/restarted postfix) still no email sent. 

 

Though now I'm getting this error in the maillog:

Mar 17 17:34:32 server sendmail[27122]: u2HLYWZj027122: from=apache, size=147, class=0, nrcpts=1, msgid=<201603172134.u2HLYWZj027122@localhost.localdomain>, relay=apache@localhost

Mar 17 17:34:32 server postfix/smtpd[27110]: connect from localhost.localdomain[127.0.0.1]

Mar 17 17:34:32 server postfix/smtpd[27110]: NOQUEUE: reject: RCPT from localhost.localdomain[127.0.0.1]: 454 4.7.1 <endlessfightforum@gmail>: Relay access denied; from=<apache@localhost.localdomain> to=<endlessfightforum@gmail> proto=ESMTP helo=<localhost.localdomain>

Mar 17 17:34:32 server sendmail[27122]: u2HLYWZj027122: to=endlessfightforum@gmail, ctladdr=apache (48/48), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30147, relay=[127.0.0.1] [127.0.0.1], dsn=4.7.1, stat=Deferred: 454 4.7.1 <endlessfightforum@gmail>: Relay access denied


Mar 17 17:34:32 server postfix/smtpd[27110]: disconnect from localhost.localdomain[127.0.0.1]

 

 

"There are three sides to every story... Your side, their side, and then somewhere in the middle is the truth."
Link to comment
Share on other sites

  • Admin

It seems to me like it's pulling something from somewhere that isn't in that file like it should be. Are you able to pull the "sample" file and post it here for me to see?

0_mainsignature.jpg

image.png

Profile set made by myself and original Artwork by Fae Merriman, my daughter.

 

 

Link to comment
Share on other sites

The sample directory

 /usr/share/doc/postfix-2.2.2/samples  

doesn't exist.

 

It's at: 

sample_directory = /usr/share/doc/postfix-2.6.6/examples

But which file did you need? 

chroot-setup/LINUX2

Spoiler

#! /bin/sh

# LINUX2 - shell script to set up a Postfix chroot jail for Linux
# Tested on SuSE Linux 5.3 (libc5) and 7.0 (glibc2.1)

# Other testers reported as working:
#
# 2001-01-15 Debian sid (unstable)
#            Christian Kurz <shorty@getuid.de>

# Copyright (c) 2000 - 2001 by Matthias Andree
# Redistributable unter the MIT-style license that follows:
# Abstract: "do whatever you want except hold somebody liable or change
# the copyright information".

# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.

# 2000-09-29
# v0.1: initial release

# 2000-12-05
# v0.2: copy libdb.* for libnss_db.so
#       remove /etc/localtime in case it's a broken symlink
#       restrict find to maxdepth 1 (faster)

# Revision 1.4  2001/01/15 09:36:35  emma
# add note it was successfully tested on Debian sid
#
# 20060101 /lib64 support by Keith Owens.
#
 


CP="cp -p"

cond_copy() {
  # find files as per pattern in $1
  # if any, copy to directory $2
  dir=`dirname "$1"`
  pat=`basename "$1"`
  lr=`find "$dir" -maxdepth 1 -name "$pat"`
  if test ! -d "$2" ; then exit 1 ; fi
  if test "x$lr" != "x" ; then $CP $1 "$2" ; fi
}

set -e
umask 022

POSTFIX_DIR=${POSTFIX_DIR-/var/spool/postfix}
cd ${POSTFIX_DIR}

mkdir -p etc lib usr/lib/zoneinfo
test -d /lib64 && mkdir -p lib64

# find localtime (SuSE 5.3 does not have /etc/localtime)
lt=/etc/localtime
if test ! -f $lt ; then lt=/usr/lib/zoneinfo/localtime ; fi
if test ! -f $lt ; then lt=/usr/share/zoneinfo/localtime ; fi
if test ! -f $lt ; then echo "cannot find localtime" ; exit 1 ; fi
rm -f etc/localtime

# copy localtime and some other system files into the chroot's etc
$CP -f $lt /etc/services /etc/resolv.conf /etc/nsswitch.conf etc
$CP -f /etc/host.conf /etc/hosts /etc/passwd etc
ln -s -f /etc/localtime usr/lib/zoneinfo

# copy required libraries into the chroot
cond_copy '/lib/libnss_*.so*' lib
cond_copy '/lib/libresolv.so*' lib
cond_copy '/lib/libdb.so*' lib
if test -d /lib64; then
  cond_copy '/lib64/libnss_*.so*' lib64
  cond_copy '/lib64/libresolv.so*' lib64
  cond_copy '/lib64/libdb.so*' lib64
fi

postfix reload
 

 

qmail-local/qmail-local.txt

Spoiler

From: Ron Bickers <rbickers@logicetc.com>

For the archives (or for comment):

I now have mailbox_command = /usr/local/libexec/postqmail-local and
postqmail-local looks like this (minus some mailer wrapping):

  #!/bin/sh
  export PATH=$PATH:/usr/local/bin:/var/qmail/bin
  tail +2 | seekablepipe qmail-local -- \
    "$USER" "$HOME" "$LOCAL" "${EXTENSION:+-}" "$EXTENSION"
    "$DOMAIN""$SENDER" ./Maildir/
  e=$?
  (($e == 111)) && exit 75
  (($e == 100)) && exit 77
  exit $e


 

 

smtpd-policy/greylist.pl

Spoiler

#!/usr/bin/perl

use DB_File;
use Fcntl;
use Sys::Syslog qw(:DEFAULT setlogsock);

#
# Usage: greylist.pl [-v]
#
# Demo delegated Postfix SMTPD policy server. This server implements
# greylisting. State is kept in a Berkeley DB database.  Logging is
# sent to syslogd.
#
# How it works: each time a Postfix SMTP server process is started
# it connects to the policy service socket, and Postfix runs one
# instance of this PERL script.  By default, a Postfix SMTP server
# process terminates after 100 seconds of idle time, or after serving
# 100 clients. Thus, the cost of starting this PERL script is smoothed
# out over time.
#
# To run this from /etc/postfix/master.cf:
#
#    policy  unix  -       n       n       -       -       spawn
#      user=nobody argv=/usr/bin/perl /usr/libexec/postfix/greylist.pl
#
# To use this from Postfix SMTPD, use in /etc/postfix/main.cf:
#
#    smtpd_recipient_restrictions =
#       ...
#       reject_unauth_destination
#       check_policy_service unix:private/policy
#       ...
#
# NOTE: specify check_policy_service AFTER reject_unauth_destination
# or else your system can become an open relay.
#
# To test this script by hand, execute:
#
#    % perl greylist.pl
#
# Each query is a bunch of attributes. Order does not matter, and
# the demo script uses only a few of all the attributes shown below:
#
#    request=smtpd_access_policy
#    protocol_state=RCPT
#    protocol_name=SMTP
#    helo_name=some.domain.tld
#    queue_id=8045F2AB23
#    sender=foo@bar.tld
#    recipient=bar@foo.tld
#    client_address=1.2.3.4
#    client_name=another.domain.tld
#    instance=123.456.7
#    sasl_method=plain
#    sasl_username=you
#    sasl_sender=
#    size=12345
#    [empty line]
#
# The policy server script will answer in the same style, with an
# attribute list followed by a empty line:
#
#    action=dunno
#    [empty line]
#

#
# greylist status database and greylist time interval. DO NOT create the
# greylist status database in a world-writable directory such as /tmp
# or /var/tmp. DO NOT create the greylist database in a file system
# that can run out of space.
#
# In case of database corruption, this script saves the database as
# $database_name.time(), so that the mail system does not get stuck.
#
$database_name="/var/mta/greylist.db";
$greylist_delay=60;

#
# Auto-whitelist threshold. Specify 0 to disable, or the number of
# successful "come backs" after which a client is no longer subject
# to greylisting.
#
$auto_whitelist_threshold = 10;

#
# Syslogging options for verbose mode and for fatal errors.
# NOTE: comment out the $syslog_socktype line if syslogging does not
# work on your system.
#
$syslog_socktype = 'unix'; # inet, unix, stream, console
$syslog_facility="mail";
$syslog_options="pid";
$syslog_priority="info";

#
# Demo SMTPD access policy routine. The result is an action just like
# it would be specified on the right-hand side of a Postfix access
# table.  Request attributes are available via the %attr hash.
#
sub smtpd_access_policy {
    my($key, $time_stamp, $now, $count);

    # Open the database on the fly.
    open_database() unless $database_obj;

    # Search the auto-whitelist.
    if ($auto_whitelist_threshold > 0) {
        $count = read_database($attr{"client_address"});
        if ($count > $auto_whitelist_threshold) {
            return "dunno";
        }
    }

    # Lookup the time stamp for this client/sender/recipient.
    $key =
        lc $attr{"client_address"}."/".$attr{"sender"}."/".$attr{"recipient"};
    $time_stamp = read_database($key);
    $now = time();

    # If this is a new request add this client/sender/recipient to the database.
    if ($time_stamp == 0) {
        $time_stamp = $now;
        update_database($key, $time_stamp);
    }

    # The result can be any action that is allowed in a Postfix access(5) map.
    #
    # To label mail, return ``PREPEND'' headername: headertext
    #
    # In case of success, return ``DUNNO'' instead of ``OK'' so that the
    # check_policy_service restriction can be followed by other restrictions.
    #
    # In case of failure, specify ``DEFER_IF_PERMIT optional text...''
    # so that mail can still be blocked by other access restrictions.
    #
    syslog $syslog_priority, "request age %d", $now - $time_stamp if $verbose;
    if ($now - $time_stamp > $greylist_delay) {
        # Update the auto-whitelist.
        if ($auto_whitelist_threshold > 0) {
            update_database($attr{"client_address"}, $count + 1);
        }
        return "dunno";
    } else {
        return "defer_if_permit Service is unavailable";
    }
}

#
# You should not have to make changes below this point.
#
sub LOCK_SH { 1 };      # Shared lock (used for reading).
sub LOCK_EX { 2 };      # Exclusive lock (used for writing).
sub LOCK_NB { 4 };      # Don't block (for testing).
sub LOCK_UN { 8 };      # Release lock.

#
# Log an error and abort.
#
sub fatal_exit {
    my($first) = shift(@_);
    syslog "err", "fatal: $first", @_;
    exit 1;
}

#
# Open hash database.
#
sub open_database {
    my($database_fd);

    # Use tied database to make complex manipulations easier to express.
    $database_obj = tie(%db_hash, 'DB_File', $database_name,
                            O_CREAT|O_RDWR, 0644, $DB_BTREE) ||
        fatal_exit "Cannot open database %s: $!", $database_name;
    $database_fd = $database_obj->fd;
    open DATABASE_HANDLE, "+<&=$database_fd" ||
        fatal_exit "Cannot fdopen database %s: $!", $database_name;
    syslog $syslog_priority, "open %s", $database_name if $verbose;
}

#
# Read database. Use a shared lock to avoid reading the database
# while it is being changed. XXX There should be a way to synchronize
# our cache from the on-file database before looking up the key.
#
sub read_database {
    my($key) = @_;
    my($value);

    flock DATABASE_HANDLE, LOCK_SH ||
        fatal_exit "Can't get shared lock on %s: $!", $database_name;
    # XXX Synchronize our cache from the on-disk copy before lookup.
    $value = $db_hash{$key};
    syslog $syslog_priority, "lookup %s: %s", $key, $value if $verbose;
    flock DATABASE_HANDLE, LOCK_UN ||
        fatal_exit "Can't unlock %s: $!", $database_name;
    return $value;
}

#
# Update database. Use an exclusive lock to avoid collisions with
# other updaters, and to avoid surprises in database readers. XXX
# There should be a way to synchronize our cache from the on-file
# database before updating the database.
#
sub update_database {
    my($key, $value) = @_;

    syslog $syslog_priority, "store %s: %s", $key, $value if $verbose;
    flock DATABASE_HANDLE, LOCK_EX ||
        fatal_exit "Can't exclusively lock %s: $!", $database_name;
    # XXX Synchronize our cache from the on-disk copy before update.
    $db_hash{$key} = $value;
    $database_obj->sync() &&
        fatal_exit "Can't update %s: $!", $database_name;
    flock DATABASE_HANDLE, LOCK_UN ||
        fatal_exit "Can't unlock %s: $!", $database_name;
}

#
# Signal 11 means that we have some kind of database corruption (yes
# Berkeley DB should handle this better).  Move the corrupted database
# out of the way, and start with a new database.
#
sub sigsegv_handler {
    my $backup = $database_name . "." . time();

    rename $database_name, $backup ||
        fatal_exit "Can't save %s as %s: $!", $database_name, $backup;
    fatal_exit "Caught signal 11; the corrupted database is saved as $backup";
}

$SIG{'SEGV'} = 'sigsegv_handler';

#
# This process runs as a daemon, so it can't log to a terminal. Use
# syslog so that people can actually see our messages.
#
setlogsock $syslog_socktype;
openlog $0, $syslog_options, $syslog_facility;

#
# We don't need getopt() for now.
#
while ($option = shift(@ARGV)) {
    if ($option eq "-v") {
        $verbose = 1;
    } else {
        syslog $syslog_priority, "Invalid option: %s. Usage: %s [-v]",
                $option, $0;
        exit 1;
    }
}

#
# Unbuffer standard output.
#
select((select(STDOUT), $| = 1)[0]);

#
# Receive a bunch of attributes, evaluate the policy, send the result.
#
while (<STDIN>) {
    if (/([^=]+)=(.*)\n/) {
        $attr{substr($1, 0, 512)} = substr($2, 0, 512);
    } elsif ($_ eq "\n") {
        if ($verbose) {
            for (keys %attr) {
                syslog $syslog_priority, "Attribute: %s=%s", $_, $attr{$_};
            }
        }
        fatal_exit "unrecognized request type: '%s'", $attr{request}
            unless $attr{"request"} eq "smtpd_access_policy";
        $action = smtpd_access_policy();
        syslog $syslog_priority, "Action: %s", $action if $verbose;
        print STDOUT "action=$action\n\n";
     %attr = ();
    } else {
        chop;
        syslog $syslog_priority, "warning: ignoring garbage: %.100s", $_;
    }
}
 

 

"There are three sides to every story... Your side, their side, and then somewhere in the middle is the truth."
Link to comment
Share on other sites

  • Admin

Hmmm, I'm not seeing where it's getting the defined $myhostname The only thing I can think of is it's DNS. What is the FDQN for your domain according to your server?

0_mainsignature.jpg

image.png

Profile set made by myself and original Artwork by Fae Merriman, my daughter.

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use, Guidelines and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.