Re: [PLUG] Execute Script Via Email

2021-01-21 Thread TomasK
This seems to be such bad idea - security.

Would not it make sense to use some traceable, authenticated and secure
way of doing this - vpn or ssh to local network then ssh to the client?

Just saying, Tomas

PS:
I bet there are easier way to shoot yourself in the foot than making
computers execute stuff from email. Unless of course you are building
backdoor for the time you no longer work there.

On Thu, 2021-01-21 at 21:53 -0800, Ken Stephens wrote:
> I set up a printing queue in 1991 using a shell script that polled a
> directory for a file.  You could set up email users for each command
> and
> have the script poll the mail queues.  It would execute a given
> command for
> each user.  There is always another way to do it in Linux.
> 
> Ken
> 
> On Thu, Jan 21, 2021 at 7:35 PM Ben Koenig 
> wrote:
> 
> > 
> > On 1/21/21 12:05 PM, Ali Corbin wrote:
> > > On Thu, Jan 21, 2021 at 8:11 AM Michael Barnes  > > .com>
> > > wrote:
> > > 
> > > > Is there a way to execute a script via email? I have a machine
> > > > that does
> > > > several monitoring tasks of equipment. When certain conditions
> > > > are
> > 
> > detected
> > > > and at scheduled times, the machine sends status emails to me.
> > > > I would
> > 
> > like
> > > > to send an email back to execute a script to perform tasks.
> > > > 
> > > > Is there an easy way to do this?
> > > > 
> > > 
> > > I  suspect that it's not easy, but I'm sure it's possible,
> > > because you
> > 
> > can
> > > set up blogger.com to create a post from an email sent to
> > 
> > som...@blogger.com
> > > . Unfortunately, the mechanism that actually does it will be on
> > > their
> > > servers in a place that's not visible.  Perhaps a google search
> > > might
> > > explain how they do this.
> > 
> > 
> > There are actually a few more steps in that process. Most web
> > interfaces
> > for blogs or support ticket databases are actually scanning a
> > configured
> > email inbox on a routine basis. Sometimes this is a cron job or
> > other
> > process running as a daemon on the web server. Every time this
> > process
> > scans the inbox, any new emails are parsed and operated on
> > according to
> > various filters.
> > 
> > 
> > I set one of these up back in 2019. We configured osTicket to scan
> > our
> > support@ inbox every 60 seconds. Any emails it found would be
> > ingested
> > as tickets in the SQL database and then moved to a "read" box for
> > archival purposes if osTicket went down. Pretty sure that was all
> > just
> > PHP code in osTicket...all I did was click buttons.
> > 
> > 
> > Blogs and other web frameworks do all kinds of things in respond to
> > email. Once an email client opens a message it can basically do
> > whatever
> > it wants. By default Thunderbird does every time an email is
> > received.
> > Those notifications you receive in the corner of your screen are
> > typically part of an external program, not your email client.
> > 
> > 
> > If your email client can execute 'notify-send "$EMAIL_SUBJECT"
> > "$EMAIL_BODY" ' in response to an email, it can execute any program
> > accessible to the user it runs as. Trying to do this as part of the
> > email server process seems like an excessive amount of work if you
> > ask me.
> > 
> > 
> > Sounds like all we need is an email client that supports running
> > arbitrary commands when filtering emails..
> > 
> > -Ben
> > 
> > ___
> > PLUG: https://pdxlinux.org
> > PLUG mailing list
> > PLUG@pdxlinux.org
> > http://lists.pdxlinux.org/mailman/listinfo/plug
> > 
> 
> ___
> PLUG: https://pdxlinux.org
> PLUG mailing list
> PLUG@pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
___
PLUG: https://pdxlinux.org
PLUG mailing list
PLUG@pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug


Re: [PLUG] Execute Script Via Email

2021-01-21 Thread Ken Stephens
I set up a printing queue in 1991 using a shell script that polled a
directory for a file.  You could set up email users for each command and
have the script poll the mail queues.  It would execute a given command for
each user.  There is always another way to do it in Linux.

Ken

On Thu, Jan 21, 2021 at 7:35 PM Ben Koenig  wrote:

>
> On 1/21/21 12:05 PM, Ali Corbin wrote:
> > On Thu, Jan 21, 2021 at 8:11 AM Michael Barnes 
> > wrote:
> >
> >> Is there a way to execute a script via email? I have a machine that does
> >> several monitoring tasks of equipment. When certain conditions are
> detected
> >> and at scheduled times, the machine sends status emails to me. I would
> like
> >> to send an email back to execute a script to perform tasks.
> >>
> >> Is there an easy way to do this?
> >>
> > I  suspect that it's not easy, but I'm sure it's possible, because you
> can
> > set up blogger.com to create a post from an email sent to
> som...@blogger.com
> > . Unfortunately, the mechanism that actually does it will be on their
> > servers in a place that's not visible.  Perhaps a google search might
> > explain how they do this.
>
>
> There are actually a few more steps in that process. Most web interfaces
> for blogs or support ticket databases are actually scanning a configured
> email inbox on a routine basis. Sometimes this is a cron job or other
> process running as a daemon on the web server. Every time this process
> scans the inbox, any new emails are parsed and operated on according to
> various filters.
>
>
> I set one of these up back in 2019. We configured osTicket to scan our
> support@ inbox every 60 seconds. Any emails it found would be ingested
> as tickets in the SQL database and then moved to a "read" box for
> archival purposes if osTicket went down. Pretty sure that was all just
> PHP code in osTicket...all I did was click buttons.
>
>
> Blogs and other web frameworks do all kinds of things in respond to
> email. Once an email client opens a message it can basically do whatever
> it wants. By default Thunderbird does every time an email is received.
> Those notifications you receive in the corner of your screen are
> typically part of an external program, not your email client.
>
>
> If your email client can execute 'notify-send "$EMAIL_SUBJECT"
> "$EMAIL_BODY" ' in response to an email, it can execute any program
> accessible to the user it runs as. Trying to do this as part of the
> email server process seems like an excessive amount of work if you ask me.
>
>
> Sounds like all we need is an email client that supports running
> arbitrary commands when filtering emails..
>
> -Ben
>
> ___
> PLUG: https://pdxlinux.org
> PLUG mailing list
> PLUG@pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
>
___
PLUG: https://pdxlinux.org
PLUG mailing list
PLUG@pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug


Re: [PLUG] Execute Script Via Email

2021-01-21 Thread Ben Koenig



On 1/21/21 12:05 PM, Ali Corbin wrote:

On Thu, Jan 21, 2021 at 8:11 AM Michael Barnes 
wrote:


Is there a way to execute a script via email? I have a machine that does
several monitoring tasks of equipment. When certain conditions are detected
and at scheduled times, the machine sends status emails to me. I would like
to send an email back to execute a script to perform tasks.

Is there an easy way to do this?


I  suspect that it's not easy, but I'm sure it's possible, because you can
set up blogger.com to create a post from an email sent to som...@blogger.com
. Unfortunately, the mechanism that actually does it will be on their
servers in a place that's not visible.  Perhaps a google search might
explain how they do this.



There are actually a few more steps in that process. Most web interfaces 
for blogs or support ticket databases are actually scanning a configured 
email inbox on a routine basis. Sometimes this is a cron job or other 
process running as a daemon on the web server. Every time this process 
scans the inbox, any new emails are parsed and operated on according to 
various filters.



I set one of these up back in 2019. We configured osTicket to scan our 
support@ inbox every 60 seconds. Any emails it found would be ingested 
as tickets in the SQL database and then moved to a "read" box for 
archival purposes if osTicket went down. Pretty sure that was all just 
PHP code in osTicket...all I did was click buttons.



Blogs and other web frameworks do all kinds of things in respond to 
email. Once an email client opens a message it can basically do whatever 
it wants. By default Thunderbird does every time an email is received. 
Those notifications you receive in the corner of your screen are 
typically part of an external program, not your email client.



If your email client can execute 'notify-send "$EMAIL_SUBJECT" 
"$EMAIL_BODY" ' in response to an email, it can execute any program 
accessible to the user it runs as. Trying to do this as part of the 
email server process seems like an excessive amount of work if you ask me.



Sounds like all we need is an email client that supports running 
arbitrary commands when filtering emails..


-Ben

___
PLUG: https://pdxlinux.org
PLUG mailing list
PLUG@pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug


Re: [PLUG] Execute Script Via Email

2021-01-21 Thread Ali Corbin
On Thu, Jan 21, 2021 at 8:11 AM Michael Barnes 
wrote:

> Is there a way to execute a script via email? I have a machine that does
> several monitoring tasks of equipment. When certain conditions are detected
> and at scheduled times, the machine sends status emails to me. I would like
> to send an email back to execute a script to perform tasks.
>
> Is there an easy way to do this?
>
I  suspect that it's not easy, but I'm sure it's possible, because you can
set up blogger.com to create a post from an email sent to som...@blogger.com
. Unfortunately, the mechanism that actually does it will be on their
servers in a place that's not visible.  Perhaps a google search might
explain how they do this.
___
PLUG: https://pdxlinux.org
PLUG mailing list
PLUG@pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug


Re: [PLUG] Execute Script Via Email

2021-01-21 Thread Galen Seitz

On 1/21/21 9:06 AM, Michael Barnes wrote:


I might not have been clear. I'm not looking for something that reacts to
the receipt of email. I need a given script to execute based on what is in
either the Subject or Body of the email. For example, I send an email to
mach...@somewhere.com with something like RESTART_FOO in the Subject or
Body and it would run the script RESTART_FOO. Another email sent to the
same address may say RESTART_BAR and execute that script.  From what I
understand, procmail simply reacts to an incoming email, regardless of what
is in that email.


I suspect that the extprograms plugin for Dovecot sieve is capable of 
doing this, but I have no experience with this myself.  I do use sieve 
to sort my incoming mail into separate folders, but I've never done 
anything beyond that.




galen
--
Galen Seitz
gal...@seitzassoc.com
___
PLUG: https://pdxlinux.org
PLUG mailing list
PLUG@pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug


Re: [PLUG] Execute Script Via Email

2021-01-21 Thread wes
On Thu, Jan 21, 2021 at 9:06 AM Michael Barnes 
wrote:

>
> I need a given script to execute based on what is in
> either the Subject or Body of the email. For example, I send an email to
> mach...@somewhere.com with something like RESTART_FOO in the Subject or
> Body and it would run the script RESTART_FOO. Another email sent to the
> same address may say RESTART_BAR and execute that script.  From what I
> understand, procmail simply reacts to an incoming email, regardless of what
> is in that email.
>

What MTA are you using? Most of the big ones support directing emails to an
arbitrary executable on the system via the | directive. This is, of course,
terribly insecure so you may have to jump through hoops to enable this
behavior. I had quite an adventure getting it to work in exim, but it does
indeed work.

If the address for this was comm...@example.tld, /etc/aliases would contain:

command: "|/usr/local/bin/command-processor"

/opt/command/processor would be a shell script that looks for the key
values like RESTART_whatever and then takes action based on that input.

-wes
___
PLUG: https://pdxlinux.org
PLUG mailing list
PLUG@pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug


Re: [PLUG] Execute Script Via Email

2021-01-21 Thread Michael Barnes
On Thu, Jan 21, 2021 at 8:47 AM Rich Shepard 
wrote:

> On Thu, 21 Jan 2021, David wrote:
>
> > I'm not sure about the "easy" part, but take a look at procmail and its
> > recipes.
> >
> > I don't use it, but the utility ingests mail, analyzes it, and then
> "takes an
> > action" which is generally just a routing of some sort.
> >
> > There shouldn't be any reason why you might be able to trigger a script
> > instead.
>
> dafr,
>
> I do use procmail (to route messages to the appropriate file). It would not
> work for Michael's needs because it distributes arriving messages.
>
> From the procmail man page: " Procmail should be invoked automatically over
> the .forward file mechanism as soon as mail arrives. Alternatively, when
> installed by a system administrator, it can be invoked from within the
> mailer immediately. When invoked, it first sets some environment variables
> to default values, reads the mail message from stdin until an EOF,
> separates
> the body from the header, and then, if no command line arguments are
> present, it starts to look for a file named $HOME/.procmailrc. According to
> the processing recipes in this file, the mail message that just arrived
> gets
> distributed into the right folder (and more). If no rcfile is found, or
> processing of the rcfile falls off the end, procmail will store the mail in
> the default system mail‐ box."
>
> Rich
>

I might not have been clear. I'm not looking for something that reacts to
the receipt of email. I need a given script to execute based on what is in
either the Subject or Body of the email. For example, I send an email to
mach...@somewhere.com with something like RESTART_FOO in the Subject or
Body and it would run the script RESTART_FOO. Another email sent to the
same address may say RESTART_BAR and execute that script.  From what I
understand, procmail simply reacts to an incoming email, regardless of what
is in that email.

Michael
___
PLUG: https://pdxlinux.org
PLUG mailing list
PLUG@pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug


Re: [PLUG] Looking for stereo input USB audio adapter

2021-01-21 Thread Tomas Kuchta
On Thu, Jan 21, 2021, 11:32 Michael Barnes  wrote:

> On Thu, Jan 21, 2021 at 1:28 AM Russell Senior 
> wrote:
>
> > I recently discovered that most usb-audio adapters have stereo outputs
> > but single channel inputs. Does anyone know of devices with stereo
> > inputs and/or how to search for such things. The keyword stereo very
> > often will match on the output and I haven't found a way of searching
> > that excludes references to stereo outputs so I can find inputs.
> >
> > Thanks!
> >
> > --
> > Russell Senior
> > russ...@personaltelco.net
>
>
>
> How about one of these?
> Behringer U-Control UCA222 USB Audio Interface
> https://www.behringer.com/product.html?modelCode=P0A31
>
> https://www.amazon.com/Behringer-U-Control-UCA222-Ultra-Low-Interface/dp/B0023BYDHK
>
> .


There is cheaper version, currently out of stock

https://www.amazon.com/Behringer-U-Phono-UFO202-Audiophile-Interface/dp/B002GHBYZ0?ref_=ast_sto_dp

Or this one:
https://www.amazon.com/dp/B01J7P0OGI/?tag=headphonesty0420-20

I cannot find my analog stereo microphone to try on my dongle.

-T
___
PLUG: https://pdxlinux.org
PLUG mailing list
PLUG@pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug


Re: [PLUG] Execute Script Via Email

2021-01-21 Thread Rich Shepard

On Thu, 21 Jan 2021, David wrote:

I'm not sure about the "easy" part, but take a look at procmail and its 
recipes.


I don't use it, but the utility ingests mail, analyzes it, and then "takes an 
action" which is generally just a routing of some sort.


There shouldn't be any reason why you might be able to trigger a script 
instead.


dafr,

I do use procmail (to route messages to the appropriate file). It would not
work for Michael's needs because it distributes arriving messages.

From the procmail man page: " Procmail should be invoked automatically over
the .forward file mechanism as soon as mail arrives. Alternatively, when
installed by a system administrator, it can be invoked from within the
mailer immediately. When invoked, it first sets some environment variables
to default values, reads the mail message from stdin until an EOF, separates
the body from the header, and then, if no command line arguments are
present, it starts to look for a file named $HOME/.procmailrc. According to
the processing recipes in this file, the mail message that just arrived gets
distributed into the right folder (and more). If no rcfile is found, or
processing of the rcfile falls off the end, procmail will store the mail in
the default system mail‐ box."

Rich
___
PLUG: https://pdxlinux.org
PLUG mailing list
PLUG@pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug


Re: [PLUG] Execute Script Via Email

2021-01-21 Thread David

On 1/21/21 8:11 AM, Michael Barnes wrote:

Is there a way to execute a script via email? I have a machine that does
several monitoring tasks of equipment. When certain conditions are detected
and at scheduled times, the machine sends status emails to me. I would like
to send an email back to execute a script to perform tasks.

Is there an easy way to do this?


I'm not sure about the "easy" part, but take a look at procmail and its 
recipes.


I don't use it, but the utility ingests mail, analyzes it, and then 
"takes an action" which is generally just a routing of some sort.


There shouldn't be any reason why you might be able to trigger a script 
instead.


dafr
___
PLUG: https://pdxlinux.org
PLUG mailing list
PLUG@pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug


[PLUG] Execute Script Via Email

2021-01-21 Thread Michael Barnes
Is there a way to execute a script via email? I have a machine that does
several monitoring tasks of equipment. When certain conditions are detected
and at scheduled times, the machine sends status emails to me. I would like
to send an email back to execute a script to perform tasks.

Is there an easy way to do this?

Thanks,
Michael
___
PLUG: https://pdxlinux.org
PLUG mailing list
PLUG@pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug


[PLUG] Looking for stereo input USB audio adapter

2021-01-21 Thread Russell Senior
I recently discovered that most usb-audio adapters have stereo outputs
but single channel inputs. Does anyone know of devices with stereo
inputs and/or how to search for such things. The keyword stereo very
often will match on the output and I haven't found a way of searching
that excludes references to stereo outputs so I can find inputs.

Thanks!

-- 
Russell Senior
russ...@personaltelco.net
___
PLUG: https://pdxlinux.org
PLUG mailing list
PLUG@pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug