diff --git a/root/etc/e-smith/templates/etc/postfix/main.cf/32myorigin b/root/etc/e-smith/templates/etc/postfix/main.cf/32myorigin index 6af2bd2..bbaea63 100644 --- a/root/etc/e-smith/templates/etc/postfix/main.cf/32myorigin +++ b/root/etc/e-smith/templates/etc/postfix/main.cf/32myorigin @@ -1 +1,2 @@ myorigin = $mydomain +append_at_myorigin = yes diff --git a/root/etc/e-smith/templates/etc/postfix/main.cf/60transport b/root/etc/e-smith/templates/etc/postfix/main.cf/60transport index 3c630c6..fe99b64 100644 --- a/root/etc/e-smith/templates/etc/postfix/main.cf/60transport +++ b/root/etc/e-smith/templates/etc/postfix/main.cf/60transport @@ -4,7 +4,7 @@ my $display = 0; use esmith::DomainsDB; my $domainsdb = esmith::DomainsDB->open_ro(); - for my $domain ($domainsdb->domains) + for my $domain ($domainsdb->get_all) { my $mail_server = $domain->prop('MailServer') || $DelegateMailServer diff --git a/root/etc/e-smith/templates/etc/postfix/main.cf/64luser_relay_catchall b/root/etc/e-smith/templates/etc/postfix/main.cf/64luser_relay_catchall index 1b00aaa..a161c89 100644 --- a/root/etc/e-smith/templates/etc/postfix/main.cf/64luser_relay_catchall +++ b/root/etc/e-smith/templates/etc/postfix/main.cf/64luser_relay_catchall @@ -1,6 +1,7 @@ { -# we use the value of EmailUnknownUser (default to returntosender) -return "# we bounce all unknown address $EmailUnknownUser not set or equal to returntosender " unless (defined $EmailUnknownUser and $EmailUnknownUser ne 'returntosender'); -$OUT ="luser_relay = $EmailUnknownUser"; - -} + # we use the value of EmailUnknownUser (default to returntosender) + # this option night ignore all virtual_maps entries... like pseudonyms and groups in case of virtual domain + # see /etc/e-smith/templates//etc/postfix/virtual/95unknownusers + #return "# we bounce all unknown address $EmailUnknownUser not set or equal to returntosender " unless (defined $EmailUnknownUser and $EmailUnknownUser ne 'returntosender'); + #$OUT ="luser_relay = $EmailUnknownUser"; +}# if enabled, we catch all unknown users in virtual diff --git a/root/etc/e-smith/templates/etc/postfix/transport/10hosts b/root/etc/e-smith/templates/etc/postfix/transport/10hosts index fd4ced7..ee117bf 100644 --- a/root/etc/e-smith/templates/etc/postfix/transport/10hosts +++ b/root/etc/e-smith/templates/etc/postfix/transport/10hosts @@ -6,7 +6,7 @@ - for my $domain ($domainsdb->domains) + for my $domain ($domainsdb->get_all) { my $mail_server = $domain->prop('MailServer') diff --git a/root/etc/e-smith/templates/etc/postfix/virtual/06user b/root/etc/e-smith/templates/etc/postfix/virtual/06user index eeda8ca..f5c5ac9 100644 --- a/root/etc/e-smith/templates/etc/postfix/virtual/06user +++ b/root/etc/e-smith/templates/etc/postfix/virtual/06user @@ -1,3 +1,2 @@ # SME users # not needed postfix will map all system users directly - diff --git a/root/etc/e-smith/templates/etc/postfix/virtual/95unknownusers b/root/etc/e-smith/templates/etc/postfix/virtual/95unknownusers new file mode 100644 index 0000000..81688f9 --- /dev/null +++ b/root/etc/e-smith/templates/etc/postfix/virtual/95unknownusers @@ -0,0 +1,16 @@ +{ + # as we might have virtualdomains we prefer this over luser_relay + return "# we bounce all unknown address $EmailUnknownUser not set or equal to returntosender " unless (defined $EmailUnknownUser and $EmailUnknownUser ne 'returntosender'); + $OUT = ""; + my $i = 0; + use esmith::DomainsDB; + my $ddb = esmith::DomainsDB->open_ro; + my @domains = map { $_->key } $ddb->get_all_by_prop('type' => 'domain'); + foreach my $domain ( @domains ) + { + my $d = $ddb->get($domain); + next if (($d->prop('VirtualMail') || "disabled") eq "enabled"); + next unless (($d->prop('MailServer') || '') eq ''); + $OUT .= "\@$domain $EmailUnknownUser\n"; + } +} diff --git a/root/usr/lib/systemd/system/postfix.service.d/50koozali.conf b/root/usr/lib/systemd/system/postfix.service.d/50koozali.conf index 4aea51b..eebf97a 100644 --- a/root/usr/lib/systemd/system/postfix.service.d/50koozali.conf +++ b/root/usr/lib/systemd/system/postfix.service.d/50koozali.conf @@ -3,6 +3,7 @@ ExecStartPre=/sbin/e-smith/service-status postfix ExecStartPre=/sbin/e-smith/systemd/postfix-pre ExecReload= ExecReload=/sbin/e-smith/systemd/postfix-reload +SyslogIdentifier=postfix [Install] WantedBy=sme-server.target