I fetch some data from PGSQL database, please let me know if you need
any additional config files considering PGSQL tables.
There is no .forward file used since OpenSMTPd 6.0.

The same configuration (except syntax changes in smtpd.conf) works
perfectly for smtpd 6.0.

I actively use domain3.tld with this configuration. Other domains are
suspended for now. So all the actions happened with domain3.tld.

cat /etc/mail/smtpd.conf
#       $OpenBSD: smtpd.conf,v 1.11 2018/06/04 21:10:58 jmc Exp $

# This is the smtpd server system-wide configuration file.
# See smtpd.conf(5) for more information.

### blacklist filtering
# filter dnsbl-sorbs    dnsbl   "-h dnsbl.sorbs.net"
# filter dnsbl-spamcop  dnsbl   "-h bl.spamcop.net"
# filter dnsbl-spamhaus dnsbl   "-h zen.spamhaus.org"
# filter dnsbl-all      chain   dnsbl-sorbs dnsbl-spamcop dnsbl-spamhaus

### pki
pki smtp.domain1.tld cert "/etc/ssl/mail/smtp.domain1.tld.crt"
pki smtp.domain1.tld key "/etc/ssl/mail/private/smtp.domain1.tld.key"
pki smtp.domain2.tld cert "/etc/ssl/mail/smtp.domain2.tld.crt"
pki smtp.domain2.tld key "/etc/ssl/mail/private/smtp.domain2.tld.key"
pki smtp.domain3.tld cert "/etc/ssl/mail/smtp.domain3.tld.crt"
pki smtp.domain3.tld key "/etc/ssl/mail/private/smtp.domain3.tld.key"

pki smtp.domain3.tld dhe auto

smtp ciphers
ECDHE-RSA-CHACHA20-POLY1305:ECDHE-RSA-AES256-GCM-SHA384:TLSv1.2:SSLv3

smtp max-message-size 20M

### tables
table sources {12.34.56.78}
table helonames {12.34.56.78 = smtp.domain3.tld}
table aliases db:/etc/mail/aliases.db
table domains postgres:/etc/mail/smtpd-pgsql.conf
table virtuals postgres:/etc/mail/smtpd-pgsql.conf
table passwd postgres:/etc/mail/smtpd-pgsql.conf
table userinfo postgres:/etc/mail/smtpd-pgsql.conf

### listen ports
listen on lo0 tls pki smtp.domain3.tld hostnames {12.34.56.78 =
smtp.domain3.tld}
listen on lo0 smtps auth <passwd> pki smtp.domain3.tld hostname
smtp.domain3.tld
listen on lo0 port submission tls-require auth <passwd> pki
smtp.domain3.tld hostname smtp.domain3.tld
listen on lo0 port 10028 tag DKIM_OUT
# Spampd will relay emails after parsing
listen on lo0 port 10026 tag SPAM_IN

### actions
action "local-aliases" lmtp "/var/dovecot/lmtp" rcpt-to alias <aliases>
action "virtual-users" lmtp "/var/dovecot/lmtp" rcpt-to virtual <virtuals>
action "spampd-in" relay host smtp://127.0.0.1:10025
action "relay-to-backup-mx" relay backup mx smtp1.domain3.tld
action "dkim-sign" relay host smtp://127.0.0.1:10027
action "outbound" relay src <sources> helo-src <helonames>

### allow local messages
match from local for local action "local-aliases"
match tag SPAM_IN for local action "local-aliases"
### allow vitual domains
match from any for domain <domains> action "virtual-users"
match tag SPAM_IN from any for domain <domains> action "virtual-users"
### allow outgoing mail
match auth from any for any action "outbound"

### Untagged mail send to SpamAssassin (spampd)
#match from any for domain <domains> action "spampd-in"

### Relay signed emails
match tag DKIM_OUT for domain <domains> action "outbound"

### Sign emails by DKIM proxy
#match for domain <domains> action "dkim-sign"
-------------------------

cat /etc/mail/smtpd-pgsql.conf
### smtpd.conf refers to postgres:/etc/mail/smtpd-pgsql.conf

conninfo host=127.0.0.1 dbname=authdb user=user password=secret

query_alias SELECT destination FROM virtuals WHERE aliasid=$1
query_domain SELECT domain FROM domains WHERE domain=$1 LIMIT 1
#query_domain SELECT REPLACE ('@', ''), realm FROM users WHERE realm=$1
LIMIT 1
query_credentials SELECT userid, passwd FROM users WHERE userid=$1 AND
active='1'
query_userinfo SELECT CONCAT (userid, realm) AS user, uid, gid  FROM
users WHERE userid=$1 AND active='1'
-------------------------


