Re: config files and includes.

2003-02-21 Thread Mike Barcroft
Julian Elischer [EMAIL PROTECTED] writes:
 I have just gone through the process of upgrading or installing several
 hundred machines, and Thst includes altering or editing many config
 files in /etc. I like the way that rc.conf
 is handled, in that defaults/rc.comf can be updated and only the
 local changes live in r.conf. I wish that more files had this
 capability.
 For example syslogd.conf or newsyslog.conf are updated between releases
 but they are also prime candidates for local additions.
 What would be really cool is if more config files could
 do 'includes' so that you could have a syslogd.local.conf
 wher eall your local entries could be. In addition you could make it
 look in /usr/local/etc/syslogd.conf for loging requirments for
 packages.

Why not making it simple on yourself and use CPP.

/etc/defaults/syslog.global.conf:
#ifndef SECURITY
security.*  /nfs/log/security
#endif

#ifndef MAIL
mail.info   /nfs/log/maillog
#endif

/etc/syslog.local.conf:
#define SECURITY
security.*  /var/log/security

#include /etc/defaults/syslog.global.conf

/etc/rc.d/syslogd (or similar):
+# Preprocess syslog.conf
+cpp /etc/syslog.local.conf -o /etc/syslog.conf
+

Unix has *so* many text processing tools, I don't see why we need to
bloat daemons with this stuff.

Best regards,
Mike Barcroft

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: config files and includes

2003-02-21 Thread Tim Kientzle
What would be really cool is if more config files could
do 'includes' so that you could have a syslogd.local.conf
wher eall your local entries could be.

In addition you could make it
look in /usr/local/etc/syslogd.conf for loging requirments for
packages.


Hmmm... glancing through syslogd.c, it doesn't look
like it would be hard to alter it to support multiple
-f options.  In that case, just add the following
to rc.conf (or /etc/rc.d/syslogd, I suppose):
  if [ -e /etc/syslog.local ] then
