[gentoo-user] Re: Simple SMTP to cmd-line MTA relay?

2018-01-19 Thread Grant Edwards
On 2018-01-20, Grant Taylor  wrote:
> On 01/19/2018 04:58 PM, Grant Edwards wrote:
>
>> That would require seperate outbound transports that are selected based 
>> on how the mail was read: smtp vs. /usr/bin/sendmail (the real one).
>
> Okay
>
>> I get the impression from exim and postfix docs that outbound routing 
>> based on input method aren't possible (I may be wrong about that).
>
> Depending on what exactly you're needing, I might be able to think of a 
> way to do this with Sendmail.  -  This may be one of the exceedingly 
> rare times that Sendmail's splitting MTA and MSA roles may actually be 
> beneficial (other than for the security reasons).

[...]

> Am I regurgitating this properly?
>
> 1) You want incoming SMTP connections to go out via your custom mailer 
>script.
>
> 2) You want messages originated locally and piped into $commandTBD to 
>go out via SMTP.

Yes -- the two are completely unrelated and unconnected.

> Would I be correct in assuming that the path and / or name of the 
> sendmail like script that interfaces with the Exchange server could 
> change if necessary? I.e. you could name it
> /usr/local/bin/sendmail_to_exchange_gateway if you needed to.

Yes.  It's not actually located at /usr/bin/sendmail, and doesn't need
to be.

> Question:  What name are your scripts currently calling to interface 
> with msmtp?  -  Can that name change if necessary?

Yes they can be changed.  Most of the things that invoke msmtp invoke
it as /usr/bin/msmtp.  A few invoke it as /usr/bin/sendmail.

> I'm trying to juggle the various pieces as I understand them to see if 
> everything can work together.

Don't waste any time on it -- I think the current SMTP server combined
with stunnel is going to work.

> Note:  I'm not trying to push Sendmail.  -  I know I'm strange in my 
> predilection for it.  -  I'm simply trying to solve the problem (as I 
> understand it) with the tools that I know.
>
>> Well I have several msmtp "accounts" set up and run multiple mutt 
>> configurations that use those different accounts for outbound mail.
>
> The different accounts outbound may complicate things.  Are those 
> accounts configured as part of msmtp?  Or are they configured in the 
> things using msmtp?

Both.  msmtp has a config file that defines the accounts, and things
that invoke msmtp directly (e.g. mutt) use a command-line option to
specify an account. There is a default account that's used if the
command line option isn't present (which would be the case for apps
that invoke msmtp as '/usr/bin/sendmail').  Now that I think about it,
I think a configuration that chooses outbound routes for locally
generated email based on from address could work.  Several of those
accounts/routes actually go to the same SMTP server but authenticate
with different username/password combinations.

In mutt's case, I also believe I could switch from msmtp to mutt's
"new" built-in SMTP client code.

Another option would be to set up a container in which to run the
"relay" MTA (sendmail/exim/postfix) that's doing SMTP -->
sendmail-like-script. This is probably the cleanest way to do it.

But, that's all moot if the stunnel solution works.

-- 
Grant









[gentoo-user] Re: Simple SMTP to cmd-line MTA relay?

2018-01-19 Thread Ian Zimmerman
On 2018-01-19 23:58, Grant Edwards wrote:

> That would require seperate outbound transports that are selected
> based on how the mail was read: smtp vs. /usr/bin/sendmail (the real
> one).  I get the impression from exim and postfix docs that outbound
> routing based on input method aren't possible (I may be wrong about
> that).

In the case of exim, you're definitely very wrong about it.

-- 
Please don't Cc: me privately on mailing lists and Usenet,
if you also post the followup to the list or newsgroup.
To reply privately _only_ on Usenet, fetch the TXT record for the domain.



Re: [gentoo-user] Re: Simple SMTP to cmd-line MTA relay?

2018-01-19 Thread Grant Taylor

On 01/19/2018 05:30 PM, Grant Taylor wrote:
I'm trying to juggle the various pieces as I understand them to see if 
everything can work together.


I have a fleeting thought that /might/ work.  I want to write it down 
before I loose it.


1)  Configure Sendmail's MTA to not have any listening daemon ports.  - 
This means that all interface to the MTA will be via the 
/path/to/sendmail binary.

2)  Configure Sendmail's MSA to listen on TCP port 25.
3)  Configure Sendmail's MSA to smart host (without encryption) through 
your existing SMTP to Exchange gateway.


I /think/ this addresses most parts.

SMTP from ??? connects to the MSA which connects to the Exchange Gateway 
which connects to Exchange via something other than SMTP.  -  I think 
that tracks.


Email from the local machine uses the /usr/sbin/sendmail interface which 
speaks SMTP to the world or a smart host.


I think that does work.  Granted, there are some IPs and or ports to 
juggle to make sure that Sendmail's MSA and your SMTP to Exchange 
gateway don't conflict.  But I think that should be possible to handle.


I don't know if the other common MTAs can do anything like this or not. 
I would hope that they can.


I will also say that it is possible to get Sendmail to do some really 
complex things.  It may be possible to get a single sendmail daemon to 
do everything.  But I think that is going to be more complicated, 
possibly needlessly so if the above recommendation works.


I need to know more details about the different accounts and how they 
interact with msmtp (which I have zero experience with) to know if they 
will play nicely with the above configuration.


The only niggling feeling I have is about 127.0.0.1:25.  Is anything at 
all using that?  I've run across a lot of programs that assume the local 
MTA is listening there.  -  If something is, then it's likely a matter 
of juggling IP(s) and port(s) that various things are listening on.




--
Grant. . . .
unix || die



smime.p7s
Description: S/MIME Cryptographic Signature


Re: [gentoo-user] Re: Simple SMTP to cmd-line MTA relay?

2018-01-19 Thread Grant Taylor

On 01/19/2018 04:58 PM, Grant Edwards wrote:
That would require seperate outbound transports that are selected based 
on how the mail was read: smtp vs. /usr/bin/sendmail (the real one).


Okay

I get the impression from exim and postfix docs that outbound routing 
based on input method aren't possible (I may be wrong about that).


Depending on what exactly you're needing, I might be able to think of a 
way to do this with Sendmail.  -  This may be one of the exceedingly 
rare times that Sendmail's splitting MTA and MSA roles may actually be 
beneficial (other than for the security reasons).


I'm going to need to ponder this.

Unless it's possible to run two separate instances -- one to relay SMTP 
--> my_custom_sendmail_utility and one to hanlde outbound mail generated 
locally standard_usr_bin_sendmail --> SMTP.


That's certainly possible to do with Sendmail.  Or at least it used to 
be.  Granted, it's annoying ... to make sure that the various queues are 
separated.


I'm trying to think through this to see if there is a way to leverage 
the existing separation between the MTA (which has the features for your 
listening SMTP daemon) and the MSA (which I think prefers to talk SMTP 
to a smart host, usually the local MTA).


Am I regurgitating this properly?

1)  You want incoming SMTP connections to go out via your custom mailer 
script.
2)  You want messages originated locally and piped into $commandTBD to 
go out via SMTP.


Would I be correct in assuming that the path and / or name of the 
sendmail like script that interfaces with the Exchange server could 
change if necessary?  I.e. you could name it 
/usr/local/bin/sendmail_to_exchange_gateway if you needed to.


Question:  What name are your scripts currently calling to interface 
with msmtp?  -  Can that name change if necessary?


I'm trying to juggle the various pieces as I understand them to see if 
everything can work together.


Note:  I'm not trying to push Sendmail.  -  I know I'm strange in my 
predilection for it.  -  I'm simply trying to solve the problem (as I 
understand it) with the tools that I know.


Well I have several msmtp "accounts" set up and run multiple mutt 
configurations that use those different accounts for outbound mail.


The different accounts outbound may complicate things.  Are those 
accounts configured as part of msmtp?  Or are they configured in the 
things using msmtp?




--
Grant. . . .
unix || die



smime.p7s
Description: S/MIME Cryptographic Signature


[gentoo-user] Re: Simple SMTP to cmd-line MTA relay?

2018-01-19 Thread Grant Edwards
On 2018-01-19, Grant Taylor  wrote:
> On 01/19/2018 04:04 PM, Grant Edwards wrote:
>> One of the hassles with those is that portage won't allow me to install 
>> any of them because they conflict with msmtp, which is what I use for 
>> sending normal e-mail.
>
> I would expect that you can use any of those in place of msmtp to send 
> email too.

That would require seperate outbound transports that are selected
based on how the mail was read: smtp vs. /usr/bin/sendmail (the real
one).  I get the impression from exim and postfix docs that outbound
routing based on input method aren't possible (I may be wrong about
that).

Unless it's possible to run two separate instances -- one to relay
SMTP --> my_custom_sendmail_utility and one to hanlde outbound mail
generated locally standard_usr_bin_sendmail --> SMTP.

> Or are you doing something that is msmtp specific?

Well I have several msmtp "accounts" set up and run multiple mutt
configurations that use those different accounts for outbound mail.

-- 
Grant






Re: [gentoo-user] Re: Simple SMTP to cmd-line MTA relay?

2018-01-19 Thread Grant Taylor

On 01/19/2018 04:04 PM, Grant Edwards wrote:
One of the hassles with those is that portage won't allow me to install 
any of them because they conflict with msmtp, which is what I use for 
sending normal e-mail.


I would expect that you can use any of those in place of msmtp to send 
email too.


Or are you doing something that is msmtp specific?



--
Grant. . . .
unix || die



smime.p7s
Description: S/MIME Cryptographic Signature


[gentoo-user] Re: Simple SMTP to cmd-line MTA relay?

2018-01-19 Thread Grant Edwards
On 2018-01-19, Ian Zimmerman  wrote:
> On 2018-01-19 20:19, Grant Edwards wrote:
>
>>  Can exim transfer mail to an Exchange server that doesn't expose an
>>  SMTP server?
>> >>>
>> >>> Errr, no. exim does SMTP.
>> >>>
>> >>> If the above is what you need, any orthodox mail server would need
>> >>> to hand the mail over to something that *can* deliver to Exchange.
>> >> 
>> >> Yes, and that something is my existing command-line MTA utility
>> >> that has the same usage as /usr/bin/sendmail.
>
> FWIW, you can plug in your existing script into exim as a custom
> "transport", in the exim terminology.  In fact that is what I used to do
> for years, to stuff outgoing mail into sendmail on a system where I had
> a shell account.  But if I understand the problem now (a well sized if,
> LOL) that doesn't by itself help you because the existing script is
> broken; replacing the script is the main part of the problem.  Right?

The existing /usr/bin/sendmail (that's not it's actual path) script
works fine.  It's the SSL support in the SMTP server that invokes the
/usr/bin/sendmail script that's broken.  I've modified that server to
run an instance of stunnel and use plain SMTP (sans SSL).  It looks
like that's probably going to work.  There's a custom SSL server
because at some point in the past it had to do some odd things with
headers and the envelope from field (it also implements some special
logging).  Then at some later point in the past, the requirement for
those odd things went away.  At some other point in history, the SSL
support in that server got broken.  The actual failure is intermittent
(it depends on message size and network timing), so it's taken a while
to track it down and decide what to do about it.

For now, I'm going with the custom server and stunnel.  If there are
problems with that, I'll try one of sendmail/postfix/exim.  [One of
the hassles with those is that portage won't allow me to install any
of them because they conflict with msmtp, which is what I use for
sending normal e-mail.]

-- 
Grant Edwards   grant.b.edwardsYow! Life is a POPULARITY
  at   CONTEST!  I'm REFRESHINGLY
  gmail.comCANDID!!




Re: [gentoo-user] Re: Simple SMTP to cmd-line MTA relay?

2018-01-19 Thread Grant Taylor

