[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
homepattern, directory and copy
From: |
Steve Wray |
Subject: |
homepattern, directory and copy |
Date: |
Wed, 07 Dec 2005 10:03:19 +1300 |
User-agent: |
Debian Thunderbird 1.0.2 (X11/20051002) |
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.
- homepattern, directory and copy,
Steve Wray <=