On 9/7/2018 10:34 PM, Matt Schwartz wrote:
> Can you share your smtpd.conf and virtual users table? Please also let
> me know if you use a userbase table and share  it as well. Also, are the
> forwards going through a .forward file?
> 
> On Sep 7, 2018 2:44 PM, "Denis" <den...@mindall.org
> <mailto:den...@mindall.org>> wrote:
> 
>     Since /etc/myname changed to a different one from virtual domain name
>     used in OpenSMTPd mlmmj mailing lists work well, aliases work as it
>     should be too.
> 
>     But I can't send mail to a users with 'real' mailboxes in the same
>     domain served by OpenSMTPd where aliased users present also.
> 
>     For instance:
>     us...@domain.tld can send to ali...@domain.tld alias2@ alias3@
>     but
>     us...@domain.tld can't send to us...@domain.tld user3@ user4@ and other
>     users with 'real' mailboxes in the same domain.
> 
>     'An error occurred while sending mail. The mail server responded:
>     ,5.2.4 Mailing list expansion problem., Please check the message
>     recipient "us...@domain.tld" and try again'
> 
>     #tail -n 20 /var/log/maillog
>     smtpd[6323] smtp failed-command address=12.34.56.78 host=12.34.56.78
>     command="RCPT TO:<us...@domain.tld>" result="524 52.4 Mailing list
>     expansion problem"
>     smtpd[6323] smtp failed-command address=12.34.56.78 host=12.34.56.78
>     command="RCPT TO:<us...@domain.tld>" result="524 52.4 Mailing list
>     expansion problem"
>     ..
> 
>     Outgoing mail sends well. Incoming mail receives well too.
> 
>     opensmtpd works with dovecot imap together.
> 
>     Any advises will be highly appreciated.
> 
>     On 8/19/2018 12:57 PM, Denis wrote:
>     > Solved. The problem was with /etc/myname which has the same name
>     as one
>     > of virtual domains used for smtpd.
>     >
>     > On 8/19/2018 12:56 AM, Denis wrote:
>     >> Hi there,
>     >>
>     >> After "upgrade" OpenSMTPd to 6.4.0 (smtpd.conf syntax has been
>     >> corrected) from OpenBSD -current having trouble with aliased
>     addresses.
>     >>
>     >> If I tried to send mail to alias address I receive error from
>     mail program:
>     >>
>     >> 'An error occurred while sending mail. The mail server responded:
>     >> ,5.2.4 Mailing list expansion problem., Please check the message
>     >> recipient "ali...@domain.tld" and try again'
>     >>
>     >> mlmmj does not send emails also by OSMTPd 6.4.0. I have only one list
>     >> named 'all' for broadcast messages. So if I sent to a...@domain.tld I
>     >> receive nothing.
>     >>
>     >> Previously, OpenSMTPD 6.0 from OpenBSD 6.3 sources look for 'aliases'
>     >> from 'aliases.db' and 'virtuals' from PostgreSQL database. All works
>     >> smoothly as it should be.
>     >>
>     >> To exclude possible PGSQL issues for 'virtuals' I've added to
>     smtpd.conf
>     >> lookup for 'virtuals' from plain text file:
>     >>
>     >> ...
>     >> table aliases db:/etc/mail/aliases.db
>     >> table virtuals file:/etc/mail/virtuals
>     >> # table virtuals postgres:/etc/mail/smtpd-pgsql.conf
>     >> ...
>     >>
>     >> In all cases (when 'table virtuals file:/..' or 'table virtuals
>     >> postgres:/..' or using mlmmj, or mail to aliased address) I have the
>     >> same debug messages by running smtpd 6.4.0 in table debug mode:
>     >>
>     >> # smtpd -dv -T virtuals -T lookup
>     >>
>     >> ...
>     >> 77205978ce2bed68 smtp connected address=local host=domain.tld
>     >> lookup: check "local" as NETADDR in table static:<localhost> -> found
>     >> lookup: check "domain.tld" as DOMAIN in table static:<localnames>
>     -> found
>     >> lookup: lookup "support" as ALIAS in table db:aliases -> "myaddr"
>     >> debug: aliases_get: returned 1 aliases
>     >> lookup: lookup "myaddr" as ALIAS in table db:aliases ->
>     "mya...@domain.tld"
>     >> debug: aliases_get: returned 1 aliases
>     >> lookup: check "local" as NETADDR in table static:<localhost> -> found
>     >> lookup: check "domain.tld" as DOMAIN in table static:<localnames>
>     -> found
>     >> lookup: lookup "myaddr" as ALIAS in table db:aliases ->
>     "mya...@domain.tld"
>     >> debug: aliases_get: returned 1 aliases
>     >> lookup: check "local" as NETADDR in table static:<localhost> -> found
>     >> lookup: check "domain.tld" as DOMAIN in table static:<localnames>
>     -> found
>     >> lookup: lookup "myaddr" as ALIAS in table db:aliases ->
>     "mya...@domain.tld"
>     >> debug: aliases_get: returned 1 aliases
>     >> lookup: check "local" as NETADDR in table static:<localhost> -> found
>     >> lookup: check "domain.tld" as DOMAIN in table static:<localnames>
>     -> found
>     >> lookup: lookup "myaddr" as ALIAS in table db:aliases ->
>     "mya...@domain.tld"
>     >> debug: aliases_get: returned 1 aliases
>     >> lookup: check "local" as NETADDR in table static:<localhost> -> found
>     >> lookup: check "domain.tld" as DOMAIN in table static:<localnames>
>     -> found
>     >> 77205978ce2bed68 smtp failed-command address=local host=domaintld
>     >> command="RCPT TO:<supp...@domain.tld> " result="524 5.2.4 Mailing
>     list
>     >> expansion problem"
>     >> debug: control -> client: pipe closed
>     >> debug: clearing p=client, fd=11, pid=0
>     >> 77205978ce2bed68 smtp disconnected address=local host=domain.tld
>     >> reason=disconnect
>     >> ...
>     >>
>     >> What can be wrong?
>     >>
>     >> Denis
>     >>
>     >>
>     >>
>     >>
>     >>
>     >
> 
>     -- 
>     You received this mail because you are subscribed to
>     misc@opensmtpd.org <mailto:misc@opensmtpd.org>
>     To unsubscribe, send a mail to: misc+unsubscr...@opensmtpd.org
>     <mailto:misc%2bunsubscr...@opensmtpd.org>
> 
> 

-- 
You received this mail because you are subscribed to misc@opensmtpd.org
To unsubscribe, send a mail to: misc+unsubscr...@opensmtpd.org

Reply via email to