On 01/19/2018 03:24 PM, Ian Zimmerman wrote:
But if I understand the problem now (a well sized if, LOL) that doesn't 
by itself help you because the existing script is broken; replacing the 
script is the main part of the problem.  Right?


Grant E.'s existing script purportedly functions just fine for 
non-encrypted SMTP connections.  The problem is with encrypted SMTP 
connections.  Further the problem is in the SMTP side, not the actual 
mailer / transport side.


Sendmail / exim / postfix / etc should all be able to provide the 
unencrypted and encrypted SMTP side with very little problem at all.




--
Grant. . . .
unix || die



smime.p7s
Description: S/MIME Cryptographic Signature


[gentoo-user] Re: Simple SMTP to cmd-line MTA relay?

2018-01-19 Thread Ian Zimmerman
On 2018-01-19 20:19, Grant Edwards wrote:

>  Can exim transfer mail to an Exchange server that doesn't expose an
>  SMTP server?
> >>>
> >>> Errr, no. exim does SMTP.
> >>>
> >>> If the above is what you need, any orthodox mail server would need
> >>> to hand the mail over to something that *can* deliver to Exchange.
> >> 
> >> Yes, and that something is my existing command-line MTA utility
> >> that has the same usage as /usr/bin/sendmail.

FWIW, you can plug in your existing script into exim as a custom
"transport", in the exim terminology.  In fact that is what I used to do
for years, to stuff outgoing mail into sendmail on a system where I had
a shell account.  But if I understand the problem now (a well sized if,
LOL) that doesn't by itself help you because the existing script is
broken; replacing the script is the main part of the problem.  Right?

-- 
Please don't Cc: me privately on mailing lists and Usenet,
if you also post the followup to the list or newsgroup.
To reply privately _only_ on Usenet, fetch the TXT record for the domain.



Re: [gentoo-user] Re: Simple SMTP to cmd-line MTA relay?

2018-01-19 Thread Grant Taylor

On 01/19/2018 01:29 PM, Grant Edwards wrote:

Aargh.  smtpd.  Typos like that certinaly don't help the confusion.


*chuckle*  -  Mistakes happen.  -  Context answered the question more 
than 90%.



I'm going to try stunnel in front of the existing solution first.

If that doesn't work, I'll try sendmail/postfix/exim.  It looks like 
they'll all do what I want (modulo the no-queue desire).


I think that it's extremely likely that you can configure the MTAs to 
not queue messages.  -  Inquire in MTA specific support groups.


(I expect that someone else would have chimed in to this thread if they 
knew.)


Thanks again (and apologies) to everbody who tried to figure out what 
it was I was asking...


:-)



--
Grant. . . .
unix || die



smime.p7s
Description: S/MIME Cryptographic Signature


[gentoo-user] Re: Simple SMTP to cmd-line MTA relay?

2018-01-19 Thread Grant Edwards
On 2018-01-19, Grant Taylor  wrote:
> On 01/19/2018 12:48 PM, Grant Edwards wrote:
>> Yep, and it looks like the Postfix equivalent is a custom pipe transport. 
>> Once you know what phrases to google for, it's a lot easier.
>
> *nod*
>
> I figured that you would be able to find something.
>
> Hence why I mentioned the terms.  ;-)

[...]

>> I wrote the server I'm using now, but it uses somebody else's snmpd 
>> module, and that's where the SSL breakage is.  I've filed a bug, and I've 
>> been doing some reading toward attempting a fix, but it looks like it 
>> might be a bit hairy: it involves Python's asyncore/asynchat framework 
>> (and process pools).  What's missing is handling for ssl "want read" 
>> and "want write" exceptions.
>
> "snmpd" or "smtpd"?

Aargh.  smtpd.  Typos like that certinaly don't help the confusion.

> You lost me at Python.  (I know it's a personal prejudice.  But I
> think I'm allowed to have it as long as I acknowledge them as such.)

I'm going to try stunnel in front of the existing solution first.

If that doesn't work, I'll try sendmail/postfix/exim.  It looks like
they'll all do what I want (modulo the no-queue desire). FWIW, the
google phrase for exim is "exim pipe transport":

  
https://www.exim.org/exim-html-current/doc/html/spec_html/ch-the_pipe_transport.html

Thanks again (and apologies) to everbody who tried to figure out what
it was I was asking...

-- 
Grant Edwards   grant.b.edwardsYow! They collapsed
  at   ... like nuns in the
  gmail.comstreet ... they had no
   teen appeal!




[gentoo-user] Re: Simple SMTP to cmd-line MTA relay?

2018-01-19 Thread Grant Edwards
On 2018-01-19, Alan McKinnon  wrote:
> On 19/01/2018 22:03, Grant Edwards wrote:
>> On 2018-01-19, Alan McKinnon  wrote:
>>> On 19/01/2018 21:54, Grant Edwards wrote:
>>>
 Can exim transfer mail to an Exchange server that doesn't expose an
 SMTP server?
>>>
>>> Errr, no. exim does SMTP.
>>>
>>> If the above is what you need, any orthodox mail server would need to
>>> hand the mail over to something that *can* deliver to Exchange.
>> 
>> Yes, and that something is my existing command-line MTA utility that
>> has the same usage as /usr/bin/sendmail.
>
> Got it now.

I obviously did a bad job describing the problem, since I seemed to
have confused just about everybody.  I erred in leaving out what I
thought were irrelevant details.

-- 
Grant Edwards   grant.b.edwardsYow! Boy, am I glad it's
  at   only 1971...
  gmail.com




[gentoo-user] Re: Simple SMTP to cmd-line MTA relay?

2018-01-19 Thread Grant Edwards
On 2018-01-19, Grant Taylor  wrote:
> On 01/19/2018 12:48 PM, Alan McKinnon wrote:
>> I'm also wondering why you need 2 bits. Earlier in the thread you 
>> mentioned that you send perhaps a few messages a week and never more 
>> than one connection at a time.
>
> Grant E. has indicated elsewhere in the thread that his
> /usr/bin/sendmail script is speaking something custom to the
> destination mail server.
>
> Read:  /usr/bin/sendmail script is NOT speaking SMTP.

Yes.  I should have been more clear about that. 

> Do you know what protocol(s) that Grant E.'s /usr/bin/sendmail script is 
> speaking?  Do you know if ssmtp (et al) support it?

It involves doing things remotely using the ssh-2 protocol.

> I feel like Grant E. has not revealed enough information to know if
> other things can speak what ever custom communications is possible
> between the SMTP server and the destination mail server.  He has
> only revealed enough to know that it is custom, and that his
> /usr/bin/sendmail interface script must be used.

Yes, I have assumed that normal MTAs like sendmail and postfix do not
implement the ssh protocol and can't be made to do what my
/usr/bin/sendmail script does.

> I don't think there is enough information to know that ssmtp / postfix / 
> exim / sendmail / et al are capable of speaking the protocols that Grant 
> E. needs or wants.

I am confident they do not, but I'm not going to go into details on
how the ssh-protocol-based delivery works.

-- 
Grant Edwards   grant.b.edwardsYow! This PIZZA symbolizes
  at   my COMPLETE EMOTIONAL
  gmail.comRECOVERY!!




Re: [gentoo-user] Re: Simple SMTP to cmd-line MTA relay?

2018-01-19 Thread Grant Taylor

On 01/19/2018 12:48 PM, Grant Edwards wrote:
Yep, and it looks like the Postfix equivalent is a custom pipe transport. 
Once you know what phrases to google for, it's a lot easier.


*nod*

I figured that you would be able to find something.

Hence why I mentioned the terms.  ;-)