syslogd_args=$syslogd_args -f /etc/syslog.local
  fi
 for f in /usr/local/etc/syslogd.d/*

 do

   syslogd_args=$syslogd_args -f $f

  done

This largely removes the need for include handling.
It doesn't allow you to override or remove
existing entries, though.  One approach that
preserves backward compatibility would be
to allow optional line numbers, with duplicates
overriding earlier entries.  That requires some
non-trivial code changes to support, but it
shouldn't be too hard.
There's also considerable precedent for using
cpp or m4 to preprocess configuration files.
Either supports file inclusions, conditionals,
etc.  It's generally not too hard to support
this: it usually just involves replacing
fopen() with popen().
Tim Kientzle



To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message


config files and includes.

2003-02-20 Thread Julian Elischer

I have just gone through the process of upgrading or installing several
hundred machines, and Thst includes altering or editing many config
files in /etc. I like the way that rc.conf
is handled, in that defaults/rc.comf can be updated and only the
local changes live in r.conf. I wish that more files had this
capability.
For example syslogd.conf or newsyslog.conf are updated between releases
but they are also prime candidates for local additions.
What would be really cool is if more config files could
do 'includes' so that you could have a syslogd.local.conf
wher eall your local entries could be. In addition you could make it
look in /usr/local/etc/syslogd.conf for loging requirments for
packages.

To do this for every config file would be a lot of work. I do wonder
however whether there couldn't be some config-file reader library
routine that could be used to pre-pass files and do inclusions..

if the interface was very similar to what is usually used 
(people tend to either use open/read/close or
fopen/fscanf (etc).

equivalent calls could be made that use a stream of data that is
pre-processed to do inclusions etc. That would making retrofitting
relatively easy.  Programs that use yacc/lex ar emore difficult,
but I haven't looked into it..

anyhow, that was just a thought.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



config files and includes.

2003-02-20 Thread Garrett Wollman
On Thu, 20 Feb 2003 18:39:33 -0800 (PST), Julian Elischer [EMAIL PROTECTED] said:

 What would be really cool is if more config files could
 do 'includes' so that you could have a syslogd.local.conf
 wher eall your local entries could be. In addition you could make it
 look in /usr/local/etc/syslogd.conf for loging requirments for
 packages.

Well, it's a trivial part of XML but the syntax is twisted.  The
problem is that, particularly in the case of something like
syslog.conf, you need to change the defaults, not just supplement
them.  Right now syslog has no concept of this (and changing the
notation doesn't help without a complete rethink of the syslog.conf
semantics).  Worthwhile, but a lot of work for which nobody will be
grateful (instead they will all complain that you changed the format
of the file).

-GAWollman


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: config files and includes.

2003-02-20 Thread John De Boskey
- Julian Elischer's Original Message -
 
 I have just gone through the process of upgrading or installing several
 hundred machines, and Thst includes altering or editing many config
 files in /etc. I like the way that rc.conf
 is handled, in that defaults/rc.comf can be updated and only the
 local changes live in r.conf. I wish that more files had this
 capability.

This is not exactly what you are asking for, but this is from
a petty much a been-there/done-that many years ago. Typing in
the logic from memory:

rcfiles=/etc/inetd.conf /etc/syslog.conf /etc/newsyslog.conf
 
for rcf in $rcfiles; do
   if [ -f ${rcf}.local ]; then
  if [ ! -f ${rcf}.base ]; then
 if diff ${rcf} ${rcf}.base  /dev/null; then
cp -p ${rcf} ${rcf}.base
 fi
  fi
  cat ${rcf}.base ${rcf}.local  ${rcf}
   fi
done

I think you can get the idea.

-John

 For example syslogd.conf or newsyslog.conf are updated between releases
 but they are also prime candidates for local additions.
 What would be really cool is if more config files could
 do 'includes' so that you could have a syslogd.local.conf
 wher eall your local entries could be. In addition you could make it
 look in /usr/local/etc/syslogd.conf for loging requirments for
 packages.
 
 To do this for every config file would be a lot of work. I do wonder
 however whether there couldn't be some config-file reader library
 routine that could be used to pre-pass files and do inclusions..
 
 if the interface was very similar to what is usually used 
 (people tend to either use open/read/close or
 fopen/fscanf (etc).
 
 equivalent calls could be made that use a stream of data that is
 pre-processed to do inclusions etc. That would making retrofitting
 relatively easy.  Programs that use yacc/lex ar emore difficult,
 but I haven't looked into it..
 
 anyhow, that was just a thought.
 
 
 To Unsubscribe: send mail to [EMAIL PROTECTED]
 with unsubscribe freebsd-current in the body of the message

-- 
--
As said by Napolean Bonaparte:
Never ascribe to malice, that which is adequately explained by incompetence

After being embraced by MS:

When accused of malice, always hide behind incompetence.

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: config files and includes.

2003-02-20 Thread Julian Elischer


On Thu, 20 Feb 2003, Garrett Wollman wrote:

 On Thu, 20 Feb 2003 18:39:33 -0800 (PST), Julian Elischer [EMAIL PROTECTED] 
said:
 
  What would be really cool is if more config files could
  do 'includes' so that you could have a syslogd.local.conf
  wher eall your local entries could be. In addition you could make it
  look in /usr/local/etc/syslogd.conf for loging requirments for
  packages.
 
 Well, it's a trivial part of XML but the syntax is twisted.  The
 problem is that, particularly in the case of something like
 syslog.conf, you need to change the defaults, not just supplement
 them.  Right now syslog has no concept of this (and changing the
 notation doesn't help without a complete rethink of the syslog.conf
 semantics).  Worthwhile, but a lot of work for which nobody will be
 grateful (instead they will all complain that you changed the format
 of the file).

of course..

New functionality vs POLA. An age old conflict.



To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: config files and includes.

2003-02-20 Thread Julian Elischer


On Thu, 20 Feb 2003, John De Boskey wrote:

 - Julian Elischer's Original Message -
  
  I have just gone through the process of upgrading or installing several
  hundred machines, and Thst includes altering or editing many config
  files in /etc. I like the way that rc.conf
  is handled, in that defaults/rc.comf can be updated and only the
  local changes live in r.conf. I wish that more files had this
  capability.
 
 This is not exactly what you are asking for, but this is from
 a petty much a been-there/done-that many years ago. Typing in
 the logic from memory:
 
 rcfiles=/etc/inetd.conf /etc/syslog.conf /etc/newsyslog.conf
  
 for rcf in $rcfiles; do
if [ -f ${rcf}.local ]; then
   if [ ! -f ${rcf}.base ]; then
  if diff ${rcf} ${rcf}.base  /dev/null; then
 cp -p ${rcf} ${rcf}.base
  fi
   fi
   cat ${rcf}.base ${rcf}.local  ${rcf}
fi
 done
 
 I think you can get the idea.

yeah but we don't distribute our files like that..
you get a new syslogd.conf when you upgrade, not a syslogd.conf.base

(unfortunartly)

I considered this possibilty. especially as many daemons etc.
have an argument that they can take for a config file, and the argument
is often changeable from rc.conf.

e.g.
. /usr/local/concatfiles
syslogd_flags=-s -f/etc/syslogd.local
[...]

where 
/usr/local/concatfiles does:

cat /etc/syslogd.conf /usr/local/etc/syslogd.conf /etc/syslogd.local
or in some cases:
if ! grep -q already patched etc/login.conf.diff
patch /usr/local/etc/login.conf.diff 

Unfortunatly each case requires a seprate aproach.

julian


 
 -John
 
  For example syslogd.conf or newsyslog.conf are updated between releases
  but they are also prime candidates for local additions.
  What would be really cool is if more config files could
  do 'includes' so that you could have a syslogd.local.conf
  wher eall your local entries could be. In addition you could make it
  look in /usr/local/etc/syslogd.conf for loging requirments for
  packages.
  
  To do this for every config file would be a lot of work. I do wonder
  however whether there couldn't be some config-file reader library
  routine that could be used to pre-pass files and do inclusions..
  
  if the interface was very similar to what is usually used 
  (people tend to either use open/read/close or
  fopen/fscanf (etc).
  
  equivalent calls could be made that use a stream of data that is
  pre-processed to do inclusions etc. That would making retrofitting
  relatively easy.  Programs that use yacc/lex ar emore difficult,
  but I haven't looked into it..
  
  anyhow, that was just a thought.
  
  
  To Unsubscribe: send mail to [EMAIL PROTECTED]
  with unsubscribe freebsd-current in the body of the message
 
 -- 
 --
 As said by Napolean Bonaparte:
 Never ascribe to malice, that which is adequately explained by incompetence
 
 After being embraced by MS:
 
 When accused of malice, always hide behind incompetence.
 


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: config files and includes.

2003-02-20 Thread Matthew Emmerton
 On Thu, 20 Feb 2003, Garrett Wollman wrote:

  On Thu, 20 Feb 2003 18:39:33 -0800 (PST), Julian Elischer
[EMAIL PROTECTED] said:
 
   What would be really cool is if more config files could
   do 'includes' so that you could have a syslogd.local.conf
   wher eall your local entries could be. In addition you could make it
   look in /usr/local/etc/syslogd.conf for loging requirments for
   packages.
 
  Well, it's a trivial part of XML but the syntax is twisted.  The
  problem is that, particularly in the case of something like
  syslog.conf, you need to change the defaults, not just supplement
  them.  Right now syslog has no concept of this (and changing the
  notation doesn't help without a complete rethink of the syslog.conf
  semantics).  Worthwhile, but a lot of work for which nobody will be
  grateful (instead they will all complain that you changed the format
  of the file).

 of course..

 New functionality vs POLA. An age old conflict.

Isn't POLA the reason why people gave up trying to extend the old standards
(like syslogd and inetd) and decided to build new feature-rich daemons like
msyslog and xinetd?

--
Matt Emmerton


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: config files and includes.

2003-02-20 Thread Garance A Drosihn
At 6:39 PM -0800 2/20/03, Julian Elischer wrote:

I have just gone through the process of upgrading or installing
several hundred machines, and that includes altering or editing
many config files in /etc. ...

For example syslogd.conf or newsyslog.conf are updated between
releases but they are also prime candidates for local additions.


Note that I'm in the middle of some newsyslog changes, so I'm
willing to think about it from that side of things.  And Wes has
some syslogd changes coming, so maybe he'll be interested.


What would be really cool is if more config files could
do 'includes' so that you could have a syslogd.local.conf
where all your local entries could be. [...]

To do this for every config file would be a lot of work. I do
wonder however whether there couldn't be some config-file
reader library routine that could be used to pre-pass files
and do inclusions..


I've thought about this a little, and I felt it was tricky to
get right.  Sometimes you want to just add a line, sometimes
you want to delete one line and add a different one, and
sometimes you need to modify the line (ie, remove lpd-errs
from a line in syslog.conf, but do not disturb whatever else
is on the same line).  I think you'd pretty much need to go
to a new format for all the config files, and that's too big
of a change (IMO) to quickly do.

There's also the question of overhead.  Why do all of this
processing every time newsyslog runs, instead of doing it
once as a part of mergemaster?  So, I was thinking of writing
some addition to mergemaster which could handle this.  Then
it's just a matter of writing one program that knows how to
massage config files, without having to understand the specifics
of any particular config file.  Something like:
   if there is a line:  /var/log/lpd-errs
   in:  /etc/newsyslog.conf
 then:   change '644  7' to '644  12'
This strikes me as pretty simple (at least for the changes I
want to propagate).  It's just a change to mergemaster, which
could then be MFC'ed to any release.

That was my thinking on it.  I don't know how well it would
scale up for hundreds of machines though.


  [...]   In addition you could
make it look in /usr/local/etc/syslogd.conf for logging
requirements for packages.


However, I hadn't been thinking about this part.  Certainly it
would be nice to have something that also handled these issues.
I've futzed around some with some of the uber-flexible config
options on redhat, and I can see how that would be helpful.

--
Garance Alistair Drosehn=   [EMAIL PROTECTED]
Senior Systems Programmer   or  [EMAIL PROTECTED]
Rensselaer Polytechnic Instituteor  [EMAIL PROTECTED]

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: config files and includes.

2003-02-20 Thread Terry Lambert
Matthew Emmerton wrote:
  On Thu, 20 Feb 2003, Garrett Wollman wrote:
  of course..
 
  New functionality vs POLA. An age old conflict.
 
 Isn't POLA the reason why people gave up trying to extend the old standards
 (like syslogd and inetd) and decided to build new feature-rich daemons like
 msyslog and xinetd?


People apparently keep confusing POLA with PONA -- the Principle
Of No Astonishment.

The purpose of POLA is to suppress unnecessary changes, not suppress
necessary changes.


-- Terry

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message