Mailing List Archive

Re: RFC: On rsyslog output modules and support forbatchoperations
> > There are a couple of subtleties, but I think it can work. In
> essence,
> > you need a template that feeds into the values via ($template!) and
> > also a config string for the prepared statement. It's actually not
> > even that hard to do. It may be useful (and of course doable) to
> > enable the property replace to escape special characters, so that,
> for
> > example, we could use CSV and replace commas by two of them.
>
> Making properties in CSV format is indeed a good idea.

I'll add a "csv" option to the property replacer. It will format a field
according to RFC 4180:

http://tools.ietf.org/html/rfc4180

I will always enclose values in double quotes to keep the code simple (I
think also on the parser side). Let me know if you think this approach is
useful.

>
> > > I bet it works. But it's probably too ugly for users. Cleaner ways
> > > may need deeper changes into rsyslog's API so that the module gets
> > > direct access to each field. That's probably a lot of work and I
> > > can't wait for that.
>
> > I need to check if there are actually larger changes required. The
> > main reason for this interface initially was security (do not pass to
> > the module the full object).
>
> It's a good reason. If it's easy to generate and pass a deep copy of
> the
> object (and it's not a performance killer, it shouldn't), we can
> discuss
> it. Otherwise, I don't think this is worth the effort.


I have done some review of the code. Not in-depth, but I think good enough. I
do have the message object available (thankfully, the optimization to store
just the strings did not yet take place ;)). Creating a deep copy is not
problematic and I'd assume typically bears roughly equivalent cost to
creating the template string (which is kind of expensive). There obviously
must be a new interface declared for this and your plugin should support both
the new and the old interface. It may be OK if you return RS_RET_DISABLED on
the first call to the old interface, what means a downlevel engine can not
use your plugin (acceptable from my POV).

Feature-Wise, however, I think you lose a couple of things. Most importantly,
the template processor & property replacer allows you to rewrite parts of the
message. If we pass in the plain message object, you lose this ability. So
any modifications must be made directly from within the plugin. I'd say
that's a big disadvantage.

As the scripting engine evolves, we will probably be able to overcome this
limitation by permitting modifications to message objects, but that's a long
way until we are there...


> > Assuming that I have the object available
> > at the time of the plugin call, I could use a different entry point
> to
> > pass that data in. If so, that would not be too much effort. Security
> > concerns could be (somewhat) addressed by a config statement which
> > enables such object access for the next action, so one could
> > specifically grant that privilege.
>
> I'm not quite sure about this: if two entries request direct access to
> the same object, one is buggy and modifies it, then the second one can
> suffer unpredictable consequences. I think it's better to pass a deep
> copy, free it once the module call returns, and do it only for modules
> that actually need that new entry point. If such deep copies are
> expensive, then we are just fine the way we are now.

Agreed, but I think a deep copy does not address anything. With the template
system (in theory but not yet in practice), a plugin can not access any
information other than what the users has configured in the template. If the
full object is passed, this can not prevented. In practice, today, plugins
are loaded in-process and as such can access the whole process space. But
there are ideas to create an out-of-process plugin interface for very
security sensitive environments. They would be hurt (or require additional
configuration) but the "full object access" approach.

Feedback is appreciated.

Rainer
>
> Cheers.
>
>
> --
> Luis Fernando Muñoz Mejías
> Luis.Fernando.Munoz.Mejias@cern.ch
> _______________________________________________
> rsyslog mailing list
> http://lists.adiscon.net/mailman/listinfo/rsyslog
> http://www.rsyslog.com
_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com
Re: RFC: On rsyslog output modules and support forbatchoperations [ In reply to ]
El Jueves, 2 de Abril de 2009 12:03, Rainer Gerhards escribió:
> > Making properties in CSV format is indeed a good idea.
>
> I'll add a "csv" option to the property replacer. It will format a
> field according to RFC 4180:
>
Thanks. I'll start working on it. For handling CSVs I'm planning to use
libmba, which is distributed with Red Hat distros. Is it OK to have such
a dependency on a module?

> I will always enclose values in double quotes to keep the code simple
> (I think also on the parser side). Let me know if you think this
> approach is useful.

Looks useful. I'm starting to play with it.

> I have done some review of the code. Not in-depth, but I think good
> enough. I do have the message object available (thankfully, the
> optimization to store just the strings did not yet take place
> ;)). Creating a deep copy is not problematic and I'd assume typically
> bears roughly equivalent cost to creating the template string (which
> is kind of expensive). There obviously must be a new interface
> declared for this and your plugin should support both the new and the
> old interface. It may be OK if you return RS_RET_DISABLED on the first
> call to the old interface, what means a downlevel engine can not use
> your plugin (acceptable from my POV).
>
Sounds acceptable.

> Feature-Wise, however, I think you lose a couple of things. Most
> importantly, the template processor & property replacer allows you to
> rewrite parts of the message. If we pass in the plain message object,
> you lose this ability. So any modifications must be made directly from
> within the plugin. I'd say that's a big disadvantage.
>
A huge one. If, for instance, I want to extract user name and IP address
from SSH log in messages, I don't want my plugin to be aware of SSH
messages. I prefer to have it done by rsyslog, as it is done now.

If we have to make the modules extract fields on their own, we are
duplicating existing code and introducing many new bugs. That's not
acceptable. I wonder if, however, we can get any access to the
properties rsyslog processes, before they are concatenated into a single
string.

For instance, if I specify:

%fromhost%,%timestamp:::date-rfc3339%,%msg%

Can I have an array of pointers to each already processed property?

If this can't be done, CSV parsing is already excellent for our needs.

> > I think it's better to pass a deep copy, free it once the module
> > call returns, and do it only for modules that actually need that new
> > entry point. If such deep copies are expensive, then we are just
> > fine the way we are now.
>
> Agreed, but I think a deep copy does not address anything. With the
> template system (in theory but not yet in practice), a plugin can not
> access any information other than what the users has configured in the
> template. If the full object is passed, this can not prevented.

Indeed. I was thinking of the set of things I suppose you have right
before generating the string that is passed to doAction. Anything else
is a security problem.

Again, if it's difficult or overkill, discard this idea.

Cheers.
--
Luis Fernando Muñoz Mejías
Luis.Fernando.Munoz.Mejias@cern.ch

_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com
Re: RFC: On rsyslog output modules and support forbatchoperations [ In reply to ]
On Thu, 2 Apr 2009, Rainer Gerhards wrote:

> Agreed, but I think a deep copy does not address anything. With the template
> system (in theory but not yet in practice), a plugin can not access any
> information other than what the users has configured in the template. If the
> full object is passed, this can not prevented. In practice, today, plugins
> are loaded in-process and as such can access the whole process space. But
> there are ideas to create an out-of-process plugin interface for very
> security sensitive environments. They would be hurt (or require additional
> configuration) but the "full object access" approach.

if you really want to have a output module that's seperate from a security
point of view, have a lightweight output module (that can have full access
to everything) mediate all communication to the external module (that
would only get what is sent to it and is a seperate process)

this would give you the security you are thinking of, but still allow
in-process modules to have the increased access to data.

this isn't the first case where it would have been helpful to have access
to more of the properties (the UDP forgery module I sent in was another,
but I was able to work-around that by adding data to the message and
having the plugin parse it out, inefficiant, but possible)

David Lang
_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com