I could live with queueing/retrying as long as the eventual failures 
generated messages that are sent back to the sender.  Those failure 
messages would need to be sent via a normal SMTP smarthost/relayhost 
(with AUTH) and not via the custom mailer.


I would expect that it is possible to fulfill those requirements.

Yes, I've been thinking about that.  I think I'll try that first -- 
if my understanding of the failure mode is correct, it should work.


The simpler solution is usually nicer.

I wrote the server I'm using now, but it uses somebody else's snmpd 
module, and that's where the SSL breakage is.  I've filed a bug, and I've 
been doing some reading toward attempting a fix, but it looks like it 
might be a bit hairy: it involves Python's asyncore/asynchat framework 
(and process pools).  What's missing is handling for ssl "want read" 
and "want write" exceptions.


"snmpd" or "smtpd"?

You lost me at Python.  (I know it's a personal prejudice.  But I think 
I'm allowed to have it as long as I acknowledge them as such.)




--
Grant. . . .
unix || die



smime.p7s
Description: S/MIME Cryptographic Signature


Re: [gentoo-user] Re: Simple SMTP to cmd-line MTA relay?

2018-01-19 Thread Alan McKinnon
On 19/01/2018 22:03, Grant Edwards wrote:
> On 2018-01-19, Alan McKinnon  wrote:
>> On 19/01/2018 21:54, Grant Edwards wrote:
>>> On 2018-01-19, Ian Zimmerman  wrote:
 On 2018-01-19 18:49, Grant Edwards wrote:

>> Just like the others writing in this thread, I am wondering why you
>> need 2 pieces here.  Why won't e.g. exim do both sides of this for
>> you?  It certainly has all the functionality.
>
> I don't see how you can say that when you don't know the method that
> my command-line MTA uses to transfer mail on down the path towards
> delivery.

 I can say it because I have some experience with exim, and I know it can
 do pretty much anything.  If its configuration language isn't Turing
 complete, it is quite damn close to it.  And the same can be said of
 sendmail, though I know much less about it know.
>>>
>>> Can exim transfer mail to an Exchange server that doesn't expose an
>>> SMTP server?
>>
>> Errr, no. exim does SMTP.
>>
>> If the above is what you need, any orthodox mail server would need to
>> hand the mail over to something that *can* deliver to Exchange.
> 
> Yes, and that something is my existing command-line MTA utility that
> has the same usage as /usr/bin/sendmail.
> 

Got it now.

-- 
Alan McKinnon
alan.mckin...@gmail.com




Re: [gentoo-user] Re: Simple SMTP to cmd-line MTA relay?

2018-01-19 Thread Alan McKinnon
On 19/01/2018 22:01, Grant Edwards wrote:
> On 2018-01-19, Alan McKinnon  wrote:
>> On 19/01/2018 21:43, Ian Zimmerman wrote:
>>> On 2018-01-19 18:49, Grant Edwards wrote:
>>>
> Just like the others writing in this thread, I am wondering why you
> need 2 pieces here.  Why won't e.g. exim do both sides of this for
> you?  It certainly has all the functionality.

 I don't see how you can say that when you don't know the method that
 my command-line MTA uses to transfer mail on down the path towards
 delivery.
>>>
>>> I can say it because I have some experience with exim, and I know it can
>>> do pretty much anything.  If its configuration language isn't Turing
>>> complete, it is quite damn close to it.  And the same can be said of
>>> sendmail, though I know much less about it know.
>>
>> I'm also wondering why you need 2 bits. Earlier in the thread you
>> mentioned that you send perhaps a few messages a week and never more
>> than one connection at a time.
>>
>> Why do you need anything more complex than ssmtp?
> 
> I'm not just _sending_ mail.  I'm relaying mail that's being sent by
> another host.  I need an SMTP server that supports AUTH and SSL.

OK

> 
>> where are the messages coming from?  localhost?  the lan? somewhere
>> on the internet?
> 
> SMTP clients (on the Internet).  I thought that was sort of implied by
> the requirement for an SMTP server (with AUTH and SSL).

Well, sort of implied. The door was still open for all manner of other
interpretations. Eg, you have 10 staff but only 2 may send mail, so
authorize them by username and password - ssl, no internet. There are
many other possibles

> 
>> Grant, you should explain your requirements in detail.
> 
> I thought I did.
> 
> My requirement is to provide an SMTP server (with AUTH and SSL) that
> accepts mail and relays it by invoking a command-line utility that has
> the same usage as /usr/bin/sendmail.

Is it correct to assume this sendmail-like utility is the broken one
that does the next step as you want it, presumably delivering to Exchange?

Configure the delivery options in MTA you set up to pipe the mail to
this sendmail-like app. All MTAs can do that and they usually explain
how to at length in their docs

-- 
Alan McKinnon
alan.mckin...@gmail.com




[gentoo-user] Re: Simple SMTP to cmd-line MTA relay?

2018-01-19 Thread Grant Edwards
On 2018-01-19, Alan McKinnon  wrote:
> On 19/01/2018 21:54, Grant Edwards wrote:
>> On 2018-01-19, Ian Zimmerman  wrote:
>>> On 2018-01-19 18:49, Grant Edwards wrote:
>>>
> Just like the others writing in this thread, I am wondering why you
> need 2 pieces here.  Why won't e.g. exim do both sides of this for
> you?  It certainly has all the functionality.

 I don't see how you can say that when you don't know the method that
 my command-line MTA uses to transfer mail on down the path towards
 delivery.
>>>
>>> I can say it because I have some experience with exim, and I know it can
>>> do pretty much anything.  If its configuration language isn't Turing
>>> complete, it is quite damn close to it.  And the same can be said of
>>> sendmail, though I know much less about it know.
>> 
>> Can exim transfer mail to an Exchange server that doesn't expose an
>> SMTP server?
>
> Errr, no. exim does SMTP.
>
> If the above is what you need, any orthodox mail server would need to
> hand the mail over to something that *can* deliver to Exchange.

Yes, and that something is my existing command-line MTA utility that
has the same usage as /usr/bin/sendmail.

-- 
Grant Edwards   grant.b.edwardsYow! HELLO KITTY gang
  at   terrorizes town, family
  gmail.comSTICKERED to death!




Re: [gentoo-user] Re: Simple SMTP to cmd-line MTA relay?

2018-01-19 Thread Grant Taylor

On 01/19/2018 12:48 PM, Alan McKinnon wrote:
I'm also wondering why you need 2 bits. Earlier in the thread you 
mentioned that you send perhaps a few messages a week and never more 
than one connection at a time.


Grant E. has indicated elsewhere in the thread that his 
/usr/bin/sendmail script is speaking something custom to the destination 
mail server.


Read:  /usr/bin/sendmail script is NOT speaking SMTP.

Why do you need anything more complex than ssmtp?  where are the messages 
coming from? localhost? the lan? somewhere on the internet?


Do you know what protocol(s) that Grant E.'s /usr/bin/sendmail script is 
speaking?  Do you know if ssmtp (et al) support it?


I feel like Grant E. has not revealed enough information to know if 
other things can speak what ever custom communications is possible 
between the SMTP server and the destination mail server.  He has only 
revealed enough to know that it is custom, and that his 
/usr/bin/sendmail interface script must be used.


Grant, you should explain your requirements in detail, and not describe 
what you currently have (broken, as you say). Otherwise I'm going to 
give you boilerplate advice:


Arguably Grant E. has described his requirements.  -  That being said, 
questioning the motivation behind the requirements is worth exploring 
far enough to see if it's pertinent.


Grant E. has also, revealed that the broken bit is more the lack of 
functional encryption support, not lack of overall functionality.  Thus 
I feel like "currently have (broken, as you say)" is inaccurate.


Use ssmtp, unless the mail isn't coming from localhost and you need simple 
(use postfix); otherwise if your setup is tricky use exim.


I don't think there is enough information to know that ssmtp / postfix / 
exim / sendmail / et al are capable of speaking the protocols that Grant 
E. needs or wants.




--
Grant. . . .
unix || die



smime.p7s
Description: S/MIME Cryptographic Signature


[gentoo-user] Re: Simple SMTP to cmd-line MTA relay?

2018-01-19 Thread Grant Edwards
On 2018-01-19, Alan McKinnon  wrote:
> On 19/01/2018 21:43, Ian Zimmerman wrote:
>> On 2018-01-19 18:49, Grant Edwards wrote:
>> 
 Just like the others writing in this thread, I am wondering why you
 need 2 pieces here.  Why won't e.g. exim do both sides of this for
 you?  It certainly has all the functionality.
>>>
>>> I don't see how you can say that when you don't know the method that
>>> my command-line MTA uses to transfer mail on down the path towards
>>> delivery.
>> 
>> I can say it because I have some experience with exim, and I know it can
>> do pretty much anything.  If its configuration language isn't Turing
>> complete, it is quite damn close to it.  And the same can be said of
>> sendmail, though I know much less about it know.
>
> I'm also wondering why you need 2 bits. Earlier in the thread you
> mentioned that you send perhaps a few messages a week and never more
> than one connection at a time.
>
> Why do you need anything more complex than ssmtp?

I'm not just _sending_ mail.  I'm relaying mail that's being sent by
another host.  I need an SMTP server that supports AUTH and SSL.

> where are the messages coming from?  localhost?  the lan? somewhere
> on the internet?

SMTP clients (on the Internet).  I thought that was sort of implied by
the requirement for an SMTP server (with AUTH and SSL).

> Grant, you should explain your requirements in detail.

I thought I did.

My requirement is to provide an SMTP server (with AUTH and SSL) that
accepts mail and relays it by invoking a command-line utility that has
the same usage as /usr/bin/sendmail.

-- 
Grant Edwards   grant.b.edwardsYow! I'm a nuclear
  at   submarine under the
  gmail.compolar ice cap and I need
   a Kleenex!




Re: [gentoo-user] Re: Simple SMTP to cmd-line MTA relay?

2018-01-19 Thread Alan McKinnon
On 19/01/2018 21:54, Grant Edwards wrote:
> On 2018-01-19, Ian Zimmerman  wrote:
>> On 2018-01-19 18:49, Grant Edwards wrote:
>>
 Just like the others writing in this thread, I am wondering why you
 need 2 pieces here.  Why won't e.g. exim do both sides of this for
 you?  It certainly has all the functionality.
>>>
>>> I don't see how you can say that when you don't know the method that
>>> my command-line MTA uses to transfer mail on down the path towards
>>> delivery.
>>
>> I can say it because I have some experience with exim, and I know it can
>> do pretty much anything.  If its configuration language isn't Turing
>> complete, it is quite damn close to it.  And the same can be said of
>> sendmail, though I know much less about it know.
> 
> Can exim transfer mail to an Exchange server that doesn't expose an
> SMTP server?
> 

Errr, no. exim does SMTP.

If the above is what you need, any orthodox mail server would need to
hand the mail over to something that *can* deliver to Exchange.



-- 
Alan McKinnon
alan.mckin...@gmail.com




[gentoo-user] Re: Simple SMTP to cmd-line MTA relay?

2018-01-19 Thread Grant Edwards
On 2018-01-19, Ian Zimmerman  wrote:
> On 2018-01-19 18:49, Grant Edwards wrote:
>
>> > Just like the others writing in this thread, I am wondering why you
>> > need 2 pieces here.  Why won't e.g. exim do both sides of this for
>> > you?  It certainly has all the functionality.
>> 
>> I don't see how you can say that when you don't know the method that
>> my command-line MTA uses to transfer mail on down the path towards
>> delivery.
>
> I can say it because I have some experience with exim, and I know it can
> do pretty much anything.  If its configuration language isn't Turing
> complete, it is quite damn close to it.  And the same can be said of
> sendmail, though I know much less about it know.

Can exim transfer mail to an Exchange server that doesn't expose an
SMTP server?

-- 
Grant Edwards   grant.b.edwardsYow! It's the RINSE CYCLE!!
  at   They've ALL IGNORED the
  gmail.comRINSE CYCLE!!




Re: [gentoo-user] Re: Simple SMTP to cmd-line MTA relay?

2018-01-19 Thread Alan McKinnon
On 19/01/2018 21:43, Ian Zimmerman wrote:
> On 2018-01-19 18:49, Grant Edwards wrote:
> 
>>> Just like the others writing in this thread, I am wondering why you
>>> need 2 pieces here.  Why won't e.g. exim do both sides of this for
>>> you?  It certainly has all the functionality.
>>
>> I don't see how you can say that when you don't know the method that
>> my command-line MTA uses to transfer mail on down the path towards
>> delivery.
> 
> I can say it because I have some experience with exim, and I know it can
> do pretty much anything.  If its configuration language isn't Turing
> complete, it is quite damn close to it.  And the same can be said of
> sendmail, though I know much less about it know.
> 

I'm also wondering why you need 2 bits. Earlier in the thread you
mentioned that you send perhaps a few messages a week and never more
than one connection at a time.

Why do you need anything more complex than ssmtp?
where are the messages coming from? localhost? the lan? somewhere on the
internet?

Grant, you should explain your requirements in detail, and not describe
what you currently have (broken, as you say). Otherwise I'm going to
give you boilerplate advice:

Use ssmtp, unless the mail isn't coming from localhost and you need
simple (use postfix); otherwise if your setup is tricky use exim.

-- 
Alan McKinnon
alan.mckin...@gmail.com




[gentoo-user] Re: Simple SMTP to cmd-line MTA relay?

2018-01-19 Thread Grant Edwards
On 2018-01-19, Grant Taylor  wrote:
> On 01/19/2018 11:38 AM, Grant Edwards wrote:
>
>> I have a /usr/bin/sendmail emulator that transfers mail to an MTA
>> that will then worry about delivery.  I need an SMTP server that
>> will relay incoming mail by using that existing command-line
>> utility.
> …
>> I need something that accepts mail via SMTP (with SSL and AUTH
>> support), and then relays each received message by invoking a
>> command line utilty that has the same API as /usr/bin/sendmail.
>
> You want (what Sendmail calls) a custom mailer.

Yep, and it looks like the Postfix equivalent is a custom pipe
transport.  Once you know what phrases to google for, it's a lot
easier. :)

