help-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: adding lines based on field match (or lack thereof)


From: Andrew Mayhew
Subject: Re: adding lines based on field match (or lack thereof)
Date: Wed, 24 Oct 2001 16:18:34 -0700
User-agent: Mutt/1.2.5i

I came up with a solution which uses a similar methodology that you
described below.  In our situation we have very few locally specific
accounts on machines and so we allowed the local adminitrators to deal with
those outside the cfengine realm.  Our config looked something like this:

editfiles:
  any::
    { /etc/passwd
      SetLine "someuser:x:42:42:name:homedir:shell"
         AppendIfNoLineMatching "^someuser:.*"
         ## repeat for all the accounts listed in passwd.global
         
         SplitOn ":"
         ForEachLineIn "/etc/passwd.global"
                ReplaceLinesMatchingField "1"
         EndLoop
    }    

Only the passwd.global file would actually have the encrypted password, so
that account would not be active until the for loop had been processed. This
also ment that we only needed to change the password in the passwd.global
file and not in the cfengine configuration file.

Hope that helps somewhat.  Still not necessarily the most pretty solution,
but one that works.

--Andrew Mayhew <amayhew@icewire.com>

On Wed, Oct 24, 2001 at 02:33:33PM -0700, Shannon Lee wrote:
> i'm trying to use the editfiles function to distribute and maintain a
> standard password file.  this file is going to hosts running various
> platform OSes, and which have various "host specific" or "class
> specific" users in addition to the set of users in the standard passwd
> file i'm distributing.
> 
> i'd like to use something like
> 
>         SplitOn ":"
> 
>         ForEachLineIn "/usr/local/etc/passwd.local"
>            ReplaceLinesMatchingField "1"
>            AppendIfNoLineMatchingField "1"
>         EndLoop
> 
> of course, the 'AppendIfNoLineMatchinField' function doesn't exist; i
> wonder how i'd go about doing this?
> 
> i found a similar query in the archive for February 1999, below... but i
> didn't see any responses.
> 
> http://mail.gnu.org/pipermail/help-cfengine/1999-February/001622.html
> 
> -- 
> --shannon
> 
> --
>     -----------------------------------
>      Shannon Lee - shannon@scatter.com
>          *    *    *    *    *    *
>      I _said_, "i've got a big stick."
>     -----------------------------------
> 
> _______________________________________________
> Help-cfengine mailing list
> Help-cfengine@gnu.org
> http://mail.gnu.org/mailman/listinfo/help-cfengine



reply via email to

[Prev in Thread] Current Thread [Next in Thread]