Re: New report function for libopensmtpd

2022-10-18 Thread Leo Unglaub

If you follow this, you will not be so far of:

https://man.openbsd.org/style

On 18/10/2022 12:00, Martin Kjær Jørgensen wrote:

Okay I will.

Have you got a pattern the code should be written in or a
tool, like clang-format, to check/format with?




Re: bounce invalid message IDs?

2022-07-04 Thread Leo Unglaub

Hey,

yes that is possible if you write your own filter. You get the content 
you need and can reject it from your filter.


Greetings
Leo

On 04.07.22 09:34, Harald Dunkel wrote:

is it possible to bounce invalid message IDs, e.g. using a UUID
instead of the well-known format 
(https://en.wikipedia.org/wiki/Message-ID)?




Re: msgid and sending via email providers

2021-11-03 Thread Leo Unglaub

Hey,
i am not sure if that is directly related to you problem, but 
t-online.de is one of the worst email providers i have ever seen. They 
eandomly block you for no reason. Last month i got bocked because the 
hostname of my email server did not contain the word "mail". They 
demandet that all of the sudden. Then they only accepted emails from my 
servers if on the same IP as the mailserver there was a websever that 
served a valid impress/legal notce. Totally nuts that t-online.de company.


Meybe this helps you a bit.
Greetings
Leo

On 03/11/2021 14:38, Manfred Lotz wrote:

Hi there,
Could a msgid cause problems insofar as their content might be seen as
an indicator that the mail is SPAM?

My situation: I have a couple of email providers, where I send mails
from.

In Opensmtp I have something like this

...
action "posteo.de"   relay host smtps://pos...@posteo.de auth 
action "t-online.de" relay host smtps://tonl...@securesmtp.t-online.de auth 

...

Now when sending mail as manfred.lotz at posteo.de or manfred.lotz at
t-online.de the msgid always contains the local hostname which is
simply hogwart in /etc/hostname. My laptop is not registered with a dns
lookable server name.

Question: Is there a possibility to tell opensmtp to create a msgid like
ed8c9804c3dda99d8207f4ae945cd...@posteo.de>
instead of
ed8c9804c3dda99d8207f4ae945cddcf@hogwart>

when I send mails with From: manfred.lotz @ posteo.de?

Same for the other account.


Thanks.






Forwarding to one or more accounts

2021-04-13 Thread Leo Unglaub

Hi,
i am on the latest OpenBSD release and i have a little email server 
running. It works perfect, very stable. I host the following domains:



foo.com
bar.com


Both of them have some email accounts on them.


us...@foo.com
us...@foo.com
us...@bar.com


The config is as follows:


##
## Tables
##
table aliases file:/etc/mail/aliases
table vdomains file:/etc/mail/table-vdomains
table vaddr file:/etc/mail/table-vaddr
table credentials file:/etc/mail/table-credentials
table filter-dyndns file:/etc/mail/table-filter-dyndns
table vmailstub file:/etc/mail/table-vmailstub

##
## Listen
##
listen on lo0
listen on egress tls filter { "check-dyndns" "check-rdns" "check-fcrdns" 
"dnsbl" }
listen on egress port submission tls-require auth 
listen on egress port 25255 tls-require auth 


##
## Actions
##
action "outbound" relay
action "local-lmtp" lmtp "/var/dovecot/lmtp" rcpt-to virtual 

##
## Matches
##
match from any for domain  rcpt-to  action "local-lmtp"
match auth from any for any action "outbound"



Here are the tables:


# table-vdomains
foo.com
bar.com



# table-vaddr
us...@foo.com
us...@foo.com
us...@bar.com
user1al...@foo.com



# table-vmailstub
user1al...@foo.com us...@foo.com
@ dovecot-worker


Up until this point it works perfectly (i remove the TLS stuff from the 
email for clarity)


us...@foo.com, us...@foo.com and us...@bar.com can access there emails 
via IMAP over Dovecot, OpenSMTPD hands of emails via lmtp to Dovecot and 
emails send to user1al...@foo.com are stored in the us...@foo.com account.


But here is my problem, now i want to add "forwardings" for some 
accounts. An email send to us...@foo.com should be stored in the mailbox 
but also send ot us...@external-domain-gmail.com. Sadly i have no idea 
on how to do that. Any ideas? Maybe i am not finding stuff because 
"forwarding" is the wrong term for this? Maybe you could be so kind to 
send me off in the right direction.


That would be sooo nice of you!
Thanks and greetings
Leo



Re: Usage example for filter-dnsbl

2020-08-17 Thread Leo Unglaub

Hey,
thanks for the response. It works very well now.

Thank you so much!
Greetings,
Leo

On 2020-08-17 12:10, Martijn van Duren wrote:

I run filter-dnsbl as follow:

...
filter dnsbl proc-exec "filter-dnsbl -mv zen.spamhaus.org dnsbl.dronebl.org 
bl.spamcop.net"
...
listen on egress tls pki keys filter dnsbl
...

To be clear: filters in proc-exec chooes their own "phase, so there's no
need for you to worry about that. The only thing you need to know is
which blacklists you want to use and on which listen socket they should
be executed on (and optionally where in a filter-chain if you have
multiple).




Usage example for filter-dnsbl

2020-08-17 Thread Leo Unglaub

Hey,
i installed the filter "filter-dnsbl" from here 
(http://imperialat.at/dev/filter-dnsbl/) and now i want to add it to my 
config. However, i have to admit i have no idea how to do that? In what 
"phase" should i put this filter? I looked around but i found a couple 
of outdated blog posts on filters, but nothing current. I also read thru 
here 
(https://github.com/openbsd/src/blob/master/usr.sbin/smtpd/smtpd-filters.7), 
but i found nothing.


If someone of you has a working example on how to use that filter, could 
you please be so kind and send it to me?


Thanks so much and greetings
Leo



Re: Virtual user and domain setup

2020-04-07 Thread Leo Unglaub

Hey,
thank you s much for that snippet. I think i finally understood it 
and it works now. I had to addapt your config a little bit but it works 
now. I use basically your config with the action changed to the following:



action "local-lmtp" lmtp "/var/dovecot/lmtp" rcpt-to virtual 


At first i give it a try without the rcpt-to option to lmtp, but without 
that Dovecot always rejected the email for the user "vmail". But now 
with the rcpt-to it works perfectly.


Thank you all so much for the help and greetings from Vienna
Leo


Am 07.04.2020 um 01:36 schrieb Andrew Swartz:
This is one possible configuration which should do that which I think 
you are describing:


-

table vdomains file:/etc/mail/table_vmail_domains
table vaddr file:/etc/mail/table_vmail_addresses
table vmailstub   { '@' = vmail }

action "deliver_vmail" maildir 
"/home/vmail/domains/%{rcpt.domain:lowercase}/%{rcpt.user:lowercase|strip}" 
virtual 


match from any for domain  rcpt-to  action "deliver_vmail"

-

This setup accepts mail ONLY for virtual accounts and delivers it to a 
typical "vpopmail" maildir structure: "/home/vmail/domain/name"


You must create a system user "vmail" which does not receive any mail 
but is just the home folder for the mailboxes and the user for 
permission to deliver the mail.


Automate making the domains file with a script which extracts the unique 
domains from the addresses file.  The redundancy here is due to the 
smtpd.conf requirements (i.e. not because I think it's cool to have both 
domain and email address files).


If it's not clear, I can elaborate on how it works.




Re: Virtual user and domain setup

2020-04-05 Thread Leo Unglaub

Hey,
thank you for your response. I have a question to your workaround. In 
the userinfo table, did you specify every email address in there that is 
a virtual address? Or did you define the user that does the LMTP deliver 
to dovecot?


Also, would you mind pasting an example from your recipients and 
virtuals table? So i could check against my stuff? Maybe i messed the 
format up somewhere.


Thanks so much and greetings
Leo

Am 05.04.2020 um 15:57 schrieb Kai Stammer:

Hi all,

i have the same problem. My current workaround is to use a userbase-table:

action "inbound"  lmtp 127.0.0.1:24 virtual  userbase 



Instead of:


action "inbound"  lmtp 127.0.0.1:24 virtual  user "vmail"


== userinfo table
virtualuser1 1010:1010:/home/vmail
virtualuser2 1010:1010:/home/vmail
virtualuser3 1010:1010:/home/vmail
==



Configuration file (FreeBSD 12.1 - OpenSMTPD 6.6.4p1):

# === General === #
queue ttl 1h
smtp max-message-size 120M

# === TLS Certificates === #
pki mydomain.de cert "fullchain.pem"
pki mydomain.de key  "privkey.pem"

# === Tables === #
table recipients    file:/usr/local/etc/mail/tables/recipients
table outgoing  file:/usr/local/etc/mail/tables/outgoing
table credentials   file:/usr/local/etc/mail/tables/credentials
table virtuals  file:/usr/local/etc/mail/tables/virtuals
table userinfo  file:/usr/local/etc/mail/tables/userinfo

# === Filter === #
filter no_dyndns phase connect match rdns regex { '.*\.dyn\..*', 
'.*\.dsl\..*' } disconnect "550 no residential connections"
filter no_rdns   phase connect match !rdns   disconnect "550 no valid 
rdns entry"
filter no_fcrdns phase connect match !fcrdns disconnect "550 no valid 
fcrdns entry"


# === Listen === #
listen on em1   inet4 port smtp 
tls   pki mydomain.de filter 
{ no_dyndns, no_rdns, no_fcrdns }
listen on em1   inet4 port submission tls-require auth  
senders  pki mydomain.de


# === Actions === #
action "inbound"  lmtp 127.0.0.1:24 virtual  userbase 
action "outbound" relay

# === Handle Messages === #
match from any  for any rcpt-to  action "inbound"
match from any auth for any action "outbound"

Am 05.04.2020 um 15:54 schrieb Leo Unglaub:

Hey,
thank you for your help. I am going to describe my goal a little bit 
different, maybe it gets clearer when i do.


I am trying to have a list of email accounts that OpenSMTPD recieves 
emails for and sends to Dovecot via lmtp without having the email 
accounts as real system accounts on that server. Currently there is a 
Postfix running for that usecase and in there i have virtual maps for 
those cases:


 - virtual_mailbox_maps
 - virtual_mailbox_domains

But i want to switch that server from Postfix to OpenSMTPD because i 
like OpenSMTPD much more and it comes with OpenBSD in base.


So i am looking for a way to recieve emails for accounts that dont 
have a system account on that server and just send them to Dovecot.


An alias map is not helping me here because i cannot say


us...@foo.com: us...@foo.com


As far as i understand it, that would create a loop.

Thanks and greetings
Leo

Am 05.04.2020 um 14:35 schrieb Tassilo Philipp:
I might be misunderstanding what you are trying to achieve, but it 
sounds to me that you need mail aliases.


Check the "alias" option of "action", and also the section "Aliasing 
tables" in table(5).


hth








Re: Virtual user and domain setup

2020-04-05 Thread Leo Unglaub

Hey,
of course i can share my entire config. Its from a fresh start and i 
keept it as simple as possible.



##
## Queue
##
queue compression
queue encryption <32 char passphrase>


##
## Tables
##
table aliases file:/etc/mail/aliases
table passwd file:/etc/mail/yace-passwd


##
## PKI
##
pki "mail.foo.com" cert "/etc/ssl/mail.foo.com.crt"
pki "mail.foo.com" key "/etc/ssl/private/mail.foo.com.key"

pki "mail.bar.com" cert "/etc/ssl/mail.bar.com.crt"
pki "mail.bar.com" key "/etc/ssl/private/mail.bar.com.key"


smtp max-message-size 80M


##
## Listen
##
listen on lo0
listen on egress tls pki "mail.foo.com" auth hostname "mail.foo.com"


##
## Actions
##
action "outbound" relay
action "local_lmtp_deliver" lmtp "/var/dovecot/lmtp" user "dovecot-worker"



##
## Matches
##
match from any for any action local_lmtp_deliver
match for any action outbound


I have read Gilles article multiple times and also all other articles i 
found on the topic. But it seams to me that i understand the 
http://man.openbsd.org/smtpd.conf#user option wrong or it does not work 
as i understand it.


All articles i found asume that you have a system account at the end of 
the process that handles the email somehow. But since i am sending it to 
Dovecot via lmtp i dont need a real system account for every email 
account because Dovecot just has its own /etc/dovecot/virtual-passwd file.


Thanks so much for your help!
Leo

Am 05.04.2020 um 14:46 schrieb Matt Schwartz:

Hi Leo,

Would you mind sharing your full configuration file? Without this, I am
stuck on how to help you. I have done a lot with virtual users and domains
so I think I can help. You could also see Gilles Chehade's article,
https://poolp.org/posts/2019-09-14/setting-up-a-mail-server-with-opensmtpd-dovecot-and-rspamd/.
It's very well written.

Best,
Matt




Re: Virtual user and domain setup

2020-04-05 Thread Leo Unglaub

Hey,
thank you for your help. I am going to describe my goal a little bit 
different, maybe it gets clearer when i do.


I am trying to have a list of email accounts that OpenSMTPD recieves 
emails for and sends to Dovecot via lmtp without having the email 
accounts as real system accounts on that server. Currently there is a 
Postfix running for that usecase and in there i have virtual maps for 
those cases:


 - virtual_mailbox_maps
 - virtual_mailbox_domains

But i want to switch that server from Postfix to OpenSMTPD because i 
like OpenSMTPD much more and it comes with OpenBSD in base.


So i am looking for a way to recieve emails for accounts that dont have 
a system account on that server and just send them to Dovecot.


An alias map is not helping me here because i cannot say


us...@foo.com: us...@foo.com


As far as i understand it, that would create a loop.

Thanks and greetings
Leo

Am 05.04.2020 um 14:35 schrieb Tassilo Philipp:
I might be misunderstanding what you are trying to achieve, but it 
sounds to me that you need mail aliases.


Check the "alias" option of "action", and also the section "Aliasing 
tables" in table(5).


hth