>> I would very much prefer that there is no queueing: the smtp server
>> should not acknowlege acceptance of the message until the smtp
>> server has invoked /usr/bin/sendmail and it has returned success.
>
> That's possible.  But it does add some additional constraints.  It
> also means that traditional MTAs likely won't operate the way that
> you want this to.

I could live with queueing/retrying as long as the eventual failures
generated messages that are sent back to the sender.  Those failure
messages would need to be sent via a normal SMTP smarthost/relayhost
(with AUTH) and not via the custom mailer.

> Have you tried putting ssltunnel (or the likes) in front of your
> existing SMTP server to see if it (they) can handle STARTTLS for
> you?  - Is it possible to augment your existing solution without
> needing to replace it?

Yes, I've been thinking about that.  I think I'll try that first -- if
my understanding of the failure mode is correct, it should work.

> Also, this sounds use case specific enough that I would consider
> going back to the person maintaining the scrip SMTP server that
> you're currently using and try to fix it.

I wrote the server I'm using now, but it uses somebody else's snmpd
module, and that's where the SSL breakage is.  I've filed a bug, and
I've been doing some reading toward attempting a fix, but it looks
like it might be a bit hairy: it involves Python's asyncore/asynchat
framework (and process pools).  What's missing is handling for ssl
"want read" and "want write" exceptions.

