Re: How to whitelist a good IP coming in with a senderscore of 0?

2020-12-13 Thread gilles
December 13, 2020 6:26 PM, "Chris Bennett"  
wrote:

> I have run into a problem with an organization getting a senderscore of
> 0.
> This is not at all a spam source, but a political organization which is
> the kiss of death these days.
> 
> What's the right method to deal with this? I certainly don't want to
> stop senderscore filtering, but I do want to receive emails from them.
> 

You should probably look into the bypass keyword, it lets you create a
filter rule that will bypass a phase (ie: in phase connect, if ip addr
is X, then bypass the phase).

Gilles



Re: OpenSMTPD and ldap+tls

2020-12-01 Thread gilles
December 1, 2020 1:30 PM, "Aisha Tammy"  wrote:

> On 12/1/20 1:31 AM, Martijn van Duren wrote:
> 
>> Hello,
>> 
>> There is table_ldap in the opensmtpd-extras package, but I've never used
>> it, it's undocumented and I've heard that the author sees it as a proof
>> of concept only at this point. So no idea how far this will take you,
>> but it's your best shot. :-)
>> 

This is based on the aldap.[ch] OpenBSD client, unfortunately the author is
missing in action and the code lacks support for several features that have
been requested over and over.

The backend as is works for common use-cases ... on a local LDAP server, no
TLS and no leaf referencing a remote LDAP server. To add support for these,
I'd have to actually add support in the aldap client which is not something
I want to do as it's unpleasant and I don't even use LDAP to start with :-)


> Is the table-procexec a viable alternative?
> You can create shell wrappers to call ldap functions
> and then call the shell wrappers from procexec with
> the correct parameters.
> This seems very possible, assuming table-procexec is usable.
> Last time I checked, procexec didn't have a lot of documentation.
> 

The table-procexec is just a proof-of-concept to show that table API would
be better if it went the procexec way. It does work but it's not polished,
can't pass a configuration down to a procexec table backend and requires a
table-procexec instance for each procexec backend which is not elegant.

Switching table API to procexec in OpenSMTPD would require help upstream.



Re: How did it happen?

2020-02-01 Thread gilles
February 1, 2020 2:01 PM, "Uwe Werler"  wrote:

> Thank you very much Gilles for the insights.
> 
> It's not really your fault because it's how our brain works. If we want to 
> get things working we
> are concentrating to get them working - not how to break them. It's amazing 
> that the code worked
> like "intended" - that means you are a very good dev. Logical fallacies hit 
> us every day - we are
> human.
> 

it is my fault but that's the way it is, error is human.

if more people wanted to contribute we could limit risks for logic mistakes,
but as of now there's very few people interested in diving into smtpd.
> I would give +1 to not to deliver mails directly to root.
> 

working on it


Re: .forward MDA fails, "mail.local: may only be run by the superuser"

2020-02-01 Thread gilles
February 1, 2020 9:11 AM, "Andreas Kusalananda Kähäri"  
wrote:

> Hi,
> 
> With the latest snapshot on amd64 (6.6 GENERIC.MP#627), using a "|"-line
> in one's ~/.forward makes delivery of mail fail with
> 
> Feb 1 08:53:53 pooh smtpd[72575]: d9abac6b3d904e13 smtp connected 
> address=local
> host=pooh.prefix.duckdns.org
> Feb 1 08:53:54 pooh smtpd[72575]: d9abac6b3d904e13 smtp message 
> msgid=8698cb82 size=1824 nrcpt=1
> proto=ESMTP
> Feb 1 08:53:54 pooh smtpd[72575]: d9abac6b3d904e13 smtp envelope 
> evpid=8698cb8264606654 from=<>
> to=
> Feb 1 08:53:54 pooh smtpd[72575]: d9abac6b3d904e13 smtp disconnected 
> reason=quit
> Feb 1 08:53:54 pooh mail.local: may only be run by the superuser
> Feb 1 08:53:54 pooh smtpd[72575]: d9abac6d77a45212 mda delivery 
> evpid=8698cb8264606654 from=<>
> to= rcpt= user=kk 
> delay=0s result=PermFail
> stat=Error ("mail.local: may only be run by the superuser")
> Feb 1 08:53:54 pooh smtpd[19621]: warn: queue: no return path!
> 
> The mail is then lost.
> 

It is rejected at session time because there's no other way to handle
this case:

your user "kk" tries to execute "mail.local" from ~/.forward file but
mail.local requires privileges and smtpd doesn't allow running things
with privileges from ~/.forward.

it can't be handled as a temporary failure either.


> I have
> 
> pooh % cat .forward
> |/usr/local/bin/fdm -a stdin fetch
> 
> where "stdin" is a simple mail "account" in fdm(1) that takes messages
> from standard input, filters it, and sorts it into the correct Maildir
> inbox. For me, this only affects messages originating from the local
> system (e.g. crontab output etc., but also messages for root as my root
> user is aliased to my ordinary user through /etc/mail/aliases).
> 

I'm not sure that's what's happening, maildir can't possibly use mail.local,
and the error message is explicit, mail.local is being executed somehow.


> I understand that this may well be by design rather than a bug. How
> may one use a personal MDA from ~/.forward nowadays, or is that option
> completely unsupported from now on?
> 

That shouldn't be the case as I  use ~/.forward with fdm in it

It would help if you shared your config



Re: How did it happen?

2020-01-31 Thread gilles
January 30, 2020 4:44 PM, gil...@poolp.org wrote:

> It depends on your configuration, not all setups are vulnerable.
> 
> I think I recall your name from the comments on my tutorial and this is a
> setup that would not be vulnerable for example. The bug still exists, but
> it can't be used to exploit the same code path.
> 
> You should update, this is not something you want to rely on.
> 
> I'm writing a _very_ detailed post-mortem which will go into the details,
> I just want to give it a few days to make sure it is as informative as it
> should.
> 


As promised, I have written a (too much ?) detailed write-up about the recent 
event:

https://poolp.org/posts/2020-01-30/opensmtpd-advisory-dissected/

Hope it clarifies what happened and plans for the future.

Gilles



Re: How did it happen?

2020-01-30 Thread gilles
It depends on your configuration, not all setups are vulnerable.

I think I recall your name from the comments on my tutorial and this is a
setup that would not be vulnerable for example. The bug still exists, but
it can't be used to exploit the same code path.

You should update, this is not something you want to rely on.

I'm writing a _very_ detailed post-mortem which will go into the details,
I just want to give it a few days to make sure it is as informative as it
should.


January 30, 2020 4:09 PM, "Flipchan"  wrote:

> Has anyone verified that it writes to disk as the qualysis report says ? 
> 
> I have tried on 6.5 and 6.4 but its not writing to disk
> 
> https://www.qualys.com/2020/01/28/cve-2020-7247/lpe-rce-opensmtpd.txt
> 
> On January 29, 2020 2:07:38 PM GMT+01:00, Oriol Demaria 
>  wrote:
> 
>> I understand that root might be required to open privileged ports, but
>> then how commands are run as root when you exploit opensmtpd
>> vulnerability?
>> 
>> In case someone hasn't seen patch right now your system.
>> 
>> Regards.
>> --
>> Oriol Demaria
>> 0x58415679
> 
> --
> Sent from my Android device with K-9 Mail. Please excuse my brevity.



Re: How did it happen?

2020-01-29 Thread gilles
January 29, 2020 7:00 PM, "Stuart Henderson"  wrote:

> 
> I hesitate to mention it in case it puts anyone off from updating (DON'T
> DO THAT, YOU SHOULD UPDATE!) but it is easy to configure to avoid the
> root-escalation aspect of this bug - and many readers will already be
> doing this, especially if they maintain multiple systems: forward root's
> mail (via /root/.forward or aliases) off the machine. I haven't tested
> but presume the same bug also allows running as another (non-root) user
> so it's not a complete workaround, but is something that can be done
> quickly while planning a more complicated upgrade.
>

that's not sufficient because for mbox delivery, the privilege drop is done
by the mail.local utility.

there are mitigations, like switching to maildir or blocking mail-from with
a builtin filter, but I would not advise doing that.

As you said: DON'T DO THAT, update is the only safe path



Re: How did it happen?

2020-01-29 Thread gilles
smtpd needs to be able to execute mda with user privileges to deliver mail to 
them,
it cannot revoke all its privileges after binding ports. furthermore, mbox 
needs to
be able to write to /var/mail forcing it to retain some privileges.

after I'm done dealing with the aftermath, i'll explain in a detailed mail what 
has
allowed the bug to amplify from a simple logic issue to a catastrophe, and the 
plan
to prevent future logic bug from having the same potential.


January 29, 2020 2:07 PM, "Oriol Demaria"  wrote:

> I understand that root might be required to open privileged ports, but then 
> how commands are run as
> root when you exploit opensmtpd vulnerability?
> 
> In case someone hasn't seen patch right now your system.
> 
> Regards.
> -- 
> Oriol Demaria
> 0x58415679



Re: cron output direct to mbox without smtpd?

2019-11-24 Thread gilles
November 24, 2019 4:34 PM, "Andrew Kanaber"  
wrote:

> Hi,
> 
> I'm setting up an embedded machine that won't be able to send mail to
> the internet and it seems excessive to leave smtpd running just so root
> can receive cron job output, but I can't see a way to cut smtpd out of
> the delivery chain because mail.local doesn't implement sendmail-style
> command-line options (in particular it doesn't have the -t option to
> extract the recipient from the message headers) so I can't use it in
> place of smtpctl in /etc/mailer.conf.
> 
> I could probably get cron to mail.local delivery working by editing and
> recompiling cron to change the popen arguments but that seems like more
> trouble than it's worth in the long run.
> 

or simpler, you can write a wrapper to mail.local and use that wrapper in
the mailwrapper config, but bear in mind that mail.local requires root as
it writes to /var/mail, so your wrapper must either be restricted to root
crontab or be setuid with all that implies.


> Is there some other way to do this? Is there a reason I've missed that
> this is actually just a bad idea?
> 

I'd use a wrapper... but I'd also leave smtpd because it's idle when not
in work so the cost of running it vs hacking a work-around is not too in
favor of the work-around as far as I'm concerned.



Re: Patch suggestion for sysupgrade

2019-11-14 Thread gilles
A similar patch for this was sent to tech@ by Renaud Allard, you might want to
go review the "sysupgrade: Allow to use another directory for data sets" thread
and comment it.


November 14, 2019 3:01 PM, "Raimo Niskanen"  
wrote:

> The use case for this patch is that in our lab network we have NFS
> automounted /home/* directories, so using /home/_sysupgrade
> for sysupgrade does not work.
> 
> With this patch it is easy to modify /usr/sbin/sysupgrade and change
> just the line SETSDIR=/home/_sysupgrade to point to some other local file
> system that is outside hier(7) for example /opt/_sysupgrade
> or /srv/_sysupgrade.
> 
> Even using /var/_sysupgrade or /usr/_sysupgrade should work. As far as
> I can tell the sysupgrade directory only has to be on a local file system,
> and not get overwritten by the base system install.
> 
> The change for mkdir -p ${SETSDIR} is to make the script more defensive about
> the result of mkdir, e.g in case the umask is wrong, or if the directory
> containing the sysupgrade directory has got the wrong group, etc.
> 
> A follow-up to this patch, should it be accepted, could be to add an option
> -d SysupgradeDir, but I do not know if that would be considered as a too odd
> and error prone feature to merit an option. Or?
> 
> The patch is on 6.6 stable.
> 
> Index: usr.sbin/sysupgrade/sysupgrade.sh
> ===
> RCS file: /cvs/src/usr.sbin/sysupgrade/sysupgrade.sh,v
> retrieving revision 1.25
> diff -u -u -r1.25 sysupgrade.sh
> --- usr.sbin/sysupgrade/sysupgrade.sh 28 Sep 2019 17:30:07 - 1.25
> +++ usr.sbin/sysupgrade/sysupgrade.sh 14 Nov 2019 13:27:34 -
> @@ -119,6 +119,7 @@
> URL=${MIRROR}/${NEXT_VERSION}/${ARCH}/
> fi
> 
> +[[ -e ${SETSDIR} ]] || mkdir -p ${SETSDIR}
> if [[ -e ${SETSDIR} ]]; then
> eval $(stat -s ${SETSDIR})
> [[ $st_uid -eq 0 ]] ||
> @@ -127,8 +128,6 @@
> ug_err "${SETSDIR} needs to be owned by root:wheel"
> [[ $st_mode -eq 040755 ]] || 
> ug_err "${SETSDIR} is not a directory with permissions 0755"
> -else
> - mkdir -p ${SETSDIR}
> fi
> 
> cd ${SETSDIR}
> @@ -185,7 +184,7 @@
> 
> cat <<__EOT >/auto_upgrade.conf
> Location of sets = disk
> -Pathname to the sets = /home/_sysupgrade/
> +Pathname to the sets = ${SETSDIR}/
> Set name(s) = done
> Directory does not contain SHA256.sig. Continue without verification = yes
> __EOT
> @@ -193,7 +192,7 @@
> if ! ${KEEP}; then
> CLEAN=$(echo SHA256 ${SETS} | sed -e 's/ /,/g')
> cat <<__EOT > /etc/rc.firsttime
> -rm -f /home/_sysupgrade/{${CLEAN}}
> +rm -f ${SETSDIR}/{${CLEAN}}
> __EOT
> fi
> 
> Best regards
> -- 
> / Raimo Niskanen, Erlang/OTP, Ericsson AB



Re: question about man starttls and linking to cert.pem

2019-08-11 Thread Gilles Chehade
On Sun, Aug 11, 2019 at 07:17:06AM -0600, Todd C. Miller wrote:
> On Sat, 10 Aug 2019 22:22:05 -0400, "Ted Unangst" wrote:
> 
> > That entire section seems dumb and outdated. I would prefer we
> > simply not give any advice here. Users can figure out what they
> > need to do. Installing the public cert needs to be done on many
> > other machines, not just the one where its generated.
> 
> Fine with me.  I wonder if we shouldn't also mention acme-client
> here too.  Something for another diff...
> 

I was wondering the same actually.

It's interesting to have instruction for generating self-signed cert but
most people will want a cert that others will validate so it makes sense
to at least extend the man page (in another diff) in my opinion.

-- 
Gilles Chehade @poolpOrg

https://www.poolp.orgpatreon: https://www.patreon.com/gilles



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-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: Puffy Security smtpd out of date ( closed )

2019-03-11 Thread Gilles Chehade
On Mon, Mar 11, 2019 at 11:34:58AM +, Geir Svalland wrote:
> 
> On 2019-03-11 09:58, Janne Johansson wrote:
> > Den fre 8 mars 2019 kl 20:59 skrev Sean Kamath :
> >>> It's a shame good work like this is
> >>> of no use anymore. According to my opinion, it's well written and easy to 
> >>> follow.
> >>>
> >> So, I???ll take issue with the ???well written??? part of that.  It 
> >> doesn???t do much in the way of explaining anything, just a lot of ???put 
> >> this here???, ???put that there???.
> > The intro to The Book of PF has a REALLY good mantra here on the "This
> > is not a HOWTO"
> > https://home.nuug.no/~peter/pf/en/preface.html
> >
> > I feel it applies equally well to running your own mail server as
> > building your own firewall.
> 
> Well, that was your 2cents to the discussion.
> We all have a right to a opinion and we all are on different levels of 
> knowledge and might have different
> milestones when learning. Some times I like to dig deeper, and some 
> times I just want something up'n
> running as fast as possible in a somewhat safe and secure way. Then 
> taking care of the "why and what's."
> 
> I've been running both Sendmail and Postfix for years without any major 
> difficulties, but this is my first
> try on OpenSMTP.
> 
> After a couple of days of googling, I found this article :
> https://poolp.org/posts/2018-05-21/switching-to-opensmtpd-new-config/
> 
> and got very surprised that none of the "know better's" didn't know 
> about this, or didn't care to
> enlighten me and pointing me in this direction. This was exactly what I 
> was looking for.
> 

glad it helps, though keep in mind that I'm writing about code that is on
my laptop or that's very very very fresh and likely to change.

we're nearly a year apart from that post and I can't even remember all of
the changes, fixes and improvements.

-- 
Gilles Chehade @poolpOrg

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



Re: OpenBSD 6.4 smtpd local mail delivery missing "From " when .forward (procmail)

2019-01-27 Thread Gilles Chehade
On Sun, Jan 27, 2019 at 12:42:23PM -0700, Steve Williams wrote:
> 
> Hi Gilles,
> 
> Thanks very much for the reply.?? I had looked in for some kind of flag that
> could be set in the procmail config file... I never thought it would be a
> command line argument to procmail :(?? I cannot believe I missed that.
> 
> I had even downloaded the smtpd source and saw that mail.local could only
> write to a file (not a stream)... and that's the only place in the source
> code where a "From " was written so I knew it wasn't going to be a smtpd
> configuration change.
> 
> Do you think a hint about the behaviour change might be worth a mention in
> the smptd.conf (5) man page??? I've been trying to come up with some
> non-procmail specific wording...I am not happy with the following wording,
> but something along these lines to give a clue that piping to a program
> won't have the same effect as writing to a physical file.
> 
>  mbox?? Deliver the message to the user's mbox 
> with
>  mail.local(8).?? mbox format is
> only honoured if final delivery is a file and not a program.
> ^^^
>

this isn't accurate, smtpd(8) doesn't write to a file.

smtpd doesn't know about an "mbox format", what it does is that it calls
mail.local(8) which is an mda that should really be called mail.mbox and
which itself writes to a file in mbox format.

I don't think its necessary to document this behaviour in smtpd.conf(5),
procmail is the only case I know where you may forget to pass the option
and be bit, which leads to threads like this where i'm given a chance to
discourage you from using procmail.
k

> Thanks for the heads up about fdm.?? I'll have a look at it.
> 
> Also, thanks for such an amazingly simple email program to configure.?? I
> have spent so many hours over the years researching (scratching my head) how
> to configure sendmail!?? A 4 line config file to have a functioning email
> configuration is pretty staggering!
> 

Cheers :-)


-- 
Gilles Chehade @poolpOrg

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



Re: OpenBSD 6.4 smtpd local mail delivery missing "From " when .forward (procmail)

2019-01-27 Thread Gilles Chehade
On Sat, Jan 26, 2019 at 08:53:06PM -0700, Steve Williams wrote:
> Hi,
> 
> I upgraded from OpenBSD 6.3 to OpenBSD 6.4 today.?? I upgraded all packages,
> switched to php7, etc.
> 
> I've been running OpenBSD since 2.7 so this is a very known process.
> 
> The upgrade went quite smoothly and is working fine except for my email.?? I
> have massaged the smtpd.conf file to comply with the OpenBSD 6.4 grammar.
> 
> I run a VERY simple smtpd configuration saving in mbox format.
> 
> I am also using procmail to direct emails into various folders, launched
> with a .forward.?? This has been working since about 2005 :), historically
> with sendmail and more recently, smtpd.
> 
> Unfortunately, email is being written to both my INBOX and the procmail the
> folders **incorrectly** post upgrade.
> 
> They are all missing the "From " line that is supposed to indicate the start
> of a new email message.
> 
> It seems like the email is being passed "raw" to procmail without being
> processed by "mail.local" ... or that's my interpretation.
> 

you need to tweak your procmail's command so it adds the From delimiter,
there's an option for that.

smtpd used to add the From delimiter for mda, which allowed procmail not
to require that option, however this wasn't correct and when we made the
mda improvements between 6.3 and 6.4, it became impossible to accomodate
procmail without introducing special cases and ugly hacks such as having
explicit search for the string 'procmail' in .forward files.

it wasn't worth it when people can just pass procmail an option.

also don't use procmail, it's trash and there are far better options for
you to use today, fdm being the first to come to mind :-)

-- 
Gilles Chehade @poolpOrg

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



Re: OpenSMTPD??? how do I do these things, or do I just use postfix?

2019-01-26 Thread Gilles Chehade
On Sat, Jan 26, 2019 at 09:23:37PM +1000, Stuart Longland wrote:
> Hi Gilles,
> On 25/1/19 11:29 pm, Gilles Chehade wrote:
> > On Fri, Jan 25, 2019 at 11:15:47PM +1000, Stuart Longland wrote:
> >> First and foremost is the issue of backscatter-prevention.  I would like
> >> OpenSMTPD to validate the addresses passed to it before accepting them
> >> for relay to my primary MX.???
> > 
> > How you do it depends on which version you are running.
> > 
> > before 6.4:
> > 
> >   accept [...] recipient  [...]
> > 
> > 
> > after 6.4:
> > 
> >   match [..] rcpt-to  [...]
> > 
> > 
> > where table is a table containing a list of recipient addresses for that
> > rule to match.
> 
> That looks as if it'll do nicely.  I'll do some research into how the
> table is formatted??? but I'm guessing of the two formats supported, the
> array form `table mylist { value1, value2, value3 }` would be the form
> to use here?
> 

yes, if you use a static table:

 table foobar { a@b.c, b@c.d }

if the table is a file, then one address per-line, see table(5).


> >> Second is about how to define custom mail transports.  Rather than using
> >> SMTP/SSL like I am now, I'd like the emails destined for relay to my
> >> server, to be encrypted using a RSA key, (well, AES, then RSA encrypt
> >> the AES key) then either:
> >> - scp'd to a special spool directory on my Linux server??? OR if it
> >> happens to be down,
> >> - placed in a special directory on the VPS for my server to later ciphon
> >> down using `rsync --remove-source-files` over SSH.  (Basically, a bit
> >> like UUCP.)
> >>
> > 
> > no custom mail transports in smtpd.
> > 
> > a way to achieve what you want is to write a custom mda, and this is
> > actually how i did it to achieve a use-case similar to yours in the
> > past.
> 
> No problems, I'll have a closer look at how the MDA stuff works then. :-)
> 
> Really it's an `rmail` work-alike that I'll probably wind up writing,
> we'll see how it goes.
>

mda is basically a program that reads input from stdin and exits with the
proper status to report to the mta that delivery was successful, whatever
happens in between is up to you.

-- 
Gilles Chehade @poolpOrg

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



Re: OpenSMTPD??? how do I do these things, or do I just use postfix?

2019-01-25 Thread Gilles Chehade
On Fri, Jan 25, 2019 at 11:15:47PM +1000, Stuart Longland wrote:
> Hi all,
> 
> I've got a few silly questions regarding OpenSMTPD??? I'd ask on the
> opensmtpd misc mailing list, but my subscribe requests keep bouncing
> after a few days.  Since I'm running OpenSMTPD on OpenBSD, I figure
> they're on-topic here too.
> 

I can probably help with this ;-)


> [...]
>
> First and foremost is the issue of backscatter-prevention.  I would like
> OpenSMTPD to validate the addresses passed to it before accepting them
> for relay to my primary MX.  In Postfix I can put
> 
>   relay_recipient_maps = hash:/etc/postfix/valid_recipients
> 
> into /etc/postfix/main.cf and fill that valid_recipients file with
> 
>   f...@example.com x
>   b...@example.comx
> 
> I can come up with a full list -- no problem, but the question is how do
> I encode this list into the configuration of OpenSMTPD so that if the
> list contained f...@example.com and b...@example.com, but someone tries
> sending to foo...@example.com, that RCPT TO request is rejected before
> the email delivery begins.
> 

How you do it depends on which version you are running.

before 6.4:

  accept [...] recipient  [...]


after 6.4:

  match [..] rcpt-to  [...]


where table is a table containing a list of recipient addresses for that
rule to match.


> Second is about how to define custom mail transports.  Rather than using
> SMTP/SSL like I am now, I'd like the emails destined for relay to my
> server, to be encrypted using a RSA key, (well, AES, then RSA encrypt
> the AES key) then either:
> - scp'd to a special spool directory on my Linux server??? OR if it
> happens to be down,
> - placed in a special directory on the VPS for my server to later ciphon
> down using `rsync --remove-source-files` over SSH.  (Basically, a bit
> like UUCP.)
>

no custom mail transports in smtpd.

a way to achieve what you want is to write a custom mda, and this is
actually how i did it to achieve a use-case similar to yours in the
past.


-- 
Gilles Chehade @poolpOrg

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



Re: smtpd - help needed tranlsating to new virtual map syntax [FIXED]

2019-01-22 Thread Gilles Chehade
On Tue, Jan 22, 2019 at 01:11:44AM +0100, Eric Elena wrote:
> On Mon, 21 Jan 2019 11:08:02 +0100 Gilles Chehade wrote:
> > I may sound a bit harsh, but starting a thread with "this is my last try
> > or I'll switch" (as if it actually matters) right before telling someone
> > who wants to help you that you actually tried _nothing_ then blaming the
> > code improvements for a use-case that could have never worked because it
> > not only uses the wrong _documented_ mechanism but also because the code
> > to make your use-case work has never existed, kinds of irritates me.
> > 
> > I don't get royalties on smtpd install, please install whatever software
> > fits your use case, this is how proper engineering works.
> 
> First of all thank you Gilles (and all the others who contributed to
> this project) for your amazing work on OpenSMTPD!
> 
> That said, there is a kind of sender rewriting mechanism in OpenSMTP.
> Well, it works for me (tm) I'm not saying it's perfect, it might be an
> overkill but at least it does what I want it to do. The conf is
> included below (only the part for rewriting the sender
> address):
>
> [...]
>
> When a mail is received (listen on all):
> - check if it is rejected
> - if not, if the email if for toto@my.domain, forward it to the very
> same OpenSMTP daemon on port 10030 using the authenticated user foo and
> using masq@my.domain as the MAIL-FROM in the SMTP session (enveloppe)
> - when an email is received on port 10030, tag it with the label MASQ.
> The authenticated user is allowed to send an email as the user
> masq@my.domain. The keyword masquerade modifies the From header (the
> message itself) to match the address given in the SMTP session
> - at that point, the sender address is rewritten both in the SMTP
> session and the headers
> - if the email is for toto@my.domain and is tagged with the label MASQ,
> the virtual user address is expanded to the real email address
> - continue like a normal message
> 
> There is probably room for improvement but I hope this helps.
> 

indeed, a bit overkill and now that we have removed the blockers we must
come up with a simpler way to achieve that...

but what you did, that's smart :-)


-- 
Gilles Chehade @poolpOrg

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



Re: smtpd - help needed tranlsating to new virtual map syntax [FIXED]

2019-01-22 Thread Gilles Chehade
On Mon, Jan 21, 2019 at 01:04:16PM -0600, Adam Thompson wrote:
> 
> > Also, this is a recipient translation mechanism, similar to aliases, and
> > not a sender rewriting mechanism which we do not have at this point.
> > [...]
> > virtual _now_ only works on recipients, not senders ?
> > the virtual code hasn't changed, it works the way it always did.
> > 
> > there is no way it could ever do what you're describing or attempting to
> > do given that it doesn't operate at all anywhere near the message. there
> > is no way it has ever parsed:
> 
> This is all very surprising to hear.  The existing system works (somehow).
> So I am apparently misunderstanding what is happening, because with the
> configuration as shown, telling the various broken email senders to use that
> box as their mailhost _somehow_ fixes the bogus From: headers and envelopes.
> 

the entire virtual expansion happens between the client sending RCPT TO,
and the server responding Ok to that RCPT TO. virtual does not know of a
sender, never, and it is done before the message is actually received so
it doesn't know headers, which is why i'm 100% confident there isn't one
chance it could ever do what you describe.


> Oh, this just occurred to me as I'm writing:  I really hope I didn't switch
> to a different MTA on that system years ago, and then just forgot to check
> which MTA was actually running.  If that's the case, I'm not going to bother
> posting an update, because I'll be busy banging my head on the wall and then
> hiding in shame.
> 

that is a more likely possibility.


> > > I'm not convinced the new smtpd.conf grammar improves anything at
> > > all, but I assume it must help someone or it wouldn't have
> > > changed... but I believe my use case got thrown out with the
> > > bathwater, so to speak.  Oh, well.  :-(
> > This is bullshit.
> > The grammar doesn't reduce the functional scope, it can only expand it.
> 
> I'm taking your word for it - you will know far better than I do!
> 
> 
> > What you are describing has never existed in smtpd, there's never been
> > code to translate sender addresses and there's a good reason for that:
> 
> Good reasons aside, I still need to accommodate other vendor's broken mail
> implementations, because I can't fix them.  I know of multiple reasons
> source rewriting is a bad idea, in general, but I get paid to make stuff
> work, not just say that it's broken.
> 

oh, don't get me wrong, i'm not saying there's a good reason not to have
this rewriting, what i was saying is that there was a good reason why it
was not doable before the grammar change.

it is a useful feature which is part of my todo and which i will work on
as time allows.


> > it not considered doable before the grammar change...
> > But sure, blame it on the grammar.
> 
> I believed that the grammar change had rendered my use case impossible
> because  was now limited to local delivery methods.  Clearly I was
> wrong... and not even in the way I thought I might be wrong.
> 

yes, that's true.

using 'virtual' on relay rules didn't transform anything whatsoever, the
code had an explicit check to not enter the transformation lookups if we
were in a relay rule.

the new grammar just made it clear that what you were trying to do could
not work rather than accepting the criteria and disregarding it.


> > I may sound a bit harsh, but starting a thread with "this is my last try
> > or I'll switch" (as if it actually matters)
> 
> My apologies - that was meant to sound more like "I have a plan B so if this
> isn't possible, that's OK but I've wasted so much time on this I'm kinda
> running out of time, please tell me if I should just stop now and switch".
> I know *exactly* how much OpenBSD devs care if I use their code or not!  I
> do not want to be "that asshole", although it seems I've succeeded again -
> sorry.
> 
> Thank you for taking the time to reply.  Now I'm going to go check that mail
> server a 7,000,000th time, this time to see what MTA is actually *running*,
> not just *configured*.  I'm not sure whether I want it to be such a blatant
> mistake on my part or not... if yes, this all makes sense but I'm an idiot,
> whereas if no, then WTF, how is it working at all?
> 
> FWIW: I am much happier with OpenSMTPd than with other MTAs because of its
> forward-declarative configuration syntax.  Thank you for your work on
> bringing a modern, lean, secure(-er) MTA into existence.
> 

np ;-)



-- 
Gilles Chehade @poolpOrg

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



Re: smtpd - help needed tranlsating to new virtual map syntax [FIXED]

2019-01-21 Thread Gilles Chehade
sorry, I obviously f-up my last mail, this one is fixed ;-)


On Sun, Jan 20, 2019 at 04:14:05PM -0600, Adam Thompson wrote:
> As it turns out, no, that doesn't work.
> Trying to fix up broken sender mail domain-parts only simply gets me a "5.2.4 
> Mailing list expansion problem" error, with no debug output to suggest why.
> 
> In this test case, my translations map had:
> 
>   @bad.athompso.net @good.athompso.net
> 

What is a translation map ?

There is no such thing in OpenSMTPD (as of today).


> in it.  Obviously, this is a test setup :).
> Smtpd.conf itself consisted of:
> 
>   listen on all received-auth
>   smtp max-message-size 100M
>   table translations file:/etc/mail/translations  # ORIG->NEW 
> mappings
>   table allowed-hosts file:/etc/mail/allowed-hosts# Who can 
> connect?  (bare IP addresses or CIDR subnets)
>   action translate lmtp "/var/run/lmtp.sock" virtual
> # 1st pass on allowed rewrite mail
>   action forward forward-only 
> # and now it's not our problem anymore
>   match for any from local action forward # 2nd pass for 
> reinjected mail, this time just forward it
>   match for any from src  action translate # inbound mail 
> - hand it to LMTP, translating as we go
>
>


from table(5):

 Aliasing tables
 
 Aliasing tables are mappings that associate a recipient to one or many
 destinations.  They can be used in two contexts: primary domain aliases
 and virtual domain mapping.
 
 [...]
 
 In a virtual domain context, the key is either a user part, a full email
 address or a catch all, following selection rules described in
 smtpd.conf(5), and the value is one or many recipients as described in
 aliases(5):

   user1   otheruser
   us...@example.org   otheruser1,otheruser2
   @example.orgotheru...@example.com
   @   catch...@example.com


You're feeding the virtual table with invalid values.

Also, this is a recipient translation mechanism, similar to aliases, and
not a sender rewriting mechanism which we do not have at this point.


> A cursory glance at the source code (yikes, it's been a long time since I was 
> a programmer) suggests that virtual now only works on recipients, not 
> senders.  Which is too bad for me, as that means I'll have to switch at least 
> one box to use Postfix.
>

virtual _now_ only works on recipients, not senders ?

the virtual code hasn't changed, it works the way it always did.

there is no way it could ever do what you're describing or attempting to
do given that it doesn't operate at all anywhere near the message. there
is no way it has ever parsed:

@bad.athompso.net @good.athompso.net

and the only thing that changed is that such errors are now visible from
the session as:

5.2.4 Mailing list expansion problem

instead of an invalid recipient error like it probably did in 6.3


> I'm not convinced the new smtpd.conf grammar improves anything at all, but I 
> assume it must help someone or it wouldn't have changed... but I believe my 
> use case got thrown out with the bathwater, so to speak.  Oh, well.  :-(
>

This is bullshit.

The grammar doesn't reduce the functional scope, it can only expand it.

What you are describing has never existed in smtpd, there's never been
code to translate sender addresses and there's a good reason for that:

it not considered doable before the grammar change...

But sure, blame it on the grammar.


> (If anyone cares, the bad sender addresses are mostly alerts coming from 
> older Sun ALOMs and at least one Lexmark printer that also sends email with 
> broken From addresses.)
> 

I may sound a bit harsh, but starting a thread with "this is my last try
or I'll switch" (as if it actually matters) right before telling someone
who wants to help you that you actually tried _nothing_ then blaming the
code improvements for a use-case that could have never worked because it
not only uses the wrong _documented_ mechanism but also because the code
to make your use-case work has never existed, kinds of irritates me.

I don't get royalties on smtpd install, please install whatever software
fits your use case, this is how proper engineering works.

-- 
Gilles Chehade @poolpOrg

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



Re: smtpd - help needed tranlsating to new virtual map syntax

2019-01-21 Thread Gilles Chehade
 @example.orgotheru...@example.com
   @   catch...@example.com


You're feeding the virtual table with invalid values.

Also, this is a recipient translation mechanism, similar to aliases, and
not a sender rewriting mechanism which we do not have at this point.


> A cursory glance at the source code (yikes, it's been a long time since I was 
> a programmer) suggests that virtual now only works on recipients, not 
> senders.  Which is too bad for me, as that means I'll have to switch at least 
> one box to use Postfix.
>

virtual _now_ only works on recipients, not senders ?

the virtual code hasn't changed, it works the way it always did.

there is no way it could ever do what you're describing or attempting to
do given that it doesn't operate at all anywhere near the message. there
is no way it has ever parsed:

@bad.athompso.net @good.athompso.net

and the only thing that changed is that such errors are now visible from
the session as:

5.2.4 Mailing list expansion problem

instead of an invalid recipient error like it probably did in 6.3


> I'm not convinced the new smtpd.conf grammar improves anything at all, but I 
> assume it must help someone or it wouldn't have changed... but I believe my 
> use case got thrown out with the bathwater, so to speak.  Oh, well.  :-(
>

This is bullshit.

The grammar doesn't reduce the functional scope, it can only expand it.

What you are describing has never existed in smtpd, there's never been
code to translate sender addresses and there's a good reason for that:

it not considered doable before the grammar change...

But sure, blame it on the grammar.


> (If anyone cares, the bad sender addresses are mostly alerts coming from 
> older Sun ALOMs and at least one Lexmark printer that also sends email with 
> broken From addresses.)
> 


I may sound a bit harsh, but starting a thread with "this is my last try
or I'll switch" (as if it actually matters) right before telling someone
who wants to help you that you actually tried _nothing_ then blaming the
code improvements for a use-case that could have never worked because it
not only uses the wrong _documented_ mechanism but also because the code
to make your use-case work has never existed, kinds of irritates me.

I don't get royalties on smtpd install, please install whatever software
fits your use case, this is how proper engineering works.

-- 
Gilles Chehade @poolpOrg

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



Re: Opensmtpd auth in 6.4

2019-01-14 Thread Gilles Chehade
On Mon, Jan 14, 2019 at 01:42:19PM +0100, Flipchan wrote:
> I tried to echo it another way (echo -ne '\user\passwd' | base64 )
> and then 
> auth plain string
> and it works
> 
> 
> Now im getting new errrors :/ or i think i have misconfigured match, i cant 
> send to external addresses, log:
> http://dpaste.com/2M8JMQC.txt
> 

you need a rule that matches auth, for example:

match auth from any for any action "relay"


> On January 14, 2019 1:10:24 PM GMT+01:00, Gilles Chehade  
> wrote:
> >On Mon, Jan 14, 2019 at 01:03:19PM +0100, Flipchan wrote:
> >> Seems like it adds "\^J" to the username , i base64 encode it using:
> >> echo "user" | base64 
> >> 
> >> Log from smtpd -dv -T smtp :
> >> http://dpaste.com/0CAVJFF.txt
> >> 
> >
> >honestly, i'm confused by what you're doing
> >
> >can you setup a temporary account, with a temporary password,
> >authenticate to it
> >using a regular MUA (whichever you want, just don't auth manually), 
> >then trash
> >the account and send us logs that aren't doctored ?
> >
> >
> >
> >> On January 14, 2019 9:41:42 AM GMT+01:00, Gilles Chehade
> > wrote:
> >> >On Sat, Jan 12, 2019 at 05:36:11PM +0100, Flipchan wrote:
> >> >> Hey, am tryin to upgrade my opensmtpd 
> >> >> email server running on openbsd 6.3 towards a new one on 6.4, 
> >> >> i have used a simple config with the new syntax:
> >> >>  cat /etc/mail/smtpd.conf 
> >> >> 
> >> >> table aliases file:/etc/mail/aliases 
> >> >> 
> >> >> #table other-relays file:/etc/mail/other-relays 
> >> >> 
> >> >> pki mail.example.com cert "/etc/ssl/mail.example.com.crt" 
> >> >> pki mail.example.com key "/etc/ssl/private/mail.example.com.key" 
> >> >> 
> >> >> listen on lo0 
> >> >> listen on vio0 port 587 hostname example.com tls-require pki
> >> >mail.example.com auth mask-source 
> >> >> listen on vio0 port 25 hostname example.com tls pki
> >mail.example.com 
> >> >> 
> >> >> action "mbox" mbox alias  
> >> >> action "relay" relay
> >> >> 
> >> >> match for local action "mbox" 
> >> >> match for any action "relay"
> >> >> match from any for domain example.com action "mbox" 
> >> >> 
> >> >> 
> >> >> i cant login with a users regular username and passwd which is
> >weird.
> >> >
> >> >> In the documentation it says that it is suppose to take regular
> >user
> >> >creds if not a table is defined which it is not.
> >> >>  https://man.openbsd.org/smtpd.conf#listen_on
> >> >> 
> >> >>  "Users are authenticated against either their own normal login
> >> >credentials or a credentials table authtable, the format of which is
> >> >described in table(5)."
> >> >> 
> >> >>  Does anyone know what im doing wrong here? 
> >> >> 
> >> >> maillog: 
> >> >> Jan 12 16:47:49 host smtpd[95842]: XXX smtp connected
> >> >address=ip host=ip Jan 12 16:47:49 host 
> >> >> smtpd[95842]: XXX smtp starttls address=ip host=ip
> >> >ciphers="version=TLSv1.2, cipher=ECDHE-RSA-AES256-GCM-SHA384,
> >bits=256"
> >> >Jan 12 16:47:49 host 
> >> >> smtpd[95842]: XXX smtp authentication user=user
> >> >address=ip host=ip result=permfail Jan 12 16:47:49 host 
> >> >> smtpd[95842]: XXX smtp failed-command address=ip
> >host=ip
> >> >command="AUTH PLAIN (...)" result="535 Authentication failed" Jan 12
> >> >16:47:49 host 
> >> >> smtpd[95842]: XXX smtp authentication user=user
> >> >address=ip host=ip result=permfail Jan 12 16:47:50 host 
> >> >> smtpd[95842]: XXX smtp failed-command address=ip
> >host=ip
> >> >command="AUTH LOGIN (password)" result="535 Authentication failed"
> >> >> 
> >> >
> >> >Hi,
> >> >
> >> >First of all, it should read mask-src and not mask-source, otherwise
> >> >the
> >> >auth keyword is assuming a table containing literal string
> >> >"mask-source"
> >> >and this will cause authentication to fail.
> >> >
> >> >A good method to troubleshoot, is to run smtpd in trace mode:
> >> >
> >> >  smtpd -dv -T smtp
> >> >
> >> >create a test user with a temporary password, so you can share the
> >> >trace
> >> >output here and we can try to figure out what's wrong ... but likely
> >> >the
> >> >mask-source issue is the cause here.
> >> >
> >> >
> >> >-- 
> >> >Gilles Chehade   @poolpOrg
> >> >
> >> >https://www.poolp.org tip me:
> >> >https://paypal.me/poolpOrg
> >> 
> >> -- 
> >> Sent from my Android device with K-9 Mail. Please excuse my brevity.
> >
> >-- 
> >Gilles Chehade  @poolpOrg
> >
> >https://www.poolp.org tip me:
> >https://paypal.me/poolpOrg
> 
> -- 
> Sent from my Android device with K-9 Mail. Please excuse my brevity.

-- 
Gilles Chehade @poolpOrg

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



Re: Opensmtpd auth in 6.4

2019-01-14 Thread Gilles Chehade
On Mon, Jan 14, 2019 at 01:03:19PM +0100, Flipchan wrote:
> Seems like it adds "\^J" to the username , i base64 encode it using:
> echo "user" | base64 
> 
> Log from smtpd -dv -T smtp :
> http://dpaste.com/0CAVJFF.txt
> 

honestly, i'm confused by what you're doing

can you setup a temporary account, with a temporary password, authenticate to it
using a regular MUA (whichever you want, just don't auth manually),  then trash
the account and send us logs that aren't doctored ?



> On January 14, 2019 9:41:42 AM GMT+01:00, Gilles Chehade  
> wrote:
> >On Sat, Jan 12, 2019 at 05:36:11PM +0100, Flipchan wrote:
> >> Hey, am tryin to upgrade my opensmtpd 
> >> email server running on openbsd 6.3 towards a new one on 6.4, 
> >> i have used a simple config with the new syntax:
> >>  cat /etc/mail/smtpd.conf 
> >> 
> >> table aliases file:/etc/mail/aliases 
> >> 
> >> #table other-relays file:/etc/mail/other-relays 
> >> 
> >> pki mail.example.com cert "/etc/ssl/mail.example.com.crt" 
> >> pki mail.example.com key "/etc/ssl/private/mail.example.com.key" 
> >> 
> >> listen on lo0 
> >> listen on vio0 port 587 hostname example.com tls-require pki
> >mail.example.com auth mask-source 
> >> listen on vio0 port 25 hostname example.com tls pki mail.example.com 
> >> 
> >> action "mbox" mbox alias  
> >> action "relay" relay
> >> 
> >> match for local action "mbox" 
> >> match for any action "relay" 
> >> match from any for domain example.com action "mbox" 
> >> 
> >> 
> >> i cant login with a users regular username and passwd which is weird.
> >
> >> In the documentation it says that it is suppose to take regular user
> >creds if not a table is defined which it is not.
> >>  https://man.openbsd.org/smtpd.conf#listen_on
> >> 
> >>  "Users are authenticated against either their own normal login
> >credentials or a credentials table authtable, the format of which is
> >described in table(5)."
> >> 
> >>  Does anyone know what im doing wrong here? 
> >> 
> >> maillog: 
> >> Jan 12 16:47:49 host smtpd[95842]: XXX smtp connected
> >address=ip host=ip Jan 12 16:47:49 host 
> >> smtpd[95842]: XXX smtp starttls address=ip host=ip
> >ciphers="version=TLSv1.2, cipher=ECDHE-RSA-AES256-GCM-SHA384, bits=256"
> >Jan 12 16:47:49 host 
> >> smtpd[95842]: XXX smtp authentication user=user
> >address=ip host=ip result=permfail Jan 12 16:47:49 host 
> >> smtpd[95842]: XXX smtp failed-command address=ip host=ip
> >command="AUTH PLAIN (...)" result="535 Authentication failed" Jan 12
> >16:47:49 host 
> >> smtpd[95842]: XXX smtp authentication user=user
> >address=ip host=ip result=permfail Jan 12 16:47:50 host 
> >> smtpd[95842]: XXX smtp failed-command address=ip host=ip
> >command="AUTH LOGIN (password)" result="535 Authentication failed"
> >> 
> >
> >Hi,
> >
> >First of all, it should read mask-src and not mask-source, otherwise
> >the
> >auth keyword is assuming a table containing literal string
> >"mask-source"
> >and this will cause authentication to fail.
> >
> >A good method to troubleshoot, is to run smtpd in trace mode:
> >
> >  smtpd -dv -T smtp
> >
> >create a test user with a temporary password, so you can share the
> >trace
> >output here and we can try to figure out what's wrong ... but likely
> >the
> >mask-source issue is the cause here.
> >
> >
> >-- 
> >Gilles Chehade  @poolpOrg
> >
> >https://www.poolp.org tip me:
> >https://paypal.me/poolpOrg
> 
> -- 
> Sent from my Android device with K-9 Mail. Please excuse my brevity.

-- 
Gilles Chehade @poolpOrg

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



Re: Opensmtpd auth in 6.4

2019-01-14 Thread Gilles Chehade
On Sat, Jan 12, 2019 at 05:36:11PM +0100, Flipchan wrote:
> Hey, am tryin to upgrade my opensmtpd 
> email server running on openbsd 6.3 towards a new one on 6.4, 
> i have used a simple config with the new syntax:
>  cat /etc/mail/smtpd.conf 
> 
> table aliases file:/etc/mail/aliases 
> 
> #table other-relays file:/etc/mail/other-relays 
> 
> pki mail.example.com cert "/etc/ssl/mail.example.com.crt" 
> pki mail.example.com key "/etc/ssl/private/mail.example.com.key" 
> 
> listen on lo0 
> listen on vio0 port 587 hostname example.com tls-require pki mail.example.com 
> auth mask-source 
> listen on vio0 port 25 hostname example.com tls pki mail.example.com 
> 
> action "mbox" mbox alias  
> action "relay" relay
> 
> match for local action "mbox" 
> match for any action "relay" 
> match from any for domain example.com action "mbox" 
> 
> 
> i cant login with a users regular username and passwd which is weird. 
> In the documentation it says that it is suppose to take regular user creds if 
> not a table is defined which it is not.
>  https://man.openbsd.org/smtpd.conf#listen_on
> 
>  "Users are authenticated against either their own normal login credentials 
> or a credentials table authtable, the format of which is described in 
> table(5)."
> 
>  Does anyone know what im doing wrong here? 
> 
> maillog: 
> Jan 12 16:47:49 host smtpd[95842]: XXX smtp connected address=ip 
> host=ip Jan 12 16:47:49 host 
> smtpd[95842]: XXX smtp starttls address=ip host=ip 
> ciphers="version=TLSv1.2, cipher=ECDHE-RSA-AES256-GCM-SHA384, bits=256" Jan 
> 12 16:47:49 host 
> smtpd[95842]: XXX smtp authentication user=user address=ip 
> host=ip result=permfail Jan 12 16:47:49 host 
> smtpd[95842]: XXX smtp failed-command address=ip host=ip 
> command="AUTH PLAIN (...)" result="535 Authentication failed" Jan 12 16:47:49 
> host 
> smtpd[95842]: XXX smtp authentication user=user address=ip 
> host=ip result=permfail Jan 12 16:47:50 host 
> smtpd[95842]: XXX smtp failed-command address=ip host=ip 
> command="AUTH LOGIN (password)" result="535 Authentication failed"
> 

Hi,

First of all, it should read mask-src and not mask-source, otherwise the
auth keyword is assuming a table containing literal string "mask-source"
and this will cause authentication to fail.

A good method to troubleshoot, is to run smtpd in trace mode:

  smtpd -dv -T smtp

create a test user with a temporary password, so you can share the trace
output here and we can try to figure out what's wrong ... but likely the
mask-source issue is the cause here.


-- 
Gilles Chehade @poolpOrg

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



Re: CVS: cvs.openbsd.org: src (maillog simplified)

2019-01-01 Thread Gilles Chehade
On Tue, Jan 01, 2019 at 01:14:54PM +0100, Walter Alejandro Iglesias wrote:
> On Fri, Dec 21, 2018 at 06:59:58PM +0100, Gilles Chehade wrote:
> > On Fri, Dec 21, 2018 at 06:56:57PM +0100, Walter Alejandro Iglesias wrote:
> > > Hello Gilles,
> > > 
> > > In article <20181221145201.ga90...@ams-1.poolp.org> Gilles Chehade 
> > >  wrote:
> > > > On Fri, Dec 21, 2018 at 07:41:41AM -0700, Gilles Chehade wrote:
> > > > > CVSROOT:  /cvs
> > > > > Module name:  src
> > > > > Changes by:   gil...@cvs.openbsd.org  2018/12/21 07:41:41
> > > > > 
> > > > > Modified files:
> > > > >   usr.sbin/smtpd : smtp_session.c 
> > > > > 
> > > > > Log message:
> > > > > start simplifying log lines, they're no longer intended to be 
> > > > > parseable, we
> > > > > have a reporting API for tools that want to analyze events, maillog 
> > > > > is just
> > > > > for us, hoomans.
> > > > > 
> > > > 
> > > > that was not the best way to phrase my commit log ... sorry
> > > > 
> > > > i meant they're no longer intended to be friendlier to scripts than to
> > > > humans: there will still be in a format that's easy to quickly script,
> > > > but they will hold information easily readable by humans, not a lot of
> > > > unrelated context infos so tools can generate dashboards out of single
> > > > lines.
> > > > 
> > > > logs for humans, event reports for tools.
> > > > 
> > > 
> > > Since long I've been greping IPs from spammers and attackers from
> > > /var/log/maillog, /var/log/authlog and /var/log/daemon using a shell
> > > script I wrote that automatically includes them in a file read by a pf
> > > table.  In the case of maillog, it relies in the address="" and host=""
> > > info currently included.
> > > 
> > > Will it appear sender's IP and hostname in /var/log/maillog after this
> > > change?
> > > 
> > 
> > yes, you'll still be able to grep that information from maillog
> 
> You selected carefully the words in your answer. :-)
> 

not really, I don't know what your scripts do and how you wrote them.

the sender IP and hostname appear in the log, they are just not repeated
on every single log line but that shouldn't prevent scripts from keeping
track of them.

anyways, as stated in the commit log and my follow up message:

"we have a reporting API for tools that want to analyse events, maillog
 is just for us, hoomans"

"logs for humans, event reports for tools"

the maillog format is going to go through many changes to simplify it,
remove redundant information, add missing information, etc... basing a
script on it is not recommended as we'll break them with every change.


> Indeed, I still can grep "IP" and "host" in maillog, but they are alone
> in a first line and the only way to associate them with the following
> lines containing the from= to= and result= (to know what "happened" with
> that connection) is by using the connection id, what will *painfully*
> overcomplicate my scripts.
> 

As you imagine, I can't take into account individual scripts.

Other people have asked that the port or listener tag appear in lines.
Should these appear on all lines too ?
And the cipher ? and the authenticated user ?
Why is the IP/host information more legitimate to be repeated than other
information on every single line ?
What about the fcrdns check which will appear on connect lines, does the
check have to appear on every line now ?
What about the spf check when it is added at some point ?

maillog is not a context-free format, where each individual line carries
all of the information so you don't have to look at previous lines. Line
should describe an event and carry informations related to THAT event.

The only guarantee I make on the format is that you can always find what
you're looking for with at most 2 grep, one to find a session id, one to
find the event you're looking for.

That being said, there's a new reporting mechanism which is intended for
scripts and tools. It comes with a format that's easily parsable, that's
going to be stabilized, versionned and which actually provides more info
than maillog. It doesn't solve your context-free issue but it can easily
be used to script an output that repeats the info you need on all lines,
to be fed to your existing scripts. I have such scripts myself.

If you describe how your scripts work, I can probably help you.


> I don't know what's the opinion of the rest about this chang

Re: CVS: cvs.openbsd.org: src

2018-12-21 Thread Gilles Chehade
On Fri, Dec 21, 2018 at 06:56:57PM +0100, Walter Alejandro Iglesias wrote:
> Hello Gilles,
> 
> In article <20181221145201.ga90...@ams-1.poolp.org> Gilles Chehade 
>  wrote:
> > On Fri, Dec 21, 2018 at 07:41:41AM -0700, Gilles Chehade wrote:
> > > CVSROOT:  /cvs
> > > Module name:  src
> > > Changes by:   gil...@cvs.openbsd.org  2018/12/21 07:41:41
> > > 
> > > Modified files:
> > >   usr.sbin/smtpd : smtp_session.c 
> > > 
> > > Log message:
> > > start simplifying log lines, they're no longer intended to be parseable, 
> > > we
> > > have a reporting API for tools that want to analyze events, maillog is 
> > > just
> > > for us, hoomans.
> > > 
> > 
> > that was not the best way to phrase my commit log ... sorry
> > 
> > i meant they're no longer intended to be friendlier to scripts than to
> > humans: there will still be in a format that's easy to quickly script,
> > but they will hold information easily readable by humans, not a lot of
> > unrelated context infos so tools can generate dashboards out of single
> > lines.
> > 
> > logs for humans, event reports for tools.
> > 
> 
> Since long I've been greping IPs from spammers and attackers from
> /var/log/maillog, /var/log/authlog and /var/log/daemon using a shell
> script I wrote that automatically includes them in a file read by a pf
> table.  In the case of maillog, it relies in the address="" and host=""
> info currently included.
> 
> Will it appear sender's IP and hostname in /var/log/maillog after this
> change?
> 

yes, you'll still be able to grep that information from maillog

-- 
Gilles Chehade @poolpOrg

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



could use some spamdb output

2018-12-21 Thread Gilles Chehade
hello misc@,

If you are comfortable with sharing your spamdb output with me, it would
be very helpful in confirming or not some theories I have.

I do not need the sender/recipient parts, only the first two fields that
disclose if the connection is in GREY or WHITE list and IP address of MX
that initated the connection:

$ spamdb | grep -E '^(GREY|WHITE)\|' | cut -d\| -f1,2


Do not spam misc@ with that output, send it directly to me.

Thanks !

-- 
Gilles Chehade @poolpOrg

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



Re: Core Dev?

2018-12-04 Thread Gilles Chehade
On Mon, Dec 03, 2018 at 08:40:50PM -0600, Vijay Sankar wrote:
> Well, (sorry if this is too much information) my kid started using OpenBSD
> at a very young age due to Antoine's gCompris package 10 or more years ago.
> Also, there is the very useful subscription for stable packages at
> mtier.org. So unless Theo de Raadt or Antoine Jacoutot say otherwise, I
> would think he is a core developer.
> 

Being a core developer, whatever that means, does not mean that anything
you write automatically becomes officialy supported by OpenBSD.

That being said you should ask ajacoutot@ because he is a core developer
whatever that means :-)



> On 12/3/18 6:17 PM, Ahmad Bilal wrote:
> > -BEGIN PGP SIGNED MESSAGE-
> > Hash: SHA256
> > 
> > Can anyone tell me,
> > Is Antoine Jacoutot a core openbsd developer?
> > 
> > And this is his account (not a impersonator?)
> > https://github.com/ajacoutot/aws-openbsd
> > 
> > Should I take it as a official way of running OpenBSD on AWS?
> > 
> > Sent with ProtonMail Secure Email.
> > -BEGIN PGP SIGNATURE-
> > Version: ProtonMail
> > Comment: https://protonmail.com
> > 
> > wsBcBAEBCAAQBQJcBceOCRD3irc5ItUgGgAAngIIAJVEZINkE1Md0/OGKeOQ
> > FX9BLNsAvLsmKZUEHIV4XnyM2kGe2kK/1uxfbboYD7oK6qnekVIDxRB4KjXz
> > xjhdRzlRkqS50DKFgmVT5z2FN34nDgdLRq3K+vO24jpYAWVYrrrgLsZkqpHp
> > YfNpOU1pMraiVWKWxEm1K8sqrIraunJoXU1DeBwsRveIm9W8lQhrakOK5w/A
> > LP7NegSZljctRmTvLDkSwkgdR9mH18y/DFAjj+TlA3oLNB+EkKGRgBxuEddb
> > BgoAU+9+PSgpoAUGXeWGlp/Q0caUP7lM/VlovbBJF8l+1uEZtc1euwtw8fo/
> > +cxZXDiMzDbouZAvSqG/60E=
> > =5R2I
> > -END PGP SIGNATURE-
> > 
> -- 
> Vijay Sankar
> ForeTell Technologies Limited
> vsan...@foretell.ca
> 

-- 
Gilles Chehade @poolpOrg

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



Re: smtpd.conf and junk

2018-11-25 Thread Gilles Chehade
On Wed, Nov 21, 2018 at 09:21:46PM +0100, Thuban wrote:
> * Gilles Chehade  le [21-11-2018 21:06:39 +0100]:
> > On Wed, Nov 21, 2018 at 06:38:43PM +0100, Thuban wrote:
> > > * Edgar Pettijohn  le [21-11-2018 11:32:43 
> > > -0600]:
> > > > 
> > > > On Nov 21, 2018 8:22 AM, Thuban  wrote:
> > > > >
> > > > > Hi,
> > > > > I can't figure how to make this "junk" argument to work as 
> > > > > mentioned in The smtpd.conf manpages :
> > > > >
> > > > > If the junk argument is provided, the message will be
> > > > > moved to the Junk folder if it contains a positive X-Spam
> > > > > header.
> > > > >
> > > > >
> > > > > spams detected by spamassassin have multiple X-Spam-* headers, but 
> > > > > aren't placed
> > > > > into Junk folder.
> > > > >
> > > > > Any advice ?
> > > > >
> > > > >
> > > > >
> > > > > -- 
> > > > > ?? thuban
> > > > >
> > > > It looks for a header matching:
> > > > 
> > > > X-Spam: Yes
> > > > 
> > > > You may need to configure spamassassin to write it that way. I believe 
> > > > that the default is different, but I can't check right now.
> > > > 
> > > 
> > > I tried to add this in spamassassin.conf [0] :
> > > 
> > >   add_header spam X-Spam
> > > 
> > > But if you read the link [0] closely, it can't work because spamassassin 
> > > add
> > > headers "X-Spam-someting", never "X-Spam" : 
> > > 
> > >   All headers begin with X-Spam- (so a header_name Foo will generate a 
> > > header called X-Spam-Foo)
> > > 
> > > I guess the "junk" keyword in smtpd.conf was written to be handy, so I 
> > > miss
> > > something. Where ?
> > > 
> > 
> > You didn't miss anything, the maildir agent only supports X-Spam headers
> > as of today so this will need a diff to support SpamAssassin if it can't
> > generate a X-Spam header.
> > 
> 
> Okay, thanks, I doubt since english is not my main language.
> 
> > SpamAssassin wasn't a target when I wrote that feature but it's just one
> > diff away ;-)
> > 
> 
> Just need to check "X-Spam-Flag: YES" or "X-Spam-Status: Yes,.*" then.
> 
> Just curious, what was the target of that 'junk' feature ? rspamd ? Another ?
> 
> Regards.
> 

in -current, maildir junk now recognizes X-Spam-Flag: YES

cheers,

-- 
Gilles Chehade @poolpOrg

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



Re: smtpd.conf and junk

2018-11-21 Thread Gilles Chehade
On Wed, Nov 21, 2018 at 09:21:46PM +0100, Thuban wrote:
> * Gilles Chehade  le [21-11-2018 21:06:39 +0100]:
> > On Wed, Nov 21, 2018 at 06:38:43PM +0100, Thuban wrote:
> > > * Edgar Pettijohn  le [21-11-2018 11:32:43 
> > > -0600]:
> > > > 
> > > > On Nov 21, 2018 8:22 AM, Thuban  wrote:
> > > > >
> > > > > Hi,
> > > > > I can't figure how to make this "junk" argument to work as 
> > > > > mentioned in The smtpd.conf manpages :
> > > > >
> > > > > If the junk argument is provided, the message will be
> > > > > moved to the Junk folder if it contains a positive X-Spam
> > > > > header.
> > > > >
> > > > >
> > > > > spams detected by spamassassin have multiple X-Spam-* headers, but 
> > > > > aren't placed
> > > > > into Junk folder.
> > > > >
> > > > > Any advice ?
> > > > >
> > > > >
> > > > >
> > > > > -- 
> > > > > ?? thuban
> > > > >
> > > > It looks for a header matching:
> > > > 
> > > > X-Spam: Yes
> > > > 
> > > > You may need to configure spamassassin to write it that way. I believe 
> > > > that the default is different, but I can't check right now.
> > > > 
> > > 
> > > I tried to add this in spamassassin.conf [0] :
> > > 
> > >   add_header spam X-Spam
> > > 
> > > But if you read the link [0] closely, it can't work because spamassassin 
> > > add
> > > headers "X-Spam-someting", never "X-Spam" : 
> > > 
> > >   All headers begin with X-Spam- (so a header_name Foo will generate a 
> > > header called X-Spam-Foo)
> > > 
> > > I guess the "junk" keyword in smtpd.conf was written to be handy, so I 
> > > miss
> > > something. Where ?
> > > 
> > 
> > You didn't miss anything, the maildir agent only supports X-Spam headers
> > as of today so this will need a diff to support SpamAssassin if it can't
> > generate a X-Spam header.
> > 
> 
> Okay, thanks, I doubt since english is not my main language.
> 
> > SpamAssassin wasn't a target when I wrote that feature but it's just one
> > diff away ;-)
> > 
> 
> Just need to check "X-Spam-Flag: YES" or "X-Spam-Status: Yes,.*" then.
> 

indeed, I think X-Spam-Flag is the right candidate.


> Just curious, what was the target of that 'junk' feature ? rspamd ? Another ?
> 

rspamd was my target yes

-- 
Gilles Chehade @poolpOrg

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



Re: smtpd.conf and junk

2018-11-21 Thread Gilles Chehade
On Wed, Nov 21, 2018 at 06:38:43PM +0100, Thuban wrote:
> * Edgar Pettijohn  le [21-11-2018 11:32:43 -0600]:
> > 
> > On Nov 21, 2018 8:22 AM, Thuban  wrote:
> > >
> > > Hi,
> > > I can't figure how to make this "junk" argument to work as 
> > > mentioned in The smtpd.conf manpages :
> > >
> > > If the junk argument is provided, the message will be
> > > moved to the Junk folder if it contains a positive X-Spam
> > > header.
> > >
> > >
> > > spams detected by spamassassin have multiple X-Spam-* headers, but aren't 
> > > placed
> > > into Junk folder.
> > >
> > > Any advice ?
> > >
> > >
> > >
> > > -- 
> > > ?? thuban
> > >
> > It looks for a header matching:
> > 
> > X-Spam: Yes
> > 
> > You may need to configure spamassassin to write it that way. I believe that 
> > the default is different, but I can't check right now.
> > 
> 
> I tried to add this in spamassassin.conf [0] :
> 
>   add_header spam X-Spam
> 
> But if you read the link [0] closely, it can't work because spamassassin add
> headers "X-Spam-someting", never "X-Spam" : 
> 
>   All headers begin with X-Spam- (so a header_name Foo will generate a 
> header called X-Spam-Foo)
> 
> I guess the "junk" keyword in smtpd.conf was written to be handy, so I miss
> something. Where ?
> 

You didn't miss anything, the maildir agent only supports X-Spam headers
as of today so this will need a diff to support SpamAssassin if it can't
generate a X-Spam header.

SpamAssassin wasn't a target when I wrote that feature but it's just one
diff away ;-)

-- 
Gilles Chehade @poolpOrg

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



Re: smtpd.conf and junk

2018-11-21 Thread Gilles Chehade
On Wed, Nov 21, 2018 at 03:22:45PM +0100, Thuban wrote:
> Hi,
> I can't figure how to make this "junk" argument to work as 
> mentioned in The smtpd.conf manpages :
> 
>   If the junk argument is provided, the message will be
>   moved to the Junk folder if it contains a positive X-Spam
>   header.
> 
> 
> spams detected by spamassassin have multiple X-Spam-* headers, but aren't 
> placed
> into Junk folder.
> 
> Any advice ?
> 

without seeing examples of these headers and your config, it's hard to
understand what's incorrect ;-)

-- 
Gilles Chehade @poolpOrg

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



Re: "relay as" domain rewrite in new smtpd.conf syntax

2018-11-08 Thread Gilles Chehade
On Thu, Nov 08, 2018 at 12:40:51PM -0500, Allan Streib wrote:
> Prior to 6.4, in smtpd.conf(5), the relay directive supported the "as"
> parameter:
> 
> If the as parameter is specified, smtpd(8) will rewrite the sender
> advertised in the SMTP session. address may be a user, a domain
> prefixed with ???@???, or an email address, causing smtpd(8) to rewrite
> the user-part, the domain-part, or the entire address, respectively.
> 
> In the new smtpd.conf(5) syntax, how is that rewrite achieved,
> specifically the "@" prefix behavior to rewrite the domain part?
> 


 The relay delivery methods also support additional options:

 [...]
 
 mail-from mailaddr
 Use mailaddr as the MAIL FROM address within the SMTP
 transaction.


so this would be something like:

   action relay_00 relay mail-from "@foobar.org"
   
   match [...] action relay_00





-- 
Gilles Chehade @poolpOrg

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



Re: spamd and google smtp ips

2018-10-30 Thread Gilles Chehade
On Tue, Oct 30, 2018 at 08:59:07PM +0100, Peter N. M. Hansteen wrote:
> On 10/30/18 8:46 PM, Chris Narkiewicz wrote:
> > W dniu 30/10/2018 o??19:31, Peter N. M. Hansteen pisze:
> >> yes, a well-known problem, and it's what nospamd (hinted at in the spamd
> >> man pages) is for.
> >>
> >> To some extent it helps to whitelist IP addresses and networks that
> >> domains list in their SPF info.
> > 
> > Yeah, I hoped there are some reputable sources of validated mail
> > sources based on SPF and DKIM.
> > 
> > I'll give a try to your compiled list, but the fact you maintain
> > it manually is a bit discouraging.
> 
> Fortunately MX records and by extension SPF info per domain changes
> infrequently enough that a semi-manually maintained list will be mostly
> right, most of the time.
> 
> But you're right in principle -- I *should* really take the time out to
> recreate the list of domains that went into it and just re-generate with
> smtpctl spf walk something like once per day or once per week.
> 

Like this ?

https://github.com/Mailbrix/lists

:-)

-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: OpenSMTPd: "mail.lmtp: connect: Connection refused"

2018-10-21 Thread Gilles Chehade
On Wed, Oct 17, 2018 at 10:44:19PM +0300, Atanas Vladimirov wrote:
> Hi misc,
> 
> Please, let me know if this mailing list is not the right place for this
> question.
> 
> I'm following -current and I found that maybe something is wrong with my
> setup.
> When the server boots the first time after an upgrade the emails from the
> installer are lost because of `result=PermFail stat=Error ("mail.lmtp:
> connect: Connection refused")`.
> I did a few tests and the problem appears when the dovecot is not running
> (or before it's been started during the boot cycle).
> 

hi,

for the record, the mail.lmtp mda was being too strict about the connect
failures.

this was not an issue before because smtpd was being extremely cautious,
handling all MDA failures as TempFail but this came with other issues so
in 6.4 we aligned with Postfix handling only some exit codes as tempfail
and all others as permfail.

diff going to the tree in a minute, tested by Atanas ;-)

-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: Running your own mail server

2018-09-28 Thread Gilles Chehade
On Fri, Sep 28, 2018 at 12:25:12PM +0200, Aham Brahmasmi wrote:
> Craig,
> 
> Thank you for your exhaustive reply - the list of checks along with
> current workarounds to achieve them are very helpful. I now know that
> I need to learn even more.
> 

Indeed, interesting reading.


> > OpenSMTPd's filter interface is not yet usable (last update 12/2014):
> > http://www.poolp.org/posts/2014-12-12/the-state-of-filters/
> 
> Slide 73 of https://www.openbsd.org/papers/eurobsdcon2017-opensmtpd.pdf
> mentions smtpfd - smtp filtering daemon. The slides are informative in
> terms of the thinking behind filters that OpenSMTPD plans to introduce.
> Some of the changes proposed in that talk like the modified grammar are
> now in -current. I may be wrong here but the filter/smtpfd might have
> been held back for post-6.4 introduction.
> 

That is exactly the case.

I have a non-invasive implementation of filters which I'm happy with and
which I intend to commit shortly after OpenBSD 6.4 is tagged, so we have
a full release cycle to work on details, keywords and such, in order for
the feature to be production ready for 6.5.

I _do_ have filters on my laptop right now.

-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: Issue with OpenSMTPD, procmail and comsat

2018-09-03 Thread Gilles Chehade
On Mon, Sep 03, 2018 at 12:25:55PM +0200, d.rausch...@gmail.com wrote:
> Hi Gilles,
> 
> On Sun, Sep 02, 2018 at 01:25:46PM +0200, Gilles Chehade wrote:
> > Can you provide me with the corrupt line procmail includes so I can
> > check if it is invalid indeed ?
> 
> The corrput line:
> 
> From d...@ws.lan  Mon Sep  3 12:12:34 2018
> 
> The differenc I encountered is with .forward to procmail there are
> TWO spaces between the email address and the date, without .forward to
> procmail there is only ONE space.
> 
> If I edit such a two spaced mail with vi(1) and concat it to
> /var/mail/$USER comsat(8) is silenced. No error message but ksh
> reports "you have mail in /var/mail/dra" as it should.
> 

interesting, it's not clear to me how this can happen but at least this
means the fix will not be a special case.

can you try:

procmail -f %{mbox.from} --

i'll try to reproduce the bug at home but I'm unable before tonight.



-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: Issue with OpenSMTPD, procmail and comsat

2018-09-02 Thread Gilles Chehade
You forgot to mention what version of OpenBSD you are using ?

On Sun, Sep 02, 2018 at 01:03:48PM +0200, d.rausch...@gmail.com wrote:
> Hi,
> 
> I figured out an issue with opensmtpd, procmail, and comsat.
> The .forward for procamil must be
> 
> "|exec /usr/local/bin/procmail -f - || exit 75"
> 
> The -f - option makes procmail to include a dummy mail-from header
> line. But this line is corrupt. comsat(8) does not like this:
> 
> Sep  1 19:10:41 ws comsat[11416]: ':/var/mail/dra' is invalid
> 
> in /var/log/messages. But mutt can read this mail.
> 
> Without the -f - option in the .forward file my mailspool is corrupted
> because of the missin first line (mail-from header). The currect
> solution is: I have turned off comsat in inetd.conf. But i am
> unsatisfied with this. It would be better if opensmtpd would include
> the mail-from header if processinf the .forward to procmail.
> 

I don't like the idea that because procmail produces a corrupt line that
comsat doesn't understand, smtpd should have a special case and parse an
aliases mapping or forward files looking for the string "procmail".

If you're running current, you might want to try:

   "|exec /usr/local/bin/procmail -f %{mbox.from} || exit 75"

in case it helps procmail produce a correct sender.

Can you provide me with the corrupt line procmail includes so I can
check if it is invalid indeed ?

-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: New laptop recommendations

2018-06-19 Thread Gilles Chehade
I love my DELL Latitude E7240 :-)


June 19, 2018 1:01 PM, "Jeffrey Joshua Rollin"  wrote:

> Definitely second the ThinkPad recommendations. I have an X230i, bought used, 
> on which I currently
> run OpenBSD 6.3, and an E550 on which I've used OpenBSD in the past; both run 
> perfectly as of 6.2,
> except for the fingerprint reader on the X (although to be fair I haven't 
> tried that again
> recently).
> 
> Jeff
> 
> ⁣Sent from Blue ​
> 
> On 19 Jun 2018, 11:51, at 11:51, Daniel Gracia  wrote:
> 
>> I would opt for a Thinkpad. Actually working with a T460s; runs like a
>> charm. If you are looking for mobility, a T series should fit. If you
>> need
>> more horsepower take a look at P series.
>> 
>> Of course those are my preferences, YMMV!
>> 
>> Regards.
>> 
>> El mar., 19 jun. 2018 a las 12:41, Rupert Gallagher
>> ()
>> escribió:
>> 
>>> I'm done with my 10 years old 1200EUR MacBookPro. It served me well,
>> 
>> every
>>> day, but is now falling apart, finally.
>>> 
>>> I would buy a new one if only Steve Jobs would be alive and keeping
>> 
>> Apple
>>> inspired. The new models are meticulously designed to make you
>> 
>> suffer:
>>> expensive, slow cpu, soldered ram, soldered disk, small disk, bad
>> 
>> keyboard
>>> keys, wifi only, must pay extra for standard connectors.
>>> 
>>> I have 1500EUR for a new laptop. What would you buy with it?


-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: smtpd.conf new grammar

2018-05-28 Thread Gilles Chehade
On Sun, May 27, 2018 at 08:05:05AM -0500, ed...@pettijohn-web.com wrote:
> 
> On May 27, 2018 2:10 AM, viq <vic...@gmail.com> wrote:
> >
> > On 18-05-26 20:30:32, Amelia A Lewis wrote:
> > > On Sun, 27 May 2018 00:43:02 +0200, viq wrote:
> > > > Sorry, I've read the announcements, looked at man pages and examples,
> > > > but still didn't manage to figure out how to translate "deliver via 
> > > > dovecot
> > > > lmtp"
> > > > (to have sieve working) into the new syntax. So far my config was:
> > > > 
> > > > table vusers ldap:/etc/mail/ldap.conf
> > > > table vdomains ldap:/etc/mail/ldap.conf
> > > > table passwd ldap:/etc/mail/ldap.conf
> > > > 
> > > > accept from local for local virtual  deliver to lmtp
> > > > "/var/dovecot/lmtp"
> > > > accept from any for domain  virtual  deliver to lmtp
> > > > "/var/dovecot/lmtp"
> > > > 
> > > > 
> > > > I tried changing those into:
> > > > 
> > > > action "lmtp-local" mda "/usr/libexec/mail.lmtp -d /var/dovecot/lmtp"
> > > > virtual 
> > > > action "relay" relay
> > > > match from local for local action "lmtp-local"
> > > > match from any for domain  action "lmtp-local"
> > > > match from local for any action "relay"
> > > > 
> > > > 
> > > > but delivery attempts fail with Error ("mail.lmtp: sender must be 
> > > > specified
> > > > with -f")
> > > > 
> > > > What would be the proper config for this?
> > > 
> > > Good point (and I'm going to need it, too, when I get to that point, 
> > > for dovecot lmtp on one machine and dspam lmtp on another).
> > > 
> > > Gilles, shouldn't there be a keyword 'lmtp' to go along with 
> > > mbox/maildir/mda/relay/forward-only/expand-only? Comparing old (6.2) 
> > > smtp.conf(5) with the updated one linked from your article, it seems to 
> > > be the only missing method of delivery.
> > > 
> > > Or perhaps it just got skipped in the man page? viq, have you tried 
> > > 
> > > action "lmtp-local" lmtp "/var/dovecot/lmtp"
> > > 
> > > ?
> >
> > No, FAQ is very explict about it being removed:
> > http://www.openbsd.org/faq/current.html#r20180524
> >
> 
> That makes me sad :(.  That is a really ugly line in the config.
> 

ok, let me explain the issue and if you gals and guys come up with some
solution that isn't hackish, I won't oppose it :-)

mbox is easy, no parameters need to be exposed to config, we can easily
provide a syntaxic sugar:

   action foobar mbox = action foobar mda "/usr/libexec/mail.local ..."


maildir is easy, no parameters needs to be exposed to config ... except
for a single path that can be expressed as a STRING, we can easily give
syntax sugar too.

   action foobar maildir = action foobar mda "/usr/libexec/mail.maildir ..."
   action foobar maildir path = action foobar mda "/usr/libexec/mail.maildir 
path ..."


lmtp is not easy, it requires multiple parameters and people have a lot
of different use-cases with it. I can't easily provide a syntaxic sugar
and we must expose -d, -f, rcpt-to, etc... this isn't acceptable for me
so if you manage to make all options fit in one STRING I will be ok but
if I have to add keywords specific I won't.

Something like:

> > > action "lmtp-local" lmtp "/var/dovecot/lmtp"

would be fine by me, but people are using other parameters than just the
lmtp socket, or maybe we can provide a syntaxic sugar for this case, and
people using any other option must use the longer option ?

-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: opensmtpd / ldap unreliable

2018-05-26 Thread Gilles Chehade
On Thu, May 24, 2018 at 11:45:40AM -0700, Paul B. Henson wrote:
> > From: Gilles Chehade
> > Sent: Wednesday, May 23, 2018 1:20 PM
> > 
> > That's bad but could easily be fixed if you want to help us
> 
> So I dropped in the latest table-ldap from git, and it still failed
> authentications after an LDAP server outage. It looks like the check is only
> in the table_ldap_check function? I'm not sure what that's for, but it
> doesn't seem to be called at all when doing authentication. I added a
> similar check into the table_ldap_lookup function, and also had to reorder
> the functions  in the file a bit due to errors like this:
> 
> table_ldap.c:92:15: warning: implicit declaration of function 'ldap_open' is
> invalid in C99 
>   [-Wimplicit-function-declaration]   
> 
> Afterwards, opensmtpd successfully reconnected to LDAP and performed
> authentication after an LDAP outage :).
> 
> users[14726]: debug: table_ldap: ldap_query:
> filter=(&(objectClass=uidObject)(uid=henson)), ret=0
> users[14726]: debug: table-ldap: reconnecting
> users[14726]: info: table-ldap: closed previous connection
> users[14726]: debug: ldap server accepted credentials
> users[14726]: debug: table_ldap: ldap_query:
> filter=(&(objectClass=uidObject)(uid=henson)), ret=1
> 
> 
> Here's what my changes currently are. I can submit a pull request on github
> if you'd like. Thanks.
> 

please do so we have more people able to test

I'll review shortly



> diff --git a/extras/tables/table-ldap/table_ldap.c
> b/extras/tables/table-ldap/table_ldap.c
> index 88c9ffd..9d20526 100644
> --- a/extras/tables/table-ldap/table_ldap.c
> +++ b/extras/tables/table-ldap/table_ldap.c
> @@ -74,45 +74,6 @@ table_ldap_update(void)
> return 1;
>  }
>  
> -static int
> -table_ldap_check(int service, struct dict *params, const char *key)
> -{
> -   int ret;
> -
> -   switch(service) {
> -   case K_ALIAS:
> -   case K_DOMAIN:
> -   case K_CREDENTIALS:
> -   case K_USERINFO:
> -   case K_MAILADDR:
> -   if ((ret = ldap_run_query(service, key, NULL, 0)) >= 0) {
> -   return ret;
> -   }
> -   log_debug("debug: table-ldap: reconnecting");
> -   if (!(ret = ldap_open())) {
> -   log_warnx("warn: table-ldap: failed to connect");
> -   }
> -   return ret;
> -   default:
> -   return -1;
> -   }
> -}
> -
> -static int
> -table_ldap_lookup(int service, struct dict *params, const char *key, char
> *dst, size_t sz)
> -{
> -   switch(service) {
> -   case K_ALIAS:
> -   case K_DOMAIN:
> -   case K_CREDENTIALS:
> -   case K_USERINFO:
> -   case K_MAILADDR:
> -   return ldap_run_query(service, key, dst, sz);
> -   default:
> -   return -1;
> -   }
> -}
> -
>  static int
>  table_ldap_fetch(int service, struct dict *params, char *dst, size_t sz)
>  {
> @@ -361,6 +322,32 @@ err:
> return 0;
>  }
>  
> +static int
> +table_ldap_lookup(int service, struct dict *params, const char *key, char
> *dst, size_t sz)
> +{
> +   int ret;
> +
> +   switch(service) {
> +   case K_ALIAS:
> +   case K_DOMAIN:
> +   case K_CREDENTIALS:
> +   case K_USERINFO:
> +   case K_MAILADDR:
> +   if ((ret = ldap_run_query(service, key, dst, sz)) > 0) {
> +   return ret;
> +   }
> +   log_debug("debug: table-ldap: reconnecting");
> +   if (!(ret = ldap_open())) {
> +   log_warnx("warn: table-ldap: failed to connect");
> +   return ret;
> +   }
> +   return ldap_run_query(service, key, dst, sz);
> +   default:
> +   return -1;
> +   }
> +}
> +
> +
>  static int
>  ldap_query(const char *filter, char **attributes, char ***outp, size_t n)
>  {
> @@ -498,6 +485,31 @@ end:
> return ret;
>  }
>  
> +static int
> +table_ldap_check(int service, struct dict *params, const char *key)
> +{
> +   int ret;
> +
> +   switch(service) {
> +   case K_ALIAS:
> +   case K_DOMAIN:
> +   case K_CREDENTIALS:
> +   case K_USERINFO:
> +   case K_MAILADDR:
> +   if ((ret = ldap_run_query(service, key, NULL, 0)) >= 0) {
> +   return ret;
> +   }
> +   log_debug("debug: table-ldap: reconnecting");
> +   if (!(ret = ldap_open())) {
> +   log_warnx("warn: table-ldap: failed to connect");
> +   }
> +   return ret;
> +   default:
> +   return -1;
> +   }
> +}
> +
> +
>  int
>  main(int argc, char **argv)
>  {
> 
> 

-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: Checking my new smtpd.conf syntax

2018-05-26 Thread Gilles Chehade
On Fri, May 25, 2018 at 09:37:07PM +0200, Walter Alejandro Iglesias wrote:
> On Fri, May 25, 2018 at 03:58:59PM +0300, Consus wrote:
> > On 14:31 Fri 25 May, Gilles Chehade wrote:
> > > On Fri, May 25, 2018 at 02:20:50PM +0200, Walter Alejandro Iglesias wrote:
> > > > Could someone tell me if my changes below are OK. :-)
> > > > 
> > > > The part I'm not clear is I read in current.html remote authenticated
> > > > users need a explicit rule.  Do I need to add some "match auth" rule?
> > > > 
> > > 
> > > yes.
> > > 
> > > before, "from local" would match authenticated users as if they had sent
> > > mail from the local machine but this led to being unable to express some
> > > setups where depending on the source you want to relay to different hubs
> > > even though users are authenticated.
> > > 
> > > 
> > > With this:
> > > 
> > > > match from local for local apply local_users
> > > > match from any for domain  virtual  apply 
> > > > local_users
> > > > match from local sender  for any apply remote_users
> > > 
> > > you need an additonal rule such as:
> > > 
> > > match auth from any sender  for any apply remote_users
> > > 
> > > 
> > > because:
> > > 
> > > > #accept from local sender  for any relay
> > > 
> > > no longer matches authenticated users
> > 
> > Ain't it "action local_users" instead of "apply local_users"? The man
> > page states "action".
> 
> I took the "apply" from here:
> 
>   https://undeadly.org/cgi?action=article;sid=20180430122930
> 
> Now reading this:
> 
>   https://poolp.org/posts/2018-05-21/switching-to-opensmtpd-new-config/
> 
> I see I also have to change the "certificate" keyword to "cert" here:
> 
>   pki $server cert "/etc/ssl/server.crt"
> 
> 
> Gilles, I also saw the "ca" directive.  I've been using the acme
> certificates in pki directives, can I use them in the "ca" directive
> too? (any advantage in doing this?)
> 

don't touch a knob if you don't KNOW that you absolutely need it.

I know why some people would like to use a custom CA certificate instead
of the one shipped with the system, I don't know why YOU should do it so
if you are asking I can only guess you are going to break your setup.


-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: Checking my new smtpd.conf syntax

2018-05-25 Thread Gilles Chehade
On Fri, May 25, 2018 at 09:27:21AM -0400, Amelia A Lewis wrote:
> On Fri, 25 May 2018 16:15:00 +0300, Consus wrote:
> > On 15:14 Fri 25 May, Gilles Chehade wrote:
> >> On Fri, May 25, 2018 at 03:58:59PM +0300, Consus wrote:
> >>> On 14:31 Fri 25 May, Gilles Chehade wrote:
> >>>> 
> >>>> you need an additonal rule such as:
> >>>> 
> >>>> match auth from any sender  for any apply remote_users
> >>>> 
> >>>> because:
> >>>> 
> >>>>> #accept from local sender  for any relay
> >>>> 
> >>>> no longer matches authenticated users
> >>> 
> >>> Ain't it "action local_users" instead of "apply local_users"? The man
> >>> page states "action".
> >> 
> >> oopsie, yes, action, forget about apply, it doesn't exist, I should not
> >> answer mail while talking on the phone :-)
> > 
> > Frankly, I like apply better :(
> 
> For what it's worth (this is *not* a democracy), I like apply better as 
> well. "action" to declare; "apply" to refer. There's then no 
> possibility that someone will attempt to create an action "inline" in a 
> match directive; the syntax of reference is 'keyword barename' while 
> the syntax of declaration is 'keyword uniquename activities'. Different 
> keywords makes it unambiguous for humans; can't use declaration syntax 
> where reference keyword is used.
> 
> I looked at your tests, Gilles, and was hopeful because they all use 
> 'apply'. I found that easier to understand. However ... chances are, if 
> the tests were created early, that others have already argued in favor 
> of using the same keyword for declarations and references.
> 

indeed, but at least your mail made me update the tests :-)

thanks!


-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: Checking my new smtpd.conf syntax

2018-05-25 Thread Gilles Chehade
On Fri, May 25, 2018 at 04:15:00PM +0300, Consus wrote:
> On 15:14 Fri 25 May, Gilles Chehade wrote:
> > On Fri, May 25, 2018 at 03:58:59PM +0300, Consus wrote:
> > > On 14:31 Fri 25 May, Gilles Chehade wrote:
> > > > On Fri, May 25, 2018 at 02:20:50PM +0200, Walter Alejandro Iglesias 
> > > > wrote:
> > > > > Could someone tell me if my changes below are OK. :-)
> > > > > 
> > > > > The part I'm not clear is I read in current.html remote authenticated
> > > > > users need a explicit rule.  Do I need to add some "match auth" rule?
> > > > > 
> > > > 
> > > > yes.
> > > > 
> > > > before, "from local" would match authenticated users as if they had sent
> > > > mail from the local machine but this led to being unable to express some
> > > > setups where depending on the source you want to relay to different hubs
> > > > even though users are authenticated.
> > > > 
> > > > 
> > > > With this:
> > > > 
> > > > > match from local for local apply local_users
> > > > > match from any for domain  virtual  apply 
> > > > > local_users
> > > > > match from local sender  for any apply remote_users
> > > > 
> > > > you need an additonal rule such as:
> > > > 
> > > > match auth from any sender  for any apply remote_users
> > > > 
> > > > 
> > > > because:
> > > > 
> > > > > #accept from local sender  for any relay
> > > > 
> > > > no longer matches authenticated users
> > > 
> > > Ain't it "action local_users" instead of "apply local_users"? The man
> > > page states "action".
> > 
> > oopsie, yes, action, forget about apply, it doesn't exist, I should not
> > answer mail while talking on the phone :-)
> 
> Frankly, I like apply better :(
> 

no matter the keywords, there's no way 100% people would be satisfied :)

be happy, first iteration was "match [...] => foobar", now 'action' does
not look so bad hu ?


-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: Checking my new smtpd.conf syntax

2018-05-25 Thread Gilles Chehade
On Fri, May 25, 2018 at 03:58:59PM +0300, Consus wrote:
> On 14:31 Fri 25 May, Gilles Chehade wrote:
> > On Fri, May 25, 2018 at 02:20:50PM +0200, Walter Alejandro Iglesias wrote:
> > > Could someone tell me if my changes below are OK. :-)
> > > 
> > > The part I'm not clear is I read in current.html remote authenticated
> > > users need a explicit rule.  Do I need to add some "match auth" rule?
> > > 
> > 
> > yes.
> > 
> > before, "from local" would match authenticated users as if they had sent
> > mail from the local machine but this led to being unable to express some
> > setups where depending on the source you want to relay to different hubs
> > even though users are authenticated.
> > 
> > 
> > With this:
> > 
> > > match from local for local apply local_users
> > > match from any for domain  virtual  apply local_users
> > > match from local sender  for any apply remote_users
> > 
> > you need an additonal rule such as:
> > 
> > match auth from any sender  for any apply remote_users
> > 
> > 
> > because:
> > 
> > > #accept from local sender  for any relay
> > 
> > no longer matches authenticated users
> 
> Ain't it "action local_users" instead of "apply local_users"? The man
> page states "action".

oopsie, yes, action, forget about apply, it doesn't exist, I should not
answer mail while talking on the phone :-)


-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: Checking my new smtpd.conf syntax

2018-05-25 Thread Gilles Chehade
On Fri, May 25, 2018 at 02:20:50PM +0200, Walter Alejandro Iglesias wrote:
> Could someone tell me if my changes below are OK. :-)
> 
> The part I'm not clear is I read in current.html remote authenticated
> users need a explicit rule.  Do I need to add some "match auth" rule?
> 

yes.

before, "from local" would match authenticated users as if they had sent
mail from the local machine but this led to being unable to express some
setups where depending on the source you want to relay to different hubs
even though users are authenticated.


With this:

> match from local for local apply local_users
> match from any for domain  virtual  apply local_users
> match from local sender  for any apply remote_users

you need an additonal rule such as:

match auth from any sender  for any apply remote_users


because:

> #accept from local sender  for any relay

no longer matches authenticated users



-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: smtpd.conf new grammar

2018-05-25 Thread Gilles Chehade
On Thu, May 24, 2018 at 04:38:17PM -0400, Rupert Gallagher wrote:
> On Thu, May 24, 2018 at 14:18, Gilles Chehade <gil...@poolp.org> wrote:
> 
> > In effect, instead of having:
> > accept from any for local deliver to mbox
> >
> > You will have:
> > action "my_action" mbox
> > match from any for local action "my_action"
> 
> It may solve some obscure technical problem, but is a horrible thing to read 
> and write. How about keeping the best of both worlds? Leave the old beautiful 
> PF-like syntax to humans, and translate it into the newEgyptian(tm) on the 
> fly?

It doesn't solve "obscure" technical problems, it solves _many_ issues a
lot of users have reported ranging from syntax ambiguity to envelopes on
disk not reflecting changes in configuration. One-line rules have lot of
consequences which go far beyond the configuration phase: the structures
are impacted, the ruleset evaluation is impacted, the aliases expansions
are impacted, the queue is impacted, format of envelopes are impacted, I
could go on and on since this impacts almost the entire daemon actually.


The impact is not just cosmethic stuff. I removed _hundreds_ of lines of
very unnecessary and complex code that was ONLY there to make the design
error work. Some of these removals led to concrete security improvements
like .forward files, written by untrusted users, be processed with their
privileges rather than _smtpd. Not doable with one-line rules.


I could write pages about the shortcomings from the previous config, and
pages about why it can't be made to work and why the new config fixes it
in the proper way. We tried hard to find ways to retain a one-line rules
configuration but after months we exhausted the ideas and we have a much
clearer understanding that it's NOT doable. Either we accept that, or we
are just going to grow more complex and slowly stop writing code because
every time you touch an area there's a risk you run into the complexity.


You don't have to trust my word:

> How about keeping the best of both worlds? Leave the old beautiful PF-like 
> syntax to humans,
> and translate it into the newEgyptian(tm) on the fly?

If this was possible, then you could easily write a translator that will
convert old grammar to new one without removing all the benefits and not
reintroducing the complex code.

By all means, show me, I'd be impressed for real.

-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



smtpd.conf new grammar

2018-05-24 Thread Gilles Chehade
Hi,

I have just committed a major change in smtpd that'll require smtpd.conf
to be rewritten before your update to the new code.

The new grammar is not TOO different from the former one, a lot of stuff
remains exactly identical, but the ruleset is now split into two parts:

- a named action
- a matching pattern which is associated to a named action

In effect, instead of having:

accept from any for local deliver to mbox


You will have:

action "my_action" mbox

match from any for local action "my_action"


There are a few keywords that have been shortened too but all in all the
switch to new grammar is easy, the smtpd.conf man page has been updated,
and it continues being improved thanks to ingo and jmc.

The man page by itself should be enough to do the switch.

Since this is quite a major change, I also wrote a post that describes a
conversion of my own complex smtpd.conf to new grammar:

https://poolp.org/posts/2018-05-21/switching-to-opensmtpd-new-config/


I have also compiled a list of directives recognized by the parser which
I intend to use for regress tests:

    https://poolp.org/~gilles/smtpd.conf


As for the reasons behind the change they are numerous, I explained some
at EuroBSDCon 2017, I explained some on my blog, the bottom line is that
while one-line rules were apparently an awesome idea, they were actually
a design error that had consequences on pretty much the entire daemon.

We didn't realize it until a few months ago, we tried hard to maintain a
one-line rule grammar but it became more and more obvious that this just
isn't doable without creating issues and unnecessary complexity.

The new grammar is cleaner, it helped remove ~700 lines of complex code,
made the handling of .forward files as well much safer, removed a lot of
very unpleasant side-effects most people didn't even realize existed ...
until they hit that one case for which we had no way to work around.


Anyways,
looking forward for you to test and report how it works for you :-)


-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: opensmtpd / ldap unreliable

2018-05-23 Thread Gilles Chehade
On Wed, May 23, 2018 at 10:19:47PM +0200, Gilles Chehade wrote:
> On Tue, May 22, 2018 at 06:13:23PM -0700, Paul B. Henson wrote:
> > So I recently converted my opensmtpd server to use ldap as the backend
> > for user authentication. It seems it's a bit untolerant to ldap issues?
> >
> > [...]
> > 

Just to clarify, the "extras" are add-ons which we believe not to belong
in the smtpd code base, so the amount of efforts we pour on them is very
dependant on the interest of developers and the interest the community's
showing for the add-on, it's a community and volunteer driven effort.

None of the add-ons are part of the opensmtpd roadmap, some became quite
popular like table-sqlite or table-passwd and are well maintained, other
have very few users who aren't pushing much for improvement, so the code
doesn't evolve much and/or we are not aware of shortcomings.

If you want proper ldap support, become active and it will happen :-)x


-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: opensmtpd / ldap unreliable

2018-05-23 Thread Gilles Chehade
On Tue, May 22, 2018 at 06:13:23PM -0700, Paul B. Henson wrote:
> So I recently converted my opensmtpd server to use ldap as the backend
> for user authentication. It seems it's a bit untolerant to ldap issues?
> 

yes most likely


If the ldap server isn't available when opensmtpd is started, it says it
> started:
> 
> # /etc/rc.d/smtpd start
> smtpd(ok)
> 
> But it isn't there:
> 
> # ps -aux | grep smtpd
> root 89090  0.0  0.0   304  1208 p6  S+p5:52PM0:00.00 grep smtpd
> 
> And it's not really obvious why:
> 
> May 22 17:52:51 bart smtpd[46044]: info: OpenSMTPD 6.0.4 starting
> May 22 17:52:51 bart smtpd[23325]: warn: table-proc: pipe closed
> May 22 17:52:51 bart smtpd[23325]: lookup: table-proc: exiting
> May 22 17:52:51 bart smtpd[73239]: smtpd: process lka socket closed
> 

not good


> Starting in debug mode:
> 
> # smtpd -d
> info: OpenSMTPD 6.0.4 starting
> users[43283]: debug: reading key "url" -> "ldap://localhost:3389;
> users[43283]: debug: reading key "basedn" ->
> users[43283]: debug: reading key "username" ->
> users[43283]: debug: reading key "password" ->
> users[43283]: debug: reading key "credentials_filter" -> 
> "(&(objectClass=uidObject)(uid=%s))"
> users[43283]: debug: parsing attribute "credentials_attributes" (2) -> 
> "uid,description"
> users[43283]: debug: done reading config
> users[43283]: warn: aldap_parse
> users[43283]: fatal: failed to connect
> warn: table-proc: pipe closed
> lookup: table-proc: exiting
> smtpd: process lka socket closed
> 
> You can see it looks like it fails to connect to the ldap server at
> startup and just dies.
> 
> Further, if the ldap server is up at startup, but ever restarts or has
> the connection broken, authentication just fails:
> 
> May 21 13:22:10 bart smtpd[42132]: warn: user credentials lookup fail for 
> users:henson
> 
> The opensmtpd process needs to be restarted before authentication works
> again.
> 

not good


> In debug mode, it shows:
> 
> users[7295]: debug: table_ldap: ldap_query:
> filter=(&(objectClass=uidObject)(uid=henson)), ret=0
> 5e46e2fabbf8d72e smtp event=authentication user=henson
> address=134.71.249.41 host=134.71.249.41 result=permfail
> 
> Is it expected that the ldap support is currently not production ready?
> I see in a presentation from back in 2013 that ldap was classified
> experimental at the time, but it's not clear if that's still the case.
> 

Yes, sadly

I wrote the initial ldap support but I don't use ldap myself and I could
not get any user to spend time with me testing related diffs more than a
couple times, so...


> I see in the repo at
> 
> https://github.com/OpenSMTPD/OpenSMTPD-extras/blob/master/extras/tables/table-ldap/table_ldap.c
> 
> there's a change to add ldap reconnection support:
> 
> https://github.com/OpenSMTPD/OpenSMTPD-extras/commit/04e4c521b34d1987af915ff97dcb0d87daf122b0#diff-369c0fcbfbc85bf2cdad7dba1131b872
> 
> but it's dated 7/27/2017, and the last github release seems to be
> 201601072302 (although the openbsd port appears to be 201703132115, I
> guess it's not downloading it from github?).
> 

It's been a while since the last -extras release indeed,
I suppose the openbsd port pulls from github, I dunno really


> It looks like the code in head still fails to start if the ldap server
> isn't available when opensmtpd is started though.
> 

That's bad but could easily be fixed if you want to help us


> Is anybody using opensmtpd with ldap in production? If so, how are you
> working around this issue?
> 

That would be a bad idea... it's experimental :-p



-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: SMTP client added to -current

2018-05-10 Thread Gilles Chehade
On Thu, May 10, 2018 at 10:18:32AM -0400, Predrag Punosevac wrote:
> 
> I was wondering if somebody could give me some insight into how is the
> new SMTP client related to OpenSMTPD?
>

Eric wrote code to simplify the SMTP client engine in OpenSMTPD and help
with the cleanup I mentionned at EuroBSDCon'17.

His code happens to be standalone enough that he wrote an SMTP client on
top of it so we have a proper tool to perform SMTP sessions because that
is a recurring need and we kept using shitty scripts or manual sessions.
I'm not only talking as a developer here but as a mail admin too.

The SMTP client code he wrote is going to be what OpenSMTPD uses in some
months to replace our ageing SMTP client layer.

He did not write a tool, he wrote an SMTP engine THEN he wrote a tool on
top of it and committed both the engine and the tool.


> I would think one could create a
> "new" SMTP client by a straight forward surgery on OpenSMTPD.
>

Yes, that's doable.

Except that the code he would have surgically extracted is the code that
will soon get replaced with the code he committed.


> How does the new SMTP client compare to DragonFly Mail Agent (dma)?
>

The new SMTP client is a simple tool to perform an SMTP session and does
nothing more than that. If a use-case involves doing an SMTP session AND
something else, the tool became the wrong tool at AND.

I'm not familiar at all with dma but I assume it does a bit more.


> As most
> machines these days just need to send an e-mail to the relaying SMTP
> server are there plans to make new SMTP client default instead of full
> blown OpenSMTPD.
>

That is doubtful.

I do not think most machines just need to send an e-mail to the relaying
SMTP server, most machines would also need the mail to be retried if the
server is unreachable, sender to be notified if the mail ttl is reached,
handle local aliases, .forward, etc... it goes FAR beyond that tool.

Now I may be biased but I think a "full blown" OpenSMTPD does not have a
huge overhead given how we fought feature creep. I don't think you would
have a much simpler code path if you used OpenSMTPD or added server code
in front of this new SMTP client to allow enqueuing.


-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: OpenSMTPd maillist "compatible" manager Majordomo or what?

2018-03-21 Thread Gilles Chehade
On Tue, Mar 20, 2018 at 10:38:43AM +, Craig Skinner wrote:
> Hi Denis,
> 
> The OpenSMTPd mailing lists are mlmmj powered.
> 
> http://www.OpenSMTPd.Org/list.html
> 
> Join OpenSMTPd's misc@ list and ask OpenSMTPd questions there.
> 

mlmmj is a nice choice because it's simple and you can easily set it up
from within a ~/.forward file rather than /etc/mail/aliases which has a
huge security benefit.

-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: smtpd fails to start

2018-01-23 Thread Gilles Chehade
I will remember that promise.

On Tue, Jan 23, 2018 at 01:37:37AM -0800, Jordan Geoghegan wrote:
> Thank you Gilles! I knew it was going to be something irritatingly obvious.
> I owe you a beer.
> 
> Cheers,
> 
> Jordan Geoghegan
> 
> 
> # pkg_add opensmtpd-extras
> quirks-2.367 signed on 2017-10-03T11:21:28Z
> opensmtpd-extras-2017031321...:gettext-0.19.8.1p1: ok
> opensmtpd-extras-2017031321...:libffi-3.2.1p2: ok
> opensmtpd-extras-2017031321...:python-2.7.14: ok
> opensmtpd-extras-201703132115p1: ok
> --- +python-2.7.14 ---
> If you want to use this package as your default system python, as root
> create symbolic links like so (overwriting any previous default):
>  ln -sf /usr/local/bin/python2.7 /usr/local/bin/python
>  ln -sf /usr/local/bin/python2.7-2to3 /usr/local/bin/2to3
>  ln -sf /usr/local/bin/python2.7-config /usr/local/bin/python-config
>  ln -sf /usr/local/bin/pydoc2.7  /usr/local/bin/pydoc
> # rcctl restart smtpd
> smtpd(ok)
> #
> 
> 
> On 01/23/18 01:31, Gilles Chehade wrote:
> > On Tue, Jan 23, 2018 at 01:21:22AM -0800, Jordan Geoghegan wrote:
> > > Hi Gilles,
> > > 
> > > The output of the command you sent:
> > > 
> > > # smtpd -dv
> > > smtpd: table_create: backend "passwd" does not exist
> > > 
> > > I'm not sure what this means, as /etc/mail/passwd does indeed exist.
> > > 
> > > Thanks for the fast response!
> > > 
> > you need to install the opensmtpd-extras package from ports to use
> > the table-passwd add-on
> > 
> > 
> > 
> 

-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: smtpd fails to start

2018-01-23 Thread Gilles Chehade
On Tue, Jan 23, 2018 at 01:21:22AM -0800, Jordan Geoghegan wrote:
> Hi Gilles,
> 
> The output of the command you sent:
> 
> # smtpd -dv
> smtpd: table_create: backend "passwd" does not exist
> 
> I'm not sure what this means, as /etc/mail/passwd does indeed exist.
> 
> Thanks for the fast response!
> 

you need to install the opensmtpd-extras package from ports to use
the table-passwd add-on



-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: smtpd fails to start

2018-01-22 Thread Gilles Chehade
you almost managed to give enough information to troubleshoot...

... except for logs displaying the problem :-)

`smtpd -dv` will provide useful information

On Mon, Jan 22, 2018 at 11:40:48PM -0800, Jordan Geoghegan wrote:
> Hi all,
> 
> I was hoping someone could point me in the right direction here. I cannot
> for the life of me get smptd to start. It always fails when running # rcctl
> restart smtpd, or when stopping and starting separately.
> 
>  I've been looking to move to OpenSMTP for my mail needs, so I can get my
> family and I's mail out of the cloud (yuck). The end goal is to set up a
> basic IMAP mail server enabling my family to easily connect from their
> various devices. I've been attempting to follow this guide on the OpenSMTP
> website: https://www.opensmtpd.org/faq/example1.html
> 
> I have of course RTFM, and I have also tried guides such as this, to no
> avail:
> 
> https://frozen-geek.net/openbsd-email-server-1/
> 
> http://technoquarter.blogspot.ca/
> <https://frozen-geek.net/openbsd-email-server-1/>
> 
> 
> I feel as if I'm missing something obvious here.
> 
> My config/steps taken are listed below. I have tried this on both i386 bare
> metal and on amd64 VM using vmm. Please let me know if a dmesg would be
> helpful. The logs show nothing as to why its failing. Any help would be much
> appreciated.
> 
> Cheers,
> 
> Jordan Geoghegan
> 
> *My smtpd.conf is as follows (scrubbed of personal info):*
> 
> # pki setup
> pki mail.mydomain.ca certificate "/etc/ssl/mail.mydomain.ca.crt"
> pki mail.mydomain.ca key "/etc/ssl/private/mail.mydomain.ca.key"
> 
> # tables setup
> table aliases file:/etc/mail/aliases
> table domains file:/etc/mail/domains
> table passwd passwd:/etc/mail/passwd
> table virtuals file:/etc/mail/virtuals
> 
> # listen ports setup
> listen on lo0
> listen on egress port 25 tls pki mail.mydomain.ca
> listen on egress port 587 tls-require pki mail.mydomain.ca auth 
> 
> 
> # allow local messages
> accept from local for local alias  deliver to lmtp 
> "/var/dovecot/lmtp" rcpt-to
> # allow virtual domains
> accept from any for domain  virtual  deliver to lmtp 
> "/var/dovecot/lmtp" rcpt-to
> # allow outgoing mails
> accept from local for any relay
> 
> *SSL keys and self signed certs were generated as per man smtpd.conf(5):*
> 
> # openssl genrsa -out /etc/ssl/private/mail.mydomain.ca key 4096
># openssl req -new -x509 -key 
> /etc/ssl/private/mail.mydomain.ca.key \
>-out /etc/ssl/mail.mydomain.ca.crt -days 365
># chmod 600 /etc/ssl/mail.mydomain.ca.crt
># chmod 600 /etc/ssl/private/mail.mydomain.ca.key
> 
> 
> *I then fill out my /etc/mail/aliases*
> 
> vmail:/dev/null
> root: jordan
> jordan:   jor...@mydomain.ca
> 
> 
> *and fill /etc/mail/domains with my domain info*
> 
> mydomain.ca
> mydomain.com
> myotherdomain.ca
> myotherdomain.com
> 
> (there's no change if just one or multiple domains listed)
> 
> *And the /etc/mail/passwd info is generated using $ smtpctl encrypt (am
> I supposed to be using my actual system login password here? I did just to
> be sure)***
> jor...@mydomain.ca:$2b$...encrypted...password...::
> 
> *My /etc/mail/virtuals looks like: *
> ab...@mydomain.ca jor...@mydomain.ca
> postmas...@mydomain.cajor...@mydomain.ca
> webmas...@mydomain.ca jor...@mydomain.ca
> jor...@mydomain.cavmail
> 
> 
> *Dovecot starts without complaint with this config:*
> 
> 
> passdb {
> args = scheme=blf-crypt /etc/mail/passwd
> driver = passwd-file
> }
> 
> userdb {
> args = uid=vmail gid=vmail home=/var/vmail/%d/%n
> driver = static
> }
> service imap-login {
>   inet_listener imap {
> address = *
> port = 143
>   }
>   inet_listener imaps {
> address = *
> port = 993
>   }
> }
> ~
> 
> 

-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: Does OpenSMTPD support accented characters in email addresses?

2017-12-21 Thread Gilles Chehade
On Mon, Dec 18, 2017 at 01:59:24PM -0700, LD wrote:
> Trying to send accented characters using OpenBSD's (v5.9) email server I get
> a "501 5.1.3: Recipient address syntax error" because the local part of the
> address has an "??" ("e" with an acute accent) in the name. Does OpenSMTPD
> support these characters? How can I enable this on my server?
> 
> At the EHLO prompt I get:
> 250-server_name.example.com Hello test.me [127.0.0.1], pleased to meet you
> 250-8BITMIME
> 250-ENHANCEDSTATUSCODES
> 250-SIZE 36700160
> 250-DSN
> 250 HELP
> 
> I think I should see a "SMTPUTF8" extension in this list. Is that correct?
> 

smtpd doesn't support SMTPUTF8 yet, correct.


-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: [PATCH] Off-by-one bug in httpd, ldapd, relayd, smtpd, switchd and ypldap

2017-08-21 Thread Gilles Chehade
On Sat, Aug 19, 2017 at 04:20:31PM -0500, Kris Katterjohn wrote:
> On Fri, Aug 18, 2017 at 09:24:33AM -0700, Chris Cappuccio wrote:
> > This looks correct. Also, there's more:
> 
> Thanks for looking and catching what I missed.  It hit me a while after
> I sent my original email that relayd likely has the same bug.  D'oh.
> 
> Here is an updated patch for httpd, ldapd, relayd, smtpd, switchd and
> ypldap, which all seem to have the off-by-one bug for port number
> checking (where 65535 is unusable and called invalid, at least when
> specifying it as a number).  Again, I cannot build and actually test
> this right now.
> 
> Cheers,
> Kris Katterjohn
> 

ok gilles@

chris, are you taking care of committing this ?


> Index: usr.sbin/httpd/parse.y
> ===
> RCS file: /cvs/src/usr.sbin/httpd/parse.y,v
> retrieving revision 1.91
> diff -u -p -r1.91 parse.y
> --- usr.sbin/httpd/parse.y11 Aug 2017 18:48:56 -  1.91
> +++ usr.sbin/httpd/parse.y19 Aug 2017 20:15:31 -
> @@ -1118,7 +1118,7 @@ medianamesl : numberstring  
> {
>   ;
>  
>  port : PORT NUMBER {
> - if ($2 <= 0 || $2 >= (int)USHRT_MAX) {
> + if ($2 <= 0 || $2 > (int)USHRT_MAX) {
>   yyerror("invalid port: %lld", $2);
>   YYERROR;
>   }
> Index: usr.sbin/ldapd/parse.y
> ===
> RCS file: /cvs/src/usr.sbin/ldapd/parse.y,v
> retrieving revision 1.24
> diff -u -p -r1.24 parse.y
> --- usr.sbin/ldapd/parse.y6 Apr 2017 12:22:32 -   1.24
> +++ usr.sbin/ldapd/parse.y19 Aug 2017 20:15:31 -
> @@ -161,7 +161,7 @@ port  : PORT STRING   {
>   free($2);
>   }
>   | PORT NUMBER   {
> - if ($2 <= 0 || $2 >= (int)USHRT_MAX) {
> + if ($2 <= 0 || $2 > (int)USHRT_MAX) {
>   yyerror("invalid port: %lld", $2);
>   YYERROR;
>   }
> Index: usr.sbin/relayd/parse.y
> ===
> RCS file: /cvs/src/usr.sbin/relayd/parse.y,v
> retrieving revision 1.215
> diff -u -p -r1.215 parse.y
> --- usr.sbin/relayd/parse.y   27 May 2017 08:33:25 -  1.215
> +++ usr.sbin/relayd/parse.y   19 Aug 2017 20:15:32 -
> @@ -338,7 +338,7 @@ port  : PORT STRING {
>   free($2);
>   }
>   | PORT NUMBER {
> - if ($2 <= 0 || $2 >= (int)USHRT_MAX) {
> + if ($2 <= 0 || $2 > (int)USHRT_MAX) {
>   yyerror("invalid port: %d", $2);
>   YYERROR;
>   }
> Index: usr.sbin/smtpd/parse.y
> ===
> RCS file: /cvs/src/usr.sbin/smtpd/parse.y,v
> retrieving revision 1.197
> diff -u -p -r1.197 parse.y
> --- usr.sbin/smtpd/parse.y11 Jul 2017 06:08:40 -  1.197
> +++ usr.sbin/smtpd/parse.y19 Aug 2017 20:15:33 -
> @@ -480,7 +480,7 @@ opt_if_listen : INET4 {
>   }
>   listen_opts.options |= LO_PORT;
>  
> - if ($2 <= 0 || $2 >= (int)USHRT_MAX) {
> + if ($2 <= 0 || $2 > (int)USHRT_MAX) {
>   yyerror("invalid port: %" PRId64, $2);
>   YYERROR;
>   }
> Index: usr.sbin/switchd/parse.y
> ===
> RCS file: /cvs/src/usr.sbin/switchd/parse.y,v
> retrieving revision 1.5
> diff -u -p -r1.5 parse.y
> --- usr.sbin/switchd/parse.y  6 Aug 2017 17:31:19 -   1.5
> +++ usr.sbin/switchd/parse.y  19 Aug 2017 20:15:33 -
> @@ -144,7 +144,7 @@ listen: LISTEN ON STRING opttls port {
>   ;
>  
>  port : PORT NUMBER {
> - if ($2 <= 0 || $2 >= (int)USHRT_MAX) {
> + if ($2 <= 0 || $2 > (int)USHRT_MAX) {
>   yyerror("invalid port: %lld", $2);
>   YYERROR;
>   }
> Index: usr.sbin/ypldap/parse.y
> ===
> RCS file: /cvs/src/usr.sbin/ypldap/parse.y,v
> retrieving revision 1.

Re: Mastering opensmtpd rules

2017-08-15 Thread Gilles Chehade
On Tue, Aug 15, 2017 at 01:29:16PM +0200, Walter Alejandro Iglesias wrote:
> > 
> >   accept from any for any virtual  [...]
> > 
> 
> Besides, after modifying that rule in the file I also had to change the
> order.  Since rules below the "catch-all" one never get evaluated, it
> has forcibly to be the last one:
> 
>[...]
>accept from local for local alias  deliver to mbox
>accept from local sender  for any relay
>accept from any for any virtual  deliver to mbox
># End of file
> 

Not a truth written in stone but, usually, having the "from any for any"
rule in a config file is a sign that user failed to write ruleset and is
using this as a fallback. The earliest the rules match the envelope, the
better, as it indicates that the rule was written to match precisely.

Most rulesets should finish with a relay (via?) rule from local for any.


-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: Mastering opensmtpd rules

2017-08-15 Thread Gilles Chehade
On Tue, Aug 15, 2017 at 09:22:41AM +0200, Walter Alejandro Iglesias wrote:
> Hello everyone,
> 
> I'd appreciate experienced opensmtpd users tell me if I'm understanding
> well the mechanism in the following rule.
> 
> Currently, in my smtpd.conf I have this line:
> 
>   accept from any for domain  virtual  deliver to mbox
> 
> But since all keys in my "valiases" table are full email addresses, in
> the form:
> 
>   u...@example.orguser
> 
> I'm thinking the use of "vdomains" table is redundant.  I could safely
> simplify the rule to:
> 
>   accept from any for any virtual  deliver to mbox
> 
> 
> Am I wrong in this assumption?
>

kind of, smtpd.conf being a first match ruleset it is impossible to make
this kind of analysis without having your other rules too.

in this case, this may or may not give the desired behavior depending on
rules following it because envelope matching happens _before_ virtual is
even evaluated.

with:

accept from any for domain  [...]

you will only match envelopes for the domains in , it allows a
different rule to match other domains:

accept from any for domain  [...]
accept from any for domain foobar.org [...]

with:

accept from any for any [...]

you will match all envelopes so you're essentially creating a catch-all.


virtual happens AFTER a rule has been matched so if you recipient is not
found the RCPT will be rejected, smtpd will not search for another rule.


-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: multiple relays in smtpd.conf

2017-08-02 Thread Gilles Chehade
On Wed, Aug 02, 2017 at 02:47:27PM +0200, Christian Gut wrote:
> 
> > On 2.Aug. 2017, at 14:09, Gilles Chehade <gil...@poolp.org> wrote:
> > 
> > On Wed, Aug 02, 2017 at 01:47:09PM +0200, Kirill Miazine wrote:
> >> * Eric Faurot [2017-08-02 13:24]:
> >>> On Wed, Aug 02, 2017 at 11:44:47AM +0200, Christian Gut wrote:
> >>>> Hi List,
> >>>> 
> >>>> is it possible to have multiple relays (you might want to say smart 
> >>>> hosts) in smtpd?
> >>>> 
> >>>> I currently use the following line:
> >>>> 
> >>>> accept from local for any relay via smarthost.example.org 
> >>>> <http://smarthost.example.org/>
> >>>> 
> >>>> Now I would like to have multiple smart hosts in there for backup 
> >>>> reasons, if one of the smart hosts is in maintainance. Is something like 
> >>>> this possible?
> >>>> 
> >>>> accept from local for any relay via { smarthost1.example.org 
> >>>> <http://smarthost1.example.org/>, smarthost2.example.org 
> >>>> <http://smarthost2.example.org/> }
> >>>> 
> >>>> Kind Regards,
> >>>> Christian
> >>>> 
> >>> It's not possible at the moment.  There is ongoing work to support this 
> >>> feature,
> >>> along with other improvements. But it's quite a big change, and we can't 
> >>> give an
> >>> ETA right now.
> >> 
> >> what about defining a new name in DNS containing addresses of all
> >> smarthosts as a workaround for the OP for now?
> >> 
> > 
> > This can work in some use-cases, this is exactly what a co-worker did to
> > work around the limitation.
> 
> How will smtpd operate then? Does it use the DNS records in a round robin 
> fashion or does it try them one after another if they fail?
> 

smtpd maintains states about its routes to a destination.

what will happen is that it will resolve your relay hostname into all of
its addresses and attempts to route to them. if a route is broken, it is
marked as such for a small period and reattempted later, meanwhile there
will be routes that aren't marked as broken and which smtpd will be able
to use.


-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: multiple relays in smtpd.conf

2017-08-02 Thread Gilles Chehade
On Wed, Aug 02, 2017 at 01:47:09PM +0200, Kirill Miazine wrote:
> * Eric Faurot [2017-08-02 13:24]:
> > On Wed, Aug 02, 2017 at 11:44:47AM +0200, Christian Gut wrote:
> >> Hi List,
> >>
> >> is it possible to have multiple relays (you might want to say smart hosts) 
> >> in smtpd?
> >>
> >> I currently use the following line:
> >>
> >> accept from local for any relay via smarthost.example.org 
> >> <http://smarthost.example.org/>
> >>
> >> Now I would like to have multiple smart hosts in there for backup reasons, 
> >> if one of the smart hosts is in maintainance. Is something like this 
> >> possible?
> >>
> >> accept from local for any relay via { smarthost1.example.org 
> >> <http://smarthost1.example.org/>, smarthost2.example.org 
> >> <http://smarthost2.example.org/> }
> >>
> >> Kind Regards,
> >> Christian
> >>
> > It's not possible at the moment.  There is ongoing work to support this 
> > feature,
> > along with other improvements. But it's quite a big change, and we can't 
> > give an
> > ETA right now.
> 
> what about defining a new name in DNS containing addresses of all
> smarthosts as a workaround for the OP for now?
> 

This can work in some use-cases, this is exactly what a co-worker did to
work around the limitation.


-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: multiple relays in smtpd.conf

2017-08-02 Thread Gilles Chehade
On Wed, Aug 02, 2017 at 11:44:47AM +0200, Christian Gut wrote:
> Hi List,
> 
> is it possible to have multiple relays (you might want to say smart hosts) in 
> smtpd?
> 
> I currently use the following line:
> 
> accept from local for any relay via smarthost.example.org 
> <http://smarthost.example.org/>
> 
> Now I would like to have multiple smart hosts in there for backup reasons, if 
> one of the smart hosts is in maintainance. Is something like this possible?
> 
> accept from local for any relay via { smarthost1.example.org 
> <http://smarthost1.example.org/>, smarthost2.example.org 
> <http://smarthost2.example.org/> }
> 

Hi,

Unfortunately it's not possible as of today.

I'm currently working on making this possible, like I was actually doing
work for that yesterday, but it's not as easy as it looks like and there
is no chance it can make it before 6.3

I have a big interest in this working so this is among my top prio work.

Gilles

-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: smtpd vs. uw-imap locking

2017-07-31 Thread Gilles Chehade
On Sun, Jul 30, 2017 at 07:47:15PM -0400, gwes wrote:
> smtpd locks user mailboxes in /var/mail using lockspool(1)
> uw-imapd locks using its own dotfile locker mlock(not the syscall)
> 

Actually, it is mail.local that does the locking, smtpd knows nothing at
all regarding /var/mail as it is an MDA thing.

mailbox locking is complex to be done right with all the NFS horror, and
mail.local, which was already used with Sendmail, solved issue for us so
we decided not to introduce unnecessary bugs :-)


> Before I go into uw-imapd and do some nasty additions and
> if()s:
> does anyone else care?
> does anyone else use uw-imap?
> has anyone attacked this problem?
> is there anywhere else to ask these questions?
> 
> switch(answers) {
> *, *, *, yes: go there
> no, *, *, no: go do ugly coding in the dark
> *, *, yes, *: may I please see what you did?
> yes, yes, no, *: please get in touch
> default: go do ugly coding
> }
> 
> I'm not interested in any other server unless it is
> at least as lightweight as uw-imap. Courier, Cyrus,
> etc. are obese by comparison.
> 

To be honest, after having used wu-imapd and courier, I'd give Dovecot a
go if only because of privileges separation and a more modern design for
such an exposed target.

Also, mbox is really a left-over from the past and unless you are forced
to use it, switching to maildir has many advantages ranging from being a
lock-less delivery method to being easier to manage as an admin.

That being said: no, no, no, * because I'm curious.

-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: Happy birthday Theo!

2017-05-26 Thread Gilles Chehade
On Thu, May 25, 2017 at 04:20:37PM -0700,  sharon s. wrote:
> At some point.. birthdays stop being happy. only speaking from
> experience.. :)
> 

that reads like an early stage of depression ?

you may want to M-x doctor ;-)

-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: smtpd aliases file issue

2017-05-11 Thread Gilles Chehade
Much better :-)

You don’t need to restart the daemon, you simply need to tell it through 
smtpctl that the table aliases needs to be reloaded:

$ doas smtpctl update table aliases

Gilles


> On 11 May 2017, at 08:17, Ajitabh Pandey <ajitabhpan...@gmail.com> wrote:
> 
> Hi Gilles,
> 
> I did not change anything from the default. But I realise all may not be
> using default file like me and may not know what is in it. Here is a copy
> of the contents just for reference. The problem is solved by restarting the
> smtpd as sugested by Edgar.
> 
> $ doas cat /etc/mail/smtpd.conf
> 
> table aliases file:/etc/mail/aliases
> listen on lo0
> accept for local alias  deliver to mbox
> accept from local for any relay
> 
> Regards.
> -- 
> ~ajitabhpandey
> 
> On Wed, May 10, 2017 at 5:25 PM, Gilles Chehade <gil...@poolp.org> wrote:
> 
>> On Wed, May 10, 2017 at 04:32:55PM +0530, Ajitabh Pandey wrote:
>>> 
>>> If my understanding about how this should work incorrect? If not then
>> what
>>> am I doing wrong?
>>> 
>> 
>> What you are doing wrong is not showing your configuration file so we're
>> able to check if it does what you think it is doing
>> 
>> 
>> --
>> Gilles Chehade
>> 
>> https://www.poolp.org  @poolpOrg
>> 
> 
> 
> 
> -- 
> Ajitabh Pandey
> http://ajitabhpandey.info/ | http://unixclinic.net/ |
> http://buddingthoughts.info
> ICQ - 150615062
> Registered Linux User - 240748



Re: smtpd aliases file issue

2017-05-11 Thread Gilles Chehade
Obviously you don’t need to restart the daemon to pickup new aliases.

If you are using a plain file aliases map it can be reloaded atomically at 
runtime using smtpctl.
If you are using a db file, it can be rebuilt using the newaliases / makemap 
utility.

I can’t tell you which one to use because you still didn’t show your config,
but just for documentation purpose: you’re not doing it right.

Gilles


> On 11 May 2017, at 08:13, Ajitabh Pandey <ajitabhpan...@gmail.com> wrote:
> 
> Thanks Edgar. That worked. This is what I was missing.
> 
> I actually removed my .forward from the user01 account now and directly
> updated the aliases file to forward email to external email address.
> 
> Just for documentation purpose, here are the steps -
> 
> $ doas vi /etc/mail/aliases file
> $ doas newaliases
> $ doas rcctl restart smtpd
> 
> Regards.
> -- 
> ~ajitabhpandey
> 
> On Wed, May 10, 2017 at 4:58 PM, Edgar Pettijohn <ed...@pettijohn-web.com 
> <mailto:ed...@pettijohn-web.com>>
> wrote:
> 
>> Did you restart smtpd?
>> 
>> Sent from BlueMail <http://www.bluemail.me/r?b=9531 
>> <http://www.bluemail.me/r?b=9531>>
>> On May 10, 2017, at 6:03 AM, Ajitabh Pandey <ajitabhpan...@gmail.com 
>> <mailto:ajitabhpan...@gmail.com>>
>> wrote:
>>> 
>>> Hello,
>>> 
>>> On an OpenBSD 6.1, I have default smtpd setup.
>>> 
>>> I placed a .forward file in root's home and am able to receive the emails
>>> on an external address.
>>> 
>>> I then removed the .forward from root's home and then placed a .forward in
>>> the home directory of normal user account (say user01). Emails directly
>>> send to user01 are being forwarded to external email address as expected.
>>> 
>>> Next I edited the /etc/mail/aliases file and uncomment the line with root's
>>> name in it and placed an entry like -
>>> 
>>> root: user01
>>> 
>>> After saving the file, I ran newaliases to generate /etc/mail/aliases.db
>>> file.
>>> 
>>> This should forward all email's destined for root to user01 and
>>> consequently to external email address as user01's home has a .forward file
>>> in it.
>>> 
>>> This is not happening. Any email sent to root is being delivered to the
>>> mailbox of root and the smtpd logs in /var/log/maillog confirmed the same.
>>> 
>>> If my understanding about how this should work incorrect? If not then what
>>> am I doing wrong?
>>> 
>>> Thanks and Regards.
>>> 
>>> 
> 
> 
> -- 
> Ajitabh Pandey
> http://ajitabhpandey.info/ <http://ajitabhpandey.info/> | 
> http://unixclinic.net/ <http://unixclinic.net/> |
> http://buddingthoughts.info <http://buddingthoughts.info/>
> ICQ - 150615062
> Registered Linux User - 240748



Re: smtpd aliases file issue

2017-05-10 Thread Gilles Chehade
On Wed, May 10, 2017 at 04:32:55PM +0530, Ajitabh Pandey wrote:
> 
> If my understanding about how this should work incorrect? If not then what
> am I doing wrong?
> 

What you are doing wrong is not showing your configuration file so we're
able to check if it does what you think it is doing


-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: smtpd log: certificate verification failed

2017-04-20 Thread Gilles Chehade
On Thu, Apr 20, 2017 at 02:59:10PM +0200, Walter Alejandro Iglesias wrote:
> Hello everyone,
> 
> Just to be sure, when I get this message:
> 
> maillog:Apr 20 13:53:03 server smtpd[99586]: smtp-out: Server certificate 
> verification failed on session 81c5fc1509d4c884
> 
> Is it about my server cert or the remote one?
> 

remote one, it means that when trying to verify the certificate that was
presented by the remote server, the verification failed


-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: OpenSMTPD "syntax error" and other problems

2017-01-16 Thread Gilles Chehade
On Mon, Jan 16, 2017 at 09:36:10AM -0500, aretes27...@mypacks.net wrote:
> The "smtpd.conf" man page states:
> 
> relay [backup [mx]] [as address] ...
> ...
> If the as parameter is specified, smtpd(8) will rewrite the sender advertised
> in the SMTP session. address may be a user, a domain prefixed with ???@???, or
> an email address, causing smtpd(8) to rewrite the user-part, the domain-part,
> or the entire address, respectively.
> ...
> 
> I tried this:
> 
> relay as "@my-domain.com"
> 
> But I get a "syntax error"?
> 

Yes, keep reading this mail and find your error at the bottom of it.


> MS Outlook users get "550 Invalid recipient" errors when trying to send mail
> outside of our domain. The mail log entries are like:
>
> Jan 16 07:36:28 myserver smtpd[70549]: b76cb7a2aa7f61b8 smtp
> event=failed-command command="RCPT TO: <some.b...@somewhere.com>" result="550
> Invalid recipient"
>
> Using the command "mail" to compose a message and send it works.
> 

This probably means a configuration issue but you didn't provide
enough log context to figure it out.

I'll take a wild guess:

You're connecting over SMTP and the ruleset considers your client
as a non-local one which ...


> My "smtp.conf" is:
> 
> listen on all
> pki mail.example.com certificate "/etc/ssl/my-domain.com.crt"
> pki mail.example.com key "/etc/ssl/my-domain.com.key"
> 
> table aliases file:/etc/mail/aliases
> 
> accept from any for domain "my-domain.com" alias  deliver to mbox
> accept for local alias  deliver to mbox
> accept from local for any relay
> 

... is not allowed to relay based on this configuration ...

> # relay
> 
> relay as "@my-domain.com"
> 

... and this is where you get your syntax error, "relay as" is parameter
to accept, it should read:

   accept [...] relay as [...]


-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: Is using dkim really worth?

2016-12-10 Thread Gilles Chehade
On Sat, Dec 10, 2016 at 11:51:34AM +0100, Walter Alejandro Iglesias wrote:
> I mentioned this in other thread, now I'll ask this question directly.
> 
> I was running my own mail server for a while but not enough to make a
> conclusion.  I'd appreciate the opinion of the experienced.
> 
> I'm noticing messages with no spf or dkim records reach my gmail inbox.
> At the same time, messages with spf and dkim 'pass' state go to gmail
> spam (among them messages sent to me from people in this list).
> 
> So, in general and based on your experience, do you think using dkim
> (that implies daemon, port redirections, etc.) is really worth?
> 

Depends on your volume and who you intend to send to.

To be honest, setting up both SPF and DKIM takes a couple minutes and it
will probably avoid some delivery issues which will waste much more than
that to fix when they happen.

I can understand why someone would be reluctant to setup dmarc, but dkim
and spf are really a no brainer.

-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: How to detect this kind of attacks

2016-11-26 Thread Gilles Chehade
On Sat, Nov 26, 2016 at 12:08:37PM +0100, Walter Alejandro Iglesias wrote:
> Hello everyone,
> 
> Is there a way to detect on the fly spam attacks like the pasted below
> (maillog)?  It seems pf max-src-conn-rate takes in care only the
> "connected" event.
> 

There's not much you can do besides adding the offending addresses in a
pf blacklist.


> I obscured the recipients.  Basically sorted addresses of the same target 
> Chinese host.
> 

Been receiving lots of these from chinese hosts in the last few days too


> Nov 26 05:59:42 server smtpd[55880]: 3bcc430eee258cd7 smtp event=connected 
> address=119.141.24.19 host=119.141.24.19
> Nov 26 05:59:46 server smtpd[55880]: 3bcc430eee258cd7 smtp 
> event=failed-command address=119.141.24.19 host=119.141.24.19 command="RCPT 
> TO:" result="550 Invalid recipient"
> Nov 26 05:59:49 server smtpd[55880]: 3bcc430eee258cd7 smtp 
> event=failed-command address=119.141.24.19 host=119.141.24.19 command="RCPT 
> TO:" result="550 Invalid recipient"
> Nov 26 05:59:50 server smtpd[55880]: 3bcc430eee258cd7 smtp 
> event=failed-command address=119.141.24.19 host=119.141.24.19 command="RCPT 
> TO:" result="550 Invalid recipient"
> Nov 26 05:59:51 server smtpd[55880]: 3bcc430eee258cd7 smtp 
> event=failed-command address=119.141.24.19 host=119.141.24.19 command="RCPT 
> TO:" result="550 Invalid recipient"
> Nov 26 05:59:52 server smtpd[55880]: 3bcc430eee258cd7 smtp 
> event=failed-command address=119.141.24.19 host=119.141.24.19 command="RCPT 
> TO:" result="550 Invalid recipient"
> Nov 26 05:59:53 server smtpd[55880]: 3bcc430eee258cd7 smtp 
> event=failed-command address=119.141.24.19 host=119.141.24.19 command="RCPT 
> TO:" result="550 Invalid recipient"
> Nov 26 05:59:53 server smtpd[55880]: 3bcc430eee258cd7 smtp 
> event=failed-command address=119.141.24.19 host=119.141.24.19 command="RCPT 
> TO:" result="550 Invalid recipient"
> Nov 26 05:59:54 server smtpd[55880]: 3bcc430eee258cd7 smtp 
> event=failed-command address=119.141.24.19 host=119.141.24.19 command="RCPT 
> TO:" result="550 Invalid recipient"
> [...] *a hundred of more one second frequency entries here*
> Nov 26 06:06:55 server smtpd[55880]: 3bcc430eee258cd7 smtp 
> event=failed-command address=119.141.24.19 host=119.141.24.19 command="RCPT 
> TO:" result="550 Invalid recipient"
> Nov 26 06:06:56 server smtpd[55880]: 3bcc430eee258cd7 smtp 
> event=failed-command address=119.141.24.19 host=119.141.24.19 command="RCPT 
> TO:" result="550 Invalid recipient"
> Nov 26 06:06:56 server smtpd[55880]: 3bcc430eee258cd7 smtp 
> event=failed-command address=119.141.24.19 host=119.141.24.19 command="RCPT 
> TO:" result="550 Invalid recipient"
> Nov 26 06:06:57 server smtpd[55880]: 3bcc430eee258cd7 smtp event=closed 
> address=119.141.24.19 host=119.141.24.19 reason=disconnect
> 

-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: FW: smtpd dies on current

2016-11-11 Thread Gilles Chehade
On Fri, Nov 11, 2016 at 09:33:11AM -0600, Ted Wynnychenko wrote:
> I tried sending this to bugs@, but it does not seem to have been accepted.
> So, I decide to send it to misc@.
> I hope that's ok.
> 

Yes, I'm looking into it but it seems that it crashes within libcrypto
as I'm unable to reproduce with current smtpd and older libcrypto, and
able to reproduce with recent libcrypto.

I'm investigating this

-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: OpenBSD 6.0-stable smtpd queue encryption

2016-09-04 Thread Gilles Chehade
, write last chunk if any and perform authentication check */
-   if (!EVP_DecryptFinal(, out + len, ))
+   if (!EVP_DecryptFinal_ex(, out + len, ))
goto end;
ret = len + olen;
 


-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: DMARC and misc@ (and likely other OpenBSD lists)

2016-08-26 Thread Gilles Chehade
On Fri, Aug 26, 2016 at 09:46:35AM +0200, Peter Hessler wrote:
> On 2016 Aug 26 (Fri) at 08:25:56 +0200 (+0200), Peter N. M. Hansteen wrote:
> :If the OpenBSD list admins are reading this: would it be possible to
> :make a similar change in the OpenBSD mailing list configuration?
> 
> This is exactly why I hate DMARC.  Some tiny bullshit change, that
> requires everyone in the world to catch up to it.
> 
> Fuck you Google.  Fuck you Yahoo.  Clean up your own houses before you
> shit on ours.
> 

so much hate :-p

-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: DigitalOcean and OpenBSD

2016-08-25 Thread Gilles Chehade
On Thu, Aug 25, 2016 at 12:22:21PM +0300, li...@wrant.com wrote:
> Wed, 24 Aug 2016 18:59:46 -0300 "R0me0 ***" <knight@gmail.com>
> [...]
> > Thank you everyone that gime directions really appreciated ( all those in
> > pvt as well )
> > 
> > Cheers guys !
> 
> Thu, 25 Aug 2016 11:07:17 +0800 Tinker <ti...@openmailbox.org>
> [...]
> > Guys, www.kimsufi.com is the best combination of inexpensive and 
> > reliable, for dedicated servers.
> 
> Hi R0me0,
> 
> Indeed, recommending even more self managed affordable SSD servers:
> 
> OVH: SoYouStart, FR (EUR)
> [https://www.soyoustart.com/ie/essential-servers/]
> 
> OVH: SoYouStart, CA (USD)
> [https://www.soyoustart.com/us/essential-servers/]
> 
> NB: Not affiliate, years of OpenBSD in KVM on SSD servers reliably.
> 

As a former customer, I would recommand against them.

There are other alternatives with better hardware, services and policies
within the same price ranges. online.net to name one, hetzner.de to name
another one.

I'm only commenting because your mail didn't mention competitors and I'd
hate the idea that people went there by default, but I'm off this thread
now ;-)

-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: Thinking about writing something I'm calling wifid

2016-08-02 Thread Gilles Chehade
On Tue, Aug 02, 2016 at 04:58:18PM +0200, Kamil Cholewi??ski wrote:
> On Tue, 02 Aug 2016, Theo de Raadt <dera...@openbsd.org> wrote:
> > The kernel should have a better way of exporting stations it knows about
> > live, rather than userland forcing channel hops and station changes out
> > of sync with the kernel.
> 
> Perhaps overloading kevent? EVFILT_IEEE80211?
> 

:-|

-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: opensmtd failing and a work a round

2016-06-15 Thread Gilles Chehade
On Wed, Jun 15, 2016 at 07:33:47PM +, Peter Fraser wrote:
> I apologize for the missing newlines in the earlier messages
> 
> opensmtpd has a bug, that I know is being worked on. It leave streams open
> that should be closed and will eventually stop listening for new connections.
> 
> The only fix I know at the moment is to restart opensmtpd.
> 

Just to clarify since your mail might confuse people:

The bug triggers in the filter code which is NOT production-ready and we
enabled with an EXPERIMENTAL note in the release mail so developers help
spot bugs and improve the API.

If you need a stable setup, don't use filters before we announce that it
is a stable feature.

-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: SMTPD - Auth Error 535 5.7.8

2016-05-22 Thread Gilles Chehade
On Sun, May 22, 2016 at 05:04:02PM -0500, Patrick Dohman wrote:
> After migrating to a new ISP SMTPD relay TLS Auth no longer functions as
> expected.
> 
> Essentially the same configuration in conjunction with a different mail server
> works as needed.
> 
> Hoping to clarify if cipher type is an issue & if so how a cipher list is
> configured.
> 

nope, the problem seems to be that you credentials are rejected:

> May 22 14:49:41 Firewall smtpd[5565]: smtp-out: Connecting to
> tls://205.219.233.9:587 (mail.centurylink.net) on session 678c450539abbe1e...
> May 22 14:49:41 Firewall smtpd[5565]: smtp-out: Connected on session
> 678c450539abbe1e
> May 22 14:49:41 Firewall smtpd[5565]: smtp-out: Started TLS on session
> 678c450539abbe1e: version=TLSv1/SSLv3, cipher=AES256-GCM-SHA384, bits=256
> May 22 14:49:41 Firewall smtpd[5565]: smtp-out: Server certificate
> verification succeeded on session 678c450539abbe1e

here the connection has been established and TLS negotiated


> May 22 14:49:41 Firewall smtpd[5565]: smtp-out: Error on session
> 678c450539abbe1e: AUTH rejected: 535 5.7.8 Sorry.

here the remote server replied that it didn't accept your AUTH
which is basically your credentials

-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: Suggestion: new webpage for openbsd.org

2016-05-22 Thread Gilles Chehade
On Sun, May 22, 2016 at 07:34:19PM +1000, bytevolc...@safe-mail.net wrote:
> On Fri, 20 May 2016 03:50:51 +0300
> li...@wrant.com wrote:
> 
> > Interesting, the moment some other systems started swapping designs,
> > the moment their public knew they've sold out and commercialised in.
> 
> This is a good point; I have certainly noticed this on a lot of other
> sites and projects. As soon as they "upgrade" to "Web 2.0" (with all
> the image-buttons-for-links, rounded corners, low-contrast text,
> JavaScript galore, etc), it's easy to predict the fate of that project.
> 

aren't you guys even slightly tired of the bullshit ?

-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: Happy Birthday Theo!

2016-05-19 Thread Gilles Chehade
On Thu, May 19, 2016 at 10:57:57AM +0100, Kevin Chadwick wrote:
> Happy Birthday
> 
> 
>if (pledge("fun relax", NULL) == -1)   {
> err(1, "pledge");
>       }
> 

KNF, dammit...

-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: Suggestion: new webpage for openbsd.org

2016-05-18 Thread Gilles Chehade
On Wed, May 18, 2016 at 06:08:52PM +0200, Joakim Frosteg??rd wrote:
>
> [...]
> 
> @Gilles Chehade:
> If you're not being sarcastic, I would be happy to contribute to that
> project as well.
> 

Didn't know I came off sarcastic naturally, achievement unlocked !

I wasn't sarcastic, nope ;-)


-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: Suggestion: new webpage for openbsd.org

2016-05-17 Thread Gilles Chehade
On Tue, May 17, 2016 at 09:11:44AM +0200, Joakim Frosteg??rd wrote:
> Hi,
> 
> I???ve made a responsive new webpage replacement for the
> in my opinion somewhat aged openbsd.org <http://openbsd.org/>.
> 
> It???s available at http://greatest-ape.github.io/openbsd-site/public_html/
> <http://greatest-ape.github.io/openbsd-site/public_html/>
> with the repo at https://github.com/greatest-ape/openbsd-site
> <https://github.com/greatest-ape/openbsd-site> .
> 
> The idea is to replace index.html but for all other pages just
> replace the stylesheets. In so far, I???ve included a few other
> pages, including plat.html, goals.html and alpha.html.
> 
> I???ve tried to keep the page without bells and whistles, that is:
> * Just static HTML and CSS
> * No frameworks
> * No javascript
> * Minimalist design
> 
> though I have included the Apache 2-licensed Open Sans
> from Google Fonts. If you like the page, I guess we could
> build our own font instead of using the google repository.
> 
> Is this the right place to post this? Are you (the openbsd devs)
> interested in this at all?
> 
> If yes, we would also need to make sure that the creator of
> the nice openbsd logo included is happy with us using it for
> the webpage. Apart from that, I would be happy to license
> my work under BSD, MIT or whatever you want.
> 

I don't know if it's of any interest for openbsd.org, but I would not be
opposed to use this for opensmtpd.org :-p

-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: OpenSMTPD with filter-spamassassin / max-children

2016-04-20 Thread Gilles Chehade
On Tue, Apr 19, 2016 at 06:23:18PM +0200, Joerg Jung wrote:
> > Am 18.04.2016 um 16:56 schrieb ML mail <mlnos...@yahoo.com>:
> >
> > I have configured OpenSMTPD on OpenBSD 5.9 with the filter-spamassassin as a
> relay for a few of my webapp servers and have the problem when a webapp
> suddently sends over 30 mails at the same time. Basically the problem is that
> as I have configured spamd with 30 as max-children, as soon as I receive 30
> mails at the same time OpenSMTPD stops answering because all spamd childs are
> in busy state. This means that as long as all spamd child are in busy state I
> can not receive any more mails during that time.
> 
> So you get what you configured/requested.
> 
> > So in theory I would just raise the max-children setting of spamassassin but
> then it just postpones the problem really... so is there maybe another way to
> deal better with that issue?
> 
> Not really.
> 
> If these are your own web servers they
> will not send spam, right?
> So considering skip the filtering for them?
> 
> There is a max-inflight limit in smtpd.conf(5)
> which you may want to lower (below your 30).
> 

Generally speaking, I'd really avoid playing with max-inflight, it is a
scheduler knob from developers to developers.

Tweaking it for one particular case means it is tweaked for all cases.


> Also, the most recent git head of -extras contains
> a limit option which restricts the messages piped
> to spamassassin based on their size. The idea is:
> fewer/smaller mails are checked (fast),
> assuming that larger ones are rarely spam.
> 

much better strategy, maybe it should also contain a max session count
to tempfail incoming mail if there are already enough pending sessions
I don't know.

What I know is that max-inflight is not THE solution for sure.


-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: smtpd : reject with a message

2016-04-17 Thread Gilles Chehade
On Wed, Apr 13, 2016 at 06:14:36PM +, Peter Fraser wrote:
> Is there any method of added extra information when rejecting an email with
> smtpd
> 
> I am looking for an equivalent effect to the .REDIRECT or error  message in
> sendmail's virtualusertable
> 
> for example I had the following in sendmail's virtualusertable.
> 
> @thinkage.on.ca   error:5.1.1:553 " Please use 
> thinkage.ca not
> thinkage.on.ca"
> 
> and
> 
> t...@thinkage.ca  supp...@thinkage.ca.REDIRECT
> 

from aliases(5):

 error:code message
 
A status code and message to return.  The code must be 3 digits,
starting 4XX (TempFail) or 5XX (PermFail).  The message must be
present and can be freely chosen.

note that only single-line messages are supported (for now ?)


-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: OpenSMTPD on OpenBSD 5.9

2016-04-13 Thread Gilles Chehade
On Wed, Apr 13, 2016 at 03:15:59PM +1100, Rod Whitworth wrote:
> On Sun, 10 Apr 2016 12:31:35 +1100, Rod Whitworth wrote:
> 
> >On Sat, 9 Apr 2016 10:12:23 -0500, Edgar Pettijohn wrote:
> >
> >>On 04/08/16 23:25, Rod Whitworth wrote:
> >>> I'm trying to replace Postfix with OpenSMTPD and I'm having a battle.
> >>>
> >>> I don't seem to be able to get the clues to match the hardware and the
> >>> configure recipes that I need.
> >>>
> >>> The most up to date I can find breaks at the second stanza and I can
> >>> guess that the instructions for configuring for PF are for OpenBSD 5.6
> >>> means that I should find a up to date have clue set.
> >>>
> >>> Does anyone have pointer to a rescue?
> >>>
> >>> Rod/
> >>> (who doesn't want to revert to Postfix..)
> >>>
> >>> *** NOTE *** Please DO NOT CC me. I  subscribed to the list.
> >>> Mail to the sender address that does not originate at the list server is 
> >>> tarpitted. The reply-to: address is provided for those who feel compelled 
> >>> to reply off list. Thankyou.
> >>>
> >>> Rod/
> >>> ---
> >>> This life is not the real thing.
> >>> It is not even in Beta.
> >>> If it was, then OpenBSD would already have a man page for it.
> >>>
> >>I think you may need to describe what you are trying to achieve. Perhaps 
> >>your old postfix configuration as well.
> >>
> >
> >What I am trying to achieve is a copy of the up-to-date instructions.
> >
> >As I said the most recent copy is around 5.6.
> >I am running 5.9.
> >
> >The most recent recipe is written by someone who makes considerable
> >mods and I like to   refrain from making changes until I find a change
> >that appears to have a solid reason.
> >
> >Postfix is no help in getting OpenSMTPD working. Believe me and I've
> >been running Postfix since about OpenBSD 2.5 and doing it for some
> >large businesses.
> >
> >The present instructions for OpenSMTPD go likes this:
> >1 Install some packages (3)
> >
> >2 Create Maildir
> >
> >Crash. Well it doesn't work as it is suppose to.
> >
> >Study further and realise that you need up to date instructions.
> >
> >So try to install 5.9 OpenBSD and run
> >http://puffysecurity.com/wiki/opensmtpd.html
> >
> >Lots-a-luck.
> >
> >Rod/
> >
> >From the land "down under": Australia.
> >Do we look  from up over?
> >
> 
> Well it seems I must go to Postfix..
>

Postfix is good software, nice choice.


> What I needed was a version 5.9 as distributed not a hero's advanced
> version already heading to 6.0. That is for developers and I respect
> them but they are not for me: I'm not that smart.
> 
> There are some (apart from the 5.9+ code) which are not for me as they
> are (a) not 5.9 code or (b) not polished trying to try for 5.9
> 

After reading the whole thread, I still don't understand your problem,
what you're trying to achieve and what information you're looking for.


> I would love to see someone reply telling me that I have bad eyes and a
> 5.9 is running and it's getting it correct.
>

I'd love to tell you that you have bad eyes, but not knowing what is
your problem nor what you're trying to achieve, I wouldn't know what
I should look for.


> Meanwhile I have to bring up a new server and Postfix seems to be the
> only candidate.
> 
> At least I can build a mailserver that works on that.
> 

Again, good choice, if you're comfortable with running Postfix and you
can't get OpenSMTPD running, I don't know why you're struggling :-)


> Sorry for the noise
> 

np


-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: OT: Looking for email host with qmail like minus-addressing for custom domain

2016-03-03 Thread Gilles Chehade
On Thu, Mar 03, 2016 at 02:02:22PM -0600, Claus wrote:
> On 3/3/2016 3:14 AM, Gilles Chehade wrote:
> >On Thu, Mar 03, 2016 at 01:54:16AM +0100, ropers wrote:
> >Won't question your need however this + vs - thing has come up often and
> >I'd like to stress out that even though both - and + are valid, use of -
> >introduces ambiguity given that - is allowed in usernames:
> >
> > $ doas useradd -m foo
> > $ doas useradd -m foo-bar
> >
> >Who should get mail for foo-bar@ ?
> >
> >This just doesn't happen with + because:
> >
> >$ doas useradd -m bar
> >$ doas useradd -m bar+baz
> >useradd: `bar+baz' is not a valid login name
> >$
> 
> Seriously, do email hosting providers create local accounts for their users?
> I don't have a clue but I highly doubt it due the need to host multiple
> domains.
> 

My comment wasn't focused on email providers but on email in general ;-)

The default setup for all MTA's that I know of is to map user part of an
email address to a system username. That's been the case since the first
day I got interested in hosting (pre 2k) and is still the case today. It
was the case for my .edu when I was a student & it was the case for many
of the places I worked for since then.


> The ambiguity is there unless the domain owner doesn't allow dashes in
> account names, and I can afford to make that rule for my domain.  Of course
> that doesn't help me if no one supports that. :(
> 

Indeed, but the fact no one supports that should also hint you that this
is going against ... what everyone else does, so it's quite expected you
are going to be in a painful journey ;)


-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: OT: Looking for email host with qmail like minus-addressing for custom domain

2016-03-03 Thread Gilles Chehade
On Thu, Mar 03, 2016 at 01:39:54PM -0700, Andy Bradford wrote:
> Thus said Gilles Chehade on Thu, 03 Mar 2016 10:14:48 +0100:
> 
> > Who should get mail for foo-bar@ ?
> 
> The MTA will decide who will get foo-bar@.
> 

How ?


> > This just doesn't happen with + because:
> 
> It also doesn't happen with an MTA that can figure these things out.
>

How ?


> I don't see this as necessarily an argument for or against - vs +
> 

too bad, it means my friend jean-pierre will not be able to be hosted by
you if you already host my other friend jean ;-)


-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: OT: Looking for email host with qmail like minus-addressing for custom domain

2016-03-03 Thread Gilles Chehade
On Thu, Mar 03, 2016 at 01:54:16AM +0100, ropers wrote:
> On 2 March 2016 at 23:59, Jason Barbier <jab...@serversave.us> wrote:
> 
> > [You're] probably going to have to suck it up at some point and use +
> > [delimiters] like most people have moved to doing since according to the
> > RFC - is a valid email address char.
> >
> 
> So is +.
> http://tools.ietf.org/html/rfc3696#section-3
> - is not any more legal than +, just maybe more common, and you're still
> more likely to encounter non-RFC compliant implementations that don't deal
> with plus correctly, especially in web form email "verification" scripts --
> but many of those suck monkey balls anyway.
> 

Won't question your need however this + vs - thing has come up often and
I'd like to stress out that even though both - and + are valid, use of -
introduces ambiguity given that - is allowed in usernames:

$ doas useradd -m foo
$ doas useradd -m foo-bar

Who should get mail for foo-bar@ ?

This just doesn't happen with + because:

$ doas useradd -m bar
$ doas useradd -m bar+baz
useradd: `bar+baz' is not a valid login name
$

Now as far as your issue is concerned, what you could do if you can't go
without - is to take an account anywhere that supports + then just setup
a simple mail forwarder at a vps host to rewrite - to +, this way you'll
be able to transition without being limited in hosting choices.

just my opinion ;)

-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: Fwd: CVS: cvs.openbsd.org: src

2015-11-30 Thread Gilles Chehade
On Mon, Nov 30, 2015 at 05:45:25PM -0500, Daniel Ouellet wrote:
> On 11/30/15 4:58 PM, Joerg Jung wrote:
> > On Mon, Nov 30, 2015 at 04:48:05PM -0500, Daniel Ouellet wrote:
> >> Even removed the table password?
> > 
> > Yes.
> >  
> >> NO way anymore to have difference password for emails then the system
> >> password without smtp-extra install?
> > 
> > You may want to read table(5) the section about credentials tables.
> >  
> >> I can understand may be sqlite and ldap, but as a base system having
> >> different password from the system was and is very useful and I do it on
> >> all systems.
> > 
> > Still possible.
> > 
> >> Or am I missing something or miss understand the commit?
> > 
> > Yes, it looks like you never used table-passwd, 
> > that is why it is removed.
> 
> May be I miss used the name. Good to know.
>

yes, the name is confusing, table-passwd is not what you want.


> I was just starting to switch all my servers to use sqlite however
> because sqlite was in the base system too and it was easier to use after
> it wad configure. (:<
> 
> Oh well.
> 
> I will switch back to makemap then.
> 
> I hope I understand your explication as this being still valid:
> 
> table vusers db:/etc/mail/vusers.db
> table vdomains db:/etc/mail/vdomains.db
> 

yes, this is still valid


-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: smtpd with accept from any for domain alias relay via smtp://127.0.0.1:10025 doesn't support check?

2015-10-30 Thread Gilles Chehade
On Fri, Oct 30, 2015 at 03:56:23AM -0400, Daniel Ouellet wrote:
> Isn't the long form domain  alias  should be supported
> here for the relay configuration in smtpd.conf
> 
> In the man(5) smtpd.conf page I see this form as valid:
> 
> accept from any for domain  alias  deliver to maildir
> accept from any for domain  virtual  deliver to \
>   maildir
> 
> So, I would have expected to be able to use these forms:
> accept from any for domain  alias  relay via \
>   smtp://127.0.0.1:10025
> accept from any for domain  virtual  relay via \
>   smtp://127.0.0.1:10025
> 
> However it doesn't accept and I need to use this instead:
> 
> accept from any for domain  relay via smtp://127.0.0.1:10025
> accept from any for domain  relay via smtp://127.0.0.1:10025
> 
> The users, or aliases part is not accepted.
> 
> Any thoughts on this? The reason I asked is that, let say you have a not
> valid users if I can check the users BEFORE doing the local relay, it
> avoid the additional processing and would be rejected right away oppose
> to be after it is locally processed no?
> 

Then you should use the 'recipient' keyword:

 accept [...] for domain  recipient  [...]

Goal of aliases / virtual is to resolve a user-part/address into a
local delivery ... which makes no sense if your mail is not local.


-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: Is OpenSMTPD worthy of OpenBSD inclusion?

2015-10-05 Thread Gilles Chehade
lopers work for him.

At the same time, they can browse our tracker to see how many times
you have requested something and how many times we worked on it. It
sure seems ungrateful in retrospect given that on some of them, you
are bitching that we don't go fast enough.


> But I think it's time we take a step back and reassess the situation.
> There are some critical questions that need to be answered. What
> accounts for the high proportion of security vulnerabilities in a
> project renowned for its brilliant developers and stringent review
> processes? Do the OpenSMTPD developers have time -- and have they
> displayed a presence of necessary free time -- to keep the project
> healthy and moving toward stability at an acceptable pace? Have the
> correct standards of releases been applied to the OpenSMTPD release
> process?
>

That will be the only thing we agree upon.

We had to do a huge refactor to add filters and we knew in advance
it would span over several releases, breaking smtpd for OpenBSD.

We decided to take this development to a private repository and we
made a public mirror as people were asking for snapshots to test.
You should know, you *really* wanted filters right ?

This resulted in two branches, making it twice as hard for us to
work correctly and preventing other OpenBSD developers from taking
a look at our changes.

This is not how OpenBSD works and this is not how we want to work.

We're currently discussing how to come back home, micro-diff by
micro-diff. the filters code is trickier to split and we have a
bit of work to make it reviewable. the easy way would be to not
support it, but you'd prefer that we keep it right ?

This is how we want to work. With other OpenBSD hackers.


> And most importantly: should OpenSMTPD continue to be a part of the
> core OpenBSD project? Or should it rather spend some time maturing and
> securing commitments from developers for maintaining it in a
> consistent manner, before being accepted by such a reputable
> organization as OpenBSD?
> 

You have some nerve.

"securing commitments from developers for maintaining it" ?

You weren't complaining much about our commitments when we were working
on your feature requests and you were talking to us like we were your
employees using big words. Care to remind me who was commiting to work
on that masquerade or senders map feature that was so critical to your
infrastructure ? Who actually ping-ed you to let you know that the long
awaited feature was going to be part of a snapshot ?

You did complain alright, the project wasn't moving fast enough.
But that was before you complained it was moving to fast.


> Finally, if OpenSMTPD does continue to exist as a part of core
> OpenBSD, I would strongly recommend some effort is organized to bring
> top quality code reviewers and auditors to the source code, in order
> to give the project the eyeballs it deserves. It would be a great
> boost in confidence for many who use - or hoped to someday use -
> OpenSMTPD to see that intelligent minds, capable of securing large
> codebases, have put their efforts into making it secure.
>

We agree again.

The more eyeballs, the better.

Except that when we get help from external eyeballs you're unhappy.
Or is there another reason ?


> I hope this can begin some discussion on the best way forward toward
> making OpenSMTPD a piece of infrastructure we can trust. My best
> wishes for the project.
> 

I'd be happy to believe you, and people may, but you're not sincere.

People may think you sent this mail out of nowhere but you did right
after I told you something unpleasant. Just a coincidence, right ?

While you were telling eric that you liked our work and that you had
respect for it, you drafted this, sent it and linked on so many site
that people started telling me in private that a psycho had a grudge
against us.

At least be honest about your motives.

You told me once that you were a "security expert" and that we could
sit around a beer so you'd tell me what's wrong in our design. If it
is true that you want the project to succeed and if you really are a
security expert then the project would have surely made a better use
of a design analysis report than this mail.


-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: Opensmtpd+user forom "table baseuser"

2015-10-02 Thread Gilles Chehade
On Thu, Oct 01, 2015 at 06:05:57AM +0200, Krzysztof Strzeszewski wrote:
> Hi,
> I add in my smtpd.conf:
> 
> table users file:/path/to/file
> accept userbase 
> 
> but smtpd get users from local system:
> 
> "getpwnam:  -> 0"
> 
> what is wrong?
> 

unless you provide the full configuration file and some logs, this is
not enough to even begin to understand what happened.

on the top of my head: you're not matching the rule you think you are



-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: Show us your /etc/profile

2015-08-01 Thread Gilles Chehade
On Fri, Jul 31, 2015 at 05:25:49PM -0300, listas...@dna.uba.ar wrote:
 Hello everybody
 

Hello,

 alias ducks='du -cks * |sort -rn |head -11'
 

I'm stealing this one ;-)

-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: Sluggish/laggy browser behaviour

2015-07-29 Thread Gilles Chehade
On Wed, Jul 29, 2015 at 12:46:01AM -0700, Nathan Van Ymeren wrote:
 On Wed, 29 Jul 2015 02:35:39 -0400
 Brad Smith b...@comstyle.com wrote:
 
  Give up. The developers don't care in a functional manner. They won't
  listen to the obvious issues (and there are) and would rather attack
  you then admit the obvious.
  
 
 I don't think anyone's attacked me here, developer or not?
 

Disregard, some people have trouble understanding that harsh reactions
are not really the result of reporting issues.

Some people report many issues and never get a harsh reaction, while a
few people always get harsh reactions when posting to the lists.

I guess it's simpler to assume the problem is with the other people on
the list rather than adjust a shitty attitude ;-)

Reporting issues is one of the best way for a non-developer to help us
and I think it's pretty clear to everyone that OpenBSD and all related
projects don't tend to hide issues under the carpet.

-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: elementary opensmtpd setting on rental server

2015-07-23 Thread Gilles Chehade
On Fri, Jul 24, 2015 at 02:09:53AM +0900, Tuyosi Takesima wrote:
 thanks for Denis
 
 |Tell me if I'm wrong but you don't listen on port 25 or 465.
 your advise is great !
 
 /etc/mail/smtpd.conf  is rewriten .
 listen on lo0
 listen on em0 port 25-to recieve mail from gmx
 listen on em0 port 465  -to recieve mail from gmail
 table aliases db:/etc/mail/aliases.db
 
 accept from any for domain aoiXXX.mydns.jp   alias aliases
 deliver to maildir
 accept from any for domain aoiXXX.mydns.jp
 deliver to maildir
 
 accept for localalias aliases
 deliver to maildir
 accept for local
 deliver to maildir
 
 reject from any for any
 --
 
 then  i can get mails from x...@gmail.com  x...@gmx.com .
 buti cannot send mails to x...@gmail.com  x...@gmx.com .
 
 but this is great progress .
 

Jumping in to put an end to this thread:

Let's look at what you want to do:

  send mail to @gmail.com  @gmx.de

Then, let's check if your ruleset has any rule matching these:

 accept from any for domain aoiXXX.mydns.jp [...] - no
 accept from any for domain aoiXXX.mydns.jp [...] - no
 accept for local [...] - no
 accept for local [...] - no
 reject from any for any - yes

Your ruleset doesn't allow for your own users to send mail to anything
but your local domains.

You need a rule that states:

accept from local for any relay

It needs to be at the bottom of your config, right where you added this
reject rule (which serves no purpose btw since this is the default).


-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: GROUP CHANGED

2015-06-14 Thread Gilles Chehade
On Sun, Jun 14, 2015 at 04:32:18PM +0200, Max Power wrote:
 Hi guys!
 
 I copied my files from Debian [ext4] to my new server OpenBSD [5.7 amd64],
 and I found that all files of 'ROOT' group were imported [in OpenBSD] in
 the 'Wheel' group.
 Why is this?
 
 [Owner is the same, there is no change.]
 
 Thank fro reply.
 

wheel is the new root.

https://en.wikipedia.org/wiki/Wheel_(Unix_term)

-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: Logjam Attack: is OpenIKED and OpenSMTPD vulnerable?

2015-05-20 Thread Gilles Chehade
On Wed, May 20, 2015 at 11:55:42PM +0200, L.R. D.S. wrote:
 Anyone write today on @misc and @tech about this, so I'll ask just to make 
 sure: 
 is OpenIKED and/or OpenSMTPD vulnerable to this new Logjam Attack?
 This vulnerability allow a man-in-the-middle attacker to downgrade 
 vulnerable TLS 
 connections to 512-bit export-grade cryptography and [Since] Millions of 
 HTTPS, 
 SSH, and VPN servers all use the same prime numbers for Diffie-Hellman key 
 exchange
 [using it] an attacker can quickly break individual connections [...] 
 attacks on 
 VPNs are consistent with having achieved such a break.[1]. They have a proof 
 of 
 concept[2] and a research paper[3].
 

As far as OpenSMTPD is concerned:

The attack affects any server that supports DHE_EXPORT ciphers,
 and affects all modern web browsers. (from weakdh.org)

The default cipher-suite is HIGH:!aNULL:!MD5 which doesn't support any
DHE_EXPORT cipher (obvious but verified with both LibreSSL and OpenSSL):

$ openssl ciphers HIGH:!aNULL:!MD5|grep EXPORT
$


Millions of HTTPS, SSH, and VPN servers all use the same prime numbers
 for Diffie-Hellman key exchange. [...]

Yes, there is a very popular set of 512-bits DH parameters that everyone
uses because it was considered safe to share the params if generated the
right way. It is part of tons of examples, documented as safe to reuse
and it ended pretty much everywhere (openssl s_server to name one).

We have switched to 1024-bits DH parameters 4 years ago:

http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.sbin/smtpd/ssl.c.diff?r1=1.31r2=1.32f=h

The DH parameters were generated by myself on a safe machine, so there's
very very low chances millions of servers are sharing the same ones ;)

The article suggests that 1024-bits DH isn't enough and that you need it
to be at least 2048-bits, however before we bump this default, we need a
fair amount of testing: last time I tried, it broke A LOT of exchanges.

Discussions will take place with regard to what we'll do anways...


-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: smtpd(8): running as backup MX with +TAG addresses

2015-01-05 Thread Gilles Chehade
On Sat, Dec 27, 2014 at 11:56:29AM +, Florian Obser wrote:
 Hi,
 
 so I want to run smtpd(8) as a backup MX and configure the list of
 valid email addresses so that the backup MX rejects invalid
 email addresses on accepting the message and not bounce
 the mail alter on when it tries to deliver to the primary
 mail server.
 Currently I have this:
 accept from any for domain domains recipient recipients \
   relay backup hostname primary.mx.example.com
 
 Assuming I have example.com in the domains table and
 u...@example.com in the recipient table smptd rejects
 rcpt to: user+...@example.com
 with
 550 Invalid recipient
 
 rcpt to: u...@example.com
 works just fine.
 
 This is on -current.
 
 How can I get +TAG to work on the backup MX?
 

At the moment, recipient is unaware of + tagging you can only backup
a full domain or specific untagged recipients.

This doesn't seem too hard to implement though, I'll see if I can get it
done this week.

-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



Re: smtpd(8): running as backup MX with +TAG addresses

2015-01-05 Thread Gilles Chehade
On Sat, Dec 27, 2014 at 11:56:29AM +, Florian Obser wrote:
 Hi,
 
 so I want to run smtpd(8) as a backup MX and configure the list of
 valid email addresses so that the backup MX rejects invalid
 email addresses on accepting the message and not bounce
 the mail alter on when it tries to deliver to the primary
 mail server.
 Currently I have this:
 accept from any for domain domains recipient recipients \
   relay backup hostname primary.mx.example.com
 
 Assuming I have example.com in the domains table and
 u...@example.com in the recipient table smptd rejects
 rcpt to: user+...@example.com
 with
 550 Invalid recipient
 
 rcpt to: u...@example.com
 works just fine.
 
 This is on -current.
 
 How can I get +TAG to work on the backup MX?
 

This diff should do the trick.
It teaches sender and recipient how to cope with tags in addresses.

Let me know how it goes for you.


diff --git a/smtpd/table.c b/smtpd/table.c
index 66fdb7a..cc61e74 100644
--- a/smtpd/table.c
+++ b/smtpd/table.c
@@ -347,6 +347,12 @@ table_update(struct table *t)
return (t-t_backend-update(t));
 }
 
+
+/*
+ * quick reminder:
+ * in *_match() s1 comes from session, s2 comes from table
+ */
+
 int
 table_domain_match(const char *s1, const char *s2)
 {
@@ -358,6 +364,7 @@ table_mailaddr_match(const char *s1, const char *s2)
 {
struct mailaddr m1;
struct mailaddr m2;
+   char   *p;
 
if (! text_to_mailaddr(m1, s1))
return 0;
@@ -367,9 +374,17 @@ table_mailaddr_match(const char *s1, const char *s2)
if (! table_domain_match(m1.domain, m2.domain))
return 0;
 
-   if (m2.user[0])
+   if (m2.user[0]) {
+   /* if address from table has a tag, we must respect it */
+   if (strchr(m2.user, '+') == NULL) {
+   /* otherwise, strip tag from session address if any */
+   p = strchr(m1.user, '+');
+   if (p)
+   *p = '\0';
+   }
if (strcasecmp(m1.user, m2.user))
return 0;
+   }
return 1;
 }
 


-- 
Gilles Chehade

https://www.poolp.org  @poolpOrg



  1   2   3   4   5   6   >