help-cfengine
[Top][All Lists]
Advanced

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

Re: homepattern, directory and copy


From: Atom Powers
Subject: Re: homepattern, directory and copy
Date: Tue, 6 Dec 2005 14:28:49 -0800

After some experimenting, it seems that "home" is only valid in the
files section and "LastNode" is only valid in the directories section.
Furthur, recurse is not valid in the directories section.

So you can set the owner of the top level directory, and the
permissions of the tree; but you can't set the owner for the entire
three without a files section for each directory.

On 12/6/05, Steve Wray <steve.wray@cwa.co.nz> wrote:
> There appears to be an inconsistency in the way that I can use home
> patterns and difficulty assigning ownership of the content of home
> directories.
>
>
> We have a bunch of servers with no NFS mounts at all, yet I want to take
> advantage of cfengines 'homepattern'
>
>
>
> control:
>     HomeMaintenance::
>        # This is where files to go into users home directories are held:
>        master_home    = ( "$(client_mastercf)/config/home" )
>
>        # Although we don't use NFS, homepattern appears to need
>        # a mountpattern so I just give /
>        mountpattern   = ( "/" )
>
>        # Since /home is where the home directories go, this together with
>        # the mount pattern should mean that this 'expands' to /home
>        homepattern    = ( "home" )
>
>        # As you will see, despite using homepattern, I still seem to have
>        # to define a list of home directories:
>        homedirs = ( ExecResult(/bin/ls /home/) )
>
>        # I am illustrating the perceived inconsistency between copy and
>        # directories:
>        actionsequence = ( copy directories )
>
>
> copy:
>     HomeMaintenance::
>        $(master_home)/testfile
>           # In the case of copy, we can use the 'home' pseudo-variable
>           # which cfengine derives from the mountpattern and homepattern:
>           dest=home/testfile
>           mode=0600
>           type=checksum
>           server=$(policyhost)
>
>
> directories:
>     HomeMaintenance::
>        # Here we have to use the explicit path and the list
>        # defined above:
>        /home/$(homedirs)
>           owner=LastNode
>           inform=true
>        # this only works for the top-level home directory,
>        # not subdirectories, there is no recursion.
>
>        # This does not appear to work:
>        home
>           owner=LastNode
>           inform=true
>         # and produces these messages:
>         # cfengine:testbed: Unknown user home
>         # cfengine:testbed:   touching /home
>         # cfengine:testbed: Owner of /home was 0, setting to -1
>
>        # This appears to do nothing at all:
>        home/
>           owner=LastNode
>           inform=true
>
>        # This applies to all of the *contents* of
>        # all first-level subdirectories of /home/
>        # and tries to apply to files as well, giving errors:
>        home/*
>           owner=LastNode
>           inform=true
>
> # and produces this kind of noise (excuse the linewrapping):
> #cfengine:ldap: Cannot make /home/stevew/.bashrc -
> # /home/stevew/.bashrc is not a directory! (use forcedirs=true)
> #cfengine:ldap: Cannot make /home/stevew/.bash_profile -
> # /home/stevew/.bash_profile is not a directory!
> # (use forcedirs=true)
>
> # ie its trying to apply the directories action to files
> # besides which, directories isn't recursive so even if this
> # worked, pattern-wise, it still wouldn't work for me.
>
> # I had been hoping that the files action might work, but no:
> files:
>     HomeMaintenance::
>        # This does nothing
>        home
>           action=fixall
>           inform=true
>
> #The logs do show:
> # cfengine:testbed: Checking files in /home/stevew/...
>
> # but it does nothing even thought they are (currently) all owned
> # by root, presumably because no owner= is set,
> # however only 'directories' uses LastNode so I'm at a loss how
> # to get the files action to correctly set ownerships of homedir
> # contents!
>
>
> Is it possible to enforce ownership of the contents of home directories
> directly from cfengine without resorting to shellcommands?
>
> So far, the only way I have found to set ownership of a home directories
> *contents* to the owner of that home directory is to copy the content
> from the server into it that home directory.
>
> I am guessing that I'll have to write a small shell script or something,
> but I sure hope that someone can either point out my error or provide a
> workaround!
> :)
>
>
>
> --
> There is nothing more important to good government than good education.
>
>
>
> _______________________________________________
> Help-cfengine mailing list
> Help-cfengine@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-cfengine
>


--
--
Perfection is just a word I use occasionally with mustard.
--Atom Powers--




reply via email to

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