-- 
Grant Edwards   grant.b.edwardsYow! FEELINGS are cascading
  at   over me!!!
  gmail.com




[gentoo-user] Re: Simple SMTP to cmd-line MTA relay?

2018-01-19 Thread Ian Zimmerman
On 2018-01-19 18:49, Grant Edwards wrote:

> > Just like the others writing in this thread, I am wondering why you
> > need 2 pieces here.  Why won't e.g. exim do both sides of this for
> > you?  It certainly has all the functionality.
> 
> I don't see how you can say that when you don't know the method that
> my command-line MTA uses to transfer mail on down the path towards
> delivery.

I can say it because I have some experience with exim, and I know it can
do pretty much anything.  If its configuration language isn't Turing
complete, it is quite damn close to it.  And the same can be said of
sendmail, though I know much less about it know.

-- 
Please don't Cc: me privately on mailing lists and Usenet,
if you also post the followup to the list or newsgroup.
To reply privately _only_ on Usenet, fetch the TXT record for the domain.



Re: [gentoo-user] Re: Simple SMTP to cmd-line MTA relay?

2018-01-19 Thread Grant Taylor

On 01/19/2018 11:59 AM, Grant Edwards wrote:
I meant the sematics and sytax of the command line options and the data 
accepted on stdin and produced on stdout.  I probably should have said 
"usage" rather than API.  Since I always use that utility from a Python 
or Bash program, in my head that's its API.


