Re: new table backends

2020-05-27 Thread gilles
May 27, 2020 2:27 AM, "Edgar Pettijohn"  wrote:

>
> [...]
> 
> Sweet. Looking at 
> https://github.com/poolpOrg/go-opensmtpd/blob/master/table/table.go
> seems like it will be pretty simple to write some nice tables.
> 

yes, I have also written a py-opensmtpd interface to table API ...

... and wrote a working table-consul in < 20 minutes which is < 50 lines of 
python



Re: new table backends

2020-05-26 Thread Edgar Pettijohn
On Tue, May 26, 2020 at 10:58:12PM +, gil...@poolp.org wrote:
> Hellow,
> 
> I have been working on a new table backend: table-procexec.
> 
> What it does is translate the imsg table API to a line-based protocol that is
> very similar to what we did for filters. A table backend can become a program
> consuming table requests from stdin and responding to stdout:
> 
> stdin : table
> 
> 
> The idea behind this is to unlock table backend development to people who are
> not necessarily C developers and who could still write useful implementations
> in other languages. Like with filters, this makes it possible to use anything
> from awk to shell, Go, Python and what not without OpenSMTPD caring about how
> these backends are implemented.
> 
> I have written a Golang package to abstract the protocol details and that let
> you write a backend by implementing the four basic operations of table API. A
> sample table-example.go is available here to see how a backend looks like:
> 
> https://gist.github.com/poolpOrg/b3b97a65791a11a49f5e76ea51331ae4
> 
> 
> If people are willing to help implement some backends, hit me up
> 
> Cheers,
> Gilles

Sweet. Looking at 
https://github.com/poolpOrg/go-opensmtpd/blob/master/table/table.go 
seems like it will be pretty simple to write some nice tables.

Thanks!



new table backends

2020-05-26 Thread gilles
Hellow,

I have been working on a new table backend: table-procexec.

What it does is translate the imsg table API to a line-based protocol that is
very similar to what we did for filters. A table backend can become a program
consuming table requests from stdin and responding to stdout:

stdin : 
table|0.1|1590532670.0123456|check|1234567890ABCDEF|mailaddr|gil...@poolp.org
stdout: table|1234567890ABCDEF|found


The idea behind this is to unlock table backend development to people who are
not necessarily C developers and who could still write useful implementations
in other languages. Like with filters, this makes it possible to use anything
from awk to shell, Go, Python and what not without OpenSMTPD caring about how
these backends are implemented.

I have written a Golang package to abstract the protocol details and that let
you write a backend by implementing the four basic operations of table API. A
sample table-example.go is available here to see how a backend looks like:

https://gist.github.com/poolpOrg/b3b97a65791a11a49f5e76ea51331ae4


If people are willing to help implement some backends, hit me up

Cheers,
Gilles