opensmtpd forwarding sent mail and extras-pgsql

2019-06-03 Thread Benny
Hi,

I am planning a mail server of opensmtpd and dovecot. I'd be glad to know if 
there is any way to save a copy of mail to dovecot's "Sent" mail box before 
relaying them out.

I am also not about find any docs on opensmtpd-extra-pgsql. Is there any guide 
to link postgresql up with smtpd for virtual users?

Thanks
qwerjkl



Re: opensmtpd forwarding sent mail and extras-pgsql

2019-06-05 Thread Gilles Chehade
On Mon, Jun 03, 2019 at 05:44:41PM +, Benny wrote:
> Hi,
> 

Hi,


> I am planning a mail server of opensmtpd and dovecot. I'd be glad to know if 
> there is any way to save a copy of mail to dovecot's "Sent" mail box before 
> relaying them out.
> 

sorry, I don't know dovecot enough for tricks and hacks.

it's possible that it's doable through some weird trick when smtpd would
notify dovecot somehow of messages that were sent, but I doubt it and it
is generally the mail user agent that does the link between mails it did
send over SMTP and copies it stores through IMAP.


> I am also not about find any docs on opensmtpd-extra-pgsql. Is there any 
> guide to link postgresql up with smtpd for virtual users?
> 

There's a man page but no guide no.

There are several tutorials for using SQLite and MySQL if you google and
they are pretty much identical in terms of configuration.

-- 
Gilles Chehade @poolpOrg

https://www.poolp.org tip me: https://paypal.me/poolpOrg



Re: opensmtpd forwarding sent mail and extras-pgsql

2019-06-05 Thread Graeme Lee

On 6/06/2019 6:50 am, Gilles Chehade wrote:

On Mon, Jun 03, 2019 at 05:44:41PM +, Benny wrote:

Hi,


Hi,



I am planning a mail server of opensmtpd and dovecot. I'd be glad to know if there is any 
way to save a copy of mail to dovecot's "Sent" mail box before relaying them 
out.


sorry, I don't know dovecot enough for tricks and hacks.

it's possible that it's doable through some weird trick when smtpd would
notify dovecot somehow of messages that were sent, but I doubt it and it
is generally the mail user agent that does the link between mails it did
send over SMTP and copies it stores through IMAP.



I am also not about find any docs on opensmtpd-extra-pgsql. Is there any guide 
to link postgresql up with smtpd for virtual users?


There's a man page but no guide no.

There are several tutorials for using SQLite and MySQL if you google and
they are pretty much identical in terms of configuration.


Hi Benny.

I use Cyrus and Postgresql with smtpd.  Everything you need for virtual 
users is in table-sqlite(5), but you will
want to use IDENTITY or SERIAL for the ID column. (There is a man page 
for table-postgres(5) in the source,

but it isn't installed)

I can't speak for Dovecot.  But I use LMTP to deliver locally to the 
cyrus mailer.  Two actions are needed (below)
to route to the local mail store.   is /etc/mail/aliases, 
 is the database table.


# incoming email
action "cyrus" lmtp "127.0.0.1:2003" rcpt-to virtual 
# locally generated email (system /etc/mail/aliases - alias root to a 
some...@your.local.domain.com)

action "cyrus_internal" lmtp "127.0.0.1:2003" rcpt-to alias 

match from local for local action "cyrus_internal"
match from any for domain  action "cyrus"






Re: opensmtpd forwarding sent mail and extras-pgsql

2019-06-06 Thread Benny
First of all, I really appreciate your work on Opensmtpd. In the past few days 
of planning and configurating(still working on it). I realize the beauty in 
smtpd's simplicity.

My quests were quite stupid as I didn't know imap mail clients send the message 
to the smtp server and the imap as "Sent" for every outgoing email.

The man page from the port source was enough for my setup.

By the way, does Opensmtpd support milter for rspam now? I have seen blogs 
about it being upstreamed, but found nothing from smtpd.conf(5).

Once again, thank you for this amazing piece of software.

qwejrkl

‐‐‐ Original Message ‐‐‐
On Wednesday, June 5, 2019 1:50 PM, Gilles Chehade  wrote:

> On Mon, Jun 03, 2019 at 05:44:41PM +, Benny wrote:
>
> > Hi,
>
> Hi,
>
> > I am planning a mail server of opensmtpd and dovecot. I'd be glad to know 
> > if there is any way to save a copy of mail to dovecot's "Sent" mail box 
> > before relaying them out.
>
> sorry, I don't know dovecot enough for tricks and hacks.
>
> it's possible that it's doable through some weird trick when smtpd would
> notify dovecot somehow of messages that were sent, but I doubt it and it
> is generally the mail user agent that does the link between mails it did
> send over SMTP and copies it stores through IMAP.
>
> > I am also not about find any docs on opensmtpd-extra-pgsql. Is there any 
> > guide to link postgresql up with smtpd for virtual users?
>
> There's a man page but no guide no.
>
> There are several tutorials for using SQLite and MySQL if you google and
> they are pretty much identical in terms of configuration.
>
> --
>
> Gilles Chehade @poolpOrg
>
> https://www.poolp.org tip me: https://paypal.me/poolpOrg




Re: opensmtpd forwarding sent mail and extras-pgsql

2019-06-06 Thread Benny
Thank you for your reply. I found the man page from source, that really helps.

Please forget the "Sent Mail" part, I didn't know enough. (Email clients send a 
copy to imap server for every outgoing mail)

On getting dovecot to work with smtpd, I found a blog detailing dovecot-lda MTA 
wrapped with rspamc.