I figured that's what you mean.  I agree that's effectively what it has 
become.


I think I've read too many "the command line is not an API" blog 
articles recently.



Exactly.


;-)


Thanks.


You're welcome.


I was sort of afraid that sendmail was going to be the answer.


Not necessarily.

I expect that any modern MTA can be configured to behave the same way.

The last time I ran sendmail was on a Sun-3/60 machine, and I never did 
quite understand how to configure it...


Wow.  I bet that was pre-m4 configuration days.  -  I've been running 
Sendmail (by choice) for ~18 years and have always used m4 to configure 
it.  -  From what I've heard, the pre-m4 days were a LOT more difficult.


I expect that what you're wanting to do can be done in less than an 
hour.  Maybe even less than half an hour.


Let me know if you want pointers from a Sendmail vet that's built 
(re)built a Gentoo server with Sendmail, functioning as a backup MX w/ 
filtering, in the last month.  (I converted from CentOS 6.x to Gentoo - 
17.0 profile.)




--
Grant. . . .
unix || die



smime.p7s
Description: S/MIME Cryptographic Signature


[gentoo-user] Re: Simple SMTP to cmd-line MTA relay?

2018-01-19 Thread Grant Edwards
On 2018-01-19, Grant Taylor  wrote:

> So you don't need to accept mail via /usr/sbin/sendmail (et al).

Correct.

> Or rather, that's what you want email to leave the relay through.

Correct.

>> I want to relay each of those messages by invoking a command-line
>> utility that has the same "API" as /usr/bin/sendmail.  That utility
>> injects the mail into another machine's MTA.
>
> Okay.
>
> Aside: I don't know that I would consider that to be an API, but I
> do see why you consider it as such.

I meant the sematics and sytax of the command line options and the
data accepted on stdin and produced on stdout.  I probably should have
said "usage" rather than API.  Since I always use that utility from a
Python or Bash program, in my head that's its API.

>> In this case, the /usr/bin/sendmail utility transfers the message
>> to a different machine's MTA using mechanisms that are beyond the
>> scope of my question.
>
> Okay.
>
> So it sounds to me like you want a gateway of sorts that speaks SMTP
> (as a server to clients) on one side and  method> (that acts as a client to other servers) on the other side.
> Is that accurate?

Exactly.

> In Sendmail parlance, what you want is a custom mailer.  Said custom
> mailer would then interface with your custom /usr/bin/sendmail
> (emulation wrapper).
>
> Finally, configure Sendmail to use said custom mailer as the method
> to communicate with the smart host.

Thanks.

I was sort of afraid that sendmail was going to be the answer. :)

The last time I ran sendmail was on a Sun-3/60 machine, and I never
did quite understand how to configure it...

-- 
Grant Edwards   grant.b.edwardsYow! Loni Anderson's hair
  at   should be LEGALIZED!!
  gmail.com




Re: [gentoo-user] Re: Simple SMTP to cmd-line MTA relay?

2018-01-19 Thread Grant Taylor

On 01/19/2018 11:38 AM, Grant Edwards wrote:
I have a /usr/bin/sendmail emulator that transfers mail to an MTA that 
will then worry about delivery.  I need an SMTP server that will relay 
incoming mail by using that existing command-line utility.


…

I need something that accepts mail via SMTP (with SSL and AUTH support), 
and then relays each received message by invoking a command line utilty 
that has the same API as /usr/bin/sendmail.


You want (what Sendmail calls) a custom mailer.


There is no local delivery and no acceptance of mail other than via SMTP.


That's probably mostly immaterial.  Aside from the fact that you would 
not add those features if you were write a custom SMTP gateway.  Most 
MTAs will have that, but it can be ignored.


I would very much prefer that there is no queueing: the smtp server 
should not acknowlege acceptance of the message until the smtp server 
has invoked /usr/bin/sendmail and it has returned success.


That's possible.  But it does add some additional constraints.  It also 
means that traditional MTAs likely won't operate the way that you want 
this to.


Have you tried putting ssltunnel (or the likes) in front of your 
existing SMTP server to see if it (they) can handle STARTTLS for you?  - 
 Is it possible to augment your existing solution without needing to 
replace it?


Also, this sounds use case specific enough that I would consider going 
back to the person maintaining the scrip SMTP server that you're 
currently using and try to fix it.




--
Grant. . . .
unix || die



smime.p7s
Description: S/MIME Cryptographic Signature


[gentoo-user] Re: Simple SMTP to cmd-line MTA relay?

2018-01-19 Thread Grant Edwards
On 2018-01-19, Ian Zimmerman  wrote:
> On 2018-01-19 18:03, Grant Edwards wrote:
>
>> It needs to accept messages as an SMTP server (using SSL and AUTH on a
>> non-standard port) from a single user and single source and then relay
>> them by passing them to a command-line MTA (e.g. /usr/bin/sendmail
>> replacement provided by msmtp).
>
> Just like the others writing in this thread, I am wondering why you need
> 2 pieces here.  Why won't e.g. exim do both sides of this for you?
> It certainly has all the functionality.

I don't see how you can say that when you don't know the method that
my command-line MTA uses to transfer mail on down the path towards
delivery.

-- 
Grant Edwards   grant.b.edwardsYow! I was born in a
  at   Hostess Cupcake factory
  gmail.combefore the sexual
   revolution!




Re: [gentoo-user] Re: Simple SMTP to cmd-line MTA relay?

2018-01-19 Thread Grant Taylor

On 01/19/2018 11:31 AM, Grant Edwards wrote:

I want to accept incoming email via SMTP (my computer is an SMTP server).


Okay.

So you don't need to accept mail via /usr/sbin/sendmail (et al).

Or rather, that's what you want email to leave the relay through.

I want to relay each of those messages by invoking a command-line utility 
that has the same "API" as /usr/bin/sendmail.  That utility injects the 
mail into another machine's MTA.


Okay.

Aside:  I don't know that I would consider that to be an API, but I do 
see why you consider it as such.


In this case, the /usr/bin/sendmail utility transfers the message to a 
different machine's MTA using mechanisms that are beyond the scope of 
my question.


Okay.

There is no local delivery.  It is a relay that accepts mail via SMTP and 
transfers it to a different MTA.  The usual way to do this is to accept 
mail as an SMTP server and then relay it to the next MTA by acting as 
an SMTP client (e.g. via postfix's 'relayhost' setting).


Instead of transfering mail to the next MTA by acting as an SMTP client, 
I want to transfer it by invoking a command-line utility like sendmail 
or msmtp.


So it sounds to me like you want a gateway of sorts that speaks SMTP (as 
a server to clients) on one side and  (that 
acts as a client to other servers) on the other side.  Is that accurate?


In Sendmail parlance, what you want is a custom mailer.  Said custom 
mailer would then interface with your custom /usr/bin/sendmail 
(emulation wrapper).


Finally, configure Sendmail to use said custom mailer as the method to 
communicate with the smart host.




--
Grant. . . .
unix || die



smime.p7s
Description: S/MIME Cryptographic Signature


[gentoo-user] Re: Simple SMTP to cmd-line MTA relay?

2018-01-19 Thread Ian Zimmerman
On 2018-01-19 18:03, Grant Edwards wrote:

> It needs to accept messages as an SMTP server (using SSL and AUTH on a
> non-standard port) from a single user and single source and then relay
> them by passing them to a command-line MTA (e.g. /usr/bin/sendmail
> replacement provided by msmtp).

Just like the others writing in this thread, I am wondering why you need
2 pieces here.  Why won't e.g. exim do both sides of this for you?  It
certainly has all the functionality.

-- 
Please don't Cc: me privately on mailing lists and Usenet,
if you also post the followup to the list or newsgroup.
To reply privately _only_ on Usenet, fetch the TXT record for the domain.



[gentoo-user] Re: Simple SMTP to cmd-line MTA relay?

2018-01-19 Thread Grant Edwards
On 2018-01-19, Grant Taylor  wrote:

> I haven't done enough with the above (alternate) MTAs to be able to
> speak to them.  But my understanding is that they come with a
> /path/to/sendmail wrapper script (or binary) that emulates part of
> what the sendmail binary did.  At least the portions there of that
> clients use to submit email the way that you're talking.

I have a /usr/bin/sendmail emulator that transfers mail to an MTA that
will then worry about delivery.  I need an SMTP server that will relay
incoming mail by using that existing command-line utility.

>> I'm currently using something I wrote in Python, but the SSL
>> support in the 3rd party SMTP module is broken and I don't relish
>> trying to fix it.
>
> Do you actually need a local MTA (daemon)?  Or do you just need
> something smart enough to accept messages from standard in and pass
> them out via a smart host?

I need something that accepts mail via SMTP (with SSL and AUTH
support), and then relays each received message by invoking a command
line utilty that has the same API as /usr/bin/sendmail.

There is no local delivery and no acceptance of mail other than via
SMTP.  

I would very much prefer that there is no queueing: the smtp server
should not acknowlege acceptance of the message until the smtp server
has invoked /usr/bin/sendmail and it has returned success.

-- 
Grant Edwards   grant.b.edwardsYow! I've read SEVEN
  at   MILLION books!!
  gmail.com




[gentoo-user] Re: Simple SMTP to cmd-line MTA relay?

2018-01-19 Thread Grant Edwards
On 2018-01-19, Ralph Seichter  wrote:
> On 19.01.18 19:03, Grant Edwards wrote:
>
>> I need to setup an SMTP relay server.
>>
>> It needs to accept messages as an SMTP server (using SSL and AUTH on a
>> non-standard port) from a single user and single source and then relay
>> them by passing them to a command-line MTA (e.g. /usr/bin/sendmail
>> replacement provided by msmtp).
>
> Based on your description you seem to have things backward.

I want to accept incoming email via SMTP (my computer is an SMTP server).

I want to relay each of those messages by invoking a command-line
utility that has the same "API" as /usr/bin/sendmail.  That utility
injects the mail into another machine's MTA.

> Sendmail is used to inject mail into an MTA on the local machine,
> and the MTA can then use SMTP to transfer said mail to another
> server.

In this case, the /usr/bin/sendmail utility transfers the message to a
different machine's MTA using mechanisms that are beyond the scope of
my question.

> If the final recipient (i.e. mailbox) is on the same server the mail is
> generated on, the MTA can use a local transport mechanism to store mail
> instead of passing it on via SMTP.

There is no local delivery.  It is a relay that accepts mail via SMTP
and transfers it to a different MTA.  The usual way to do this is to
accept mail as an SMTP server and then relay it to the next MTA by
acting as an SMTP client (e.g. via postfix's 'relayhost' setting).

Instead of transfering mail to the next MTA by acting as an SMTP
client, I want to transfer it by invoking a command-line utility like
sendmail or msmtp.
 
> I suggest you clarify your goal, and ask on the Postfix mailing list
> (or Exim, etc.) for more information.

Will do.

-- 
Grant Edwards   grant.b.edwardsYow! Everywhere I look I
  at   see NEGATIVITY and ASPHALT
  gmail.com...