qwerjkl

‐‐‐ Original Message ‐‐‐
On Wednesday, June 5, 2019 7:49 PM, Graeme Lee  wrote:

> On 6/06/2019 6:50 am, Gilles Chehade wrote:
>
> > On Mon, Jun 03, 2019 at 05:44:41PM +, Benny wrote:
> >
> > > Hi,
> >
> > Hi,
> >
> > > I am planning a mail server of opensmtpd and dovecot. I'd be 
glad to know if there is any way to save a copy of mail to dovecot's "Sent" 
mail box before relaying them out.
> >
> > sorry, I don't know dovecot enough for tricks and hacks.
> > it's possible that it's doable through some weird trick when smtpd 
would
> > notify dovecot somehow of messages that were sent, but I doubt it and 
it
> > is generally the mail user agent that does the link between mails it 
did
> > send over SMTP and copies it stores through IMAP.
> >
> > > I am also not about find any docs on opensmtpd-extra-pgsql. Is 
there any guide to link postgresql up with smtpd for virtual users?
> >
> > There's a man page but no guide no.
> > There are several tutorials for using SQLite and MySQL if you google 
and
> > they are pretty much identical in terms of configuration.
>
> Hi Benny.
>
> I use Cyrus and Postgresql with smtpd.  Everything you need for 
virtual
> users is in table-sqlite(5), but you will
> want to use IDENTITY or SERIAL for the ID column. (There is a man page
> for table-postgres(5) in the source,
> but it isn't installed)
>
> I can't speak for Dovecot.  But I use LMTP to deliver locally to the
> cyrus mailer.  Two actions are needed (below)
> to route to the local mail store.   is /etc/mail/aliases,
>  is the database table.
>
> incoming email
>
> ===
>
> action "cyrus" lmtp "127.0.0.1:2003" rcpt-to virtual 
>
> locally generated email (system /etc/mail/aliases - alias root to a
>
> 
>
> some...@your.local.domain.com)
> action "cyrus_internal" lmtp "127.0.0.1:2003" rcpt-to alias 
>
> match from local for local action "cyrus_internal"
> match from any for domain  action "cyrus"





Re: opensmtpd forwarding sent mail and extras-pgsql

2019-06-06 Thread Gilles Chehade
Howdie,

On Thu, Jun 06, 2019 at 08:17:52PM +, Benny wrote:
> First of all, I really appreciate your work on Opensmtpd. In the past few 
> days of planning and configurating(still working on it). I realize the beauty 
> in smtpd's simplicity.
> 

Thanks


> My quests were quite stupid as I didn't know imap mail clients send the 
> message to the smtp server and the imap as "Sent" for every outgoing email.
> 
> The man page from the port source was enough for my setup.
> 

I've seen more stupid quests so don't beat yourself up ;-)


> By the way, does Opensmtpd support milter for rspam now? I have seen blogs 
> about it being upstreamed, but found nothing from smtpd.conf(5).
> 

Since you're asking, I'll take the opportunity to provide details ;-)

OpenSMTPD supports a filtering interface that is different (and simpler)
than milters, so you won't be able to use the existing milter for rspamd
BUT writing a native filter is trivial (as in shell scripting trivial).

I wrote a native rspamd filter, with greylisting and dkim-signing logic,
all it took was an hour and a couple hundred lines of code. It won't get
released because it's just a proof-of-concept, lacking robustness, and I
don't feel like maintaining it, but there will surely be implementations
available soon after the release.

The code is already in current for the most part but there are still few
minor bugs to fix, things to change in the API, and you should stay away
of it if you can't write code at the moment.

Some people already wrote a few useful filters and are using them daily,
so this is more than usable at this point, my plan is for the filter API
to be made rock-solid for 6.6.


> Once again, thank you for this amazing piece of software.
> 

Thanks :-)


-- 
Gilles Chehade @poolpOrg

https://www.poolp.org tip me: https://paypal.me/poolpOrg



Re: opensmtpd forwarding sent mail and extras-pgsql

2019-06-11 Thread Roderick



On Thu, 6 Jun 2019, Graeme Lee wrote:

I use Cyrus and Postgresql with smtpd.? Everything you need for virtual users 
is in table-sqlite(5), but you will


OpenBSD has its own ldap server (ldapd) and client (ldap). I wonder for
what, if it is integrated with something else in the system.

I am now struggling with sendmail, cyrus imap, sasl, openldap, and
unfortunately Debian. It is a pain for non experts like me. Cyrus
may run out of the box, but it is neither verbose in loging nor
has good documentation, so that any small problem commimg from small
changes become difficult to solve. The language of sasl documentation is
incoherent, to understand is work for philologists.  And
for ldap/openldap there is no concise explanation, to deal with
it is a big waste of time. The most simple thing to deal
with among them, in spite of its fame, seems to be sendmail: verbose logs,
a lot of documantation, and since it is so old, one finds
answers googling.

I can't speak for Dovecot.? But I use LMTP to deliver locally to the cyrus 
mailer.?


I wanted to deliver with LMTP only mail adressed to a subdomain,
and mail adressed to the normal domain with the local maler, to
read them with unix mail and not imap. With sendmail was
necessary to write cf code:

Mcyrusv2,   P=[IPC], F=lsDFMnqXzA@/:|m,
S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, E=\r\n,
T=DNS/RFC822/SMTP,
A=FILE /var/run/cyrus/socket/lmtp

As explained here:

https://www.cyrusimap.org/dev/imap/concepts/features/virtual-domains.html

Is it with OpenSMTP simpler? I hope I am soon able to try it.

Rodrigo