help-cfengine
[Top][All Lists]
Advanced

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

Re: editfiles


From: David Kewley
Subject: Re: editfiles
Date: Mon, 19 Apr 2004 13:07:21 -0700
User-agent: KMail/1.5

James Treleaven wrote on Friday 16 April 2004 16:04:
> I know this list gets a lot of questions about the 'editfiles'
> functionality, and I really have looked hard at the docs before posting
> this.
>
> I have found that the approach described by Jamie Wilkinson
> (http://www.shipyard.com.au/articles/sysadmin/cfengine-configfiles.py)
> works for me, but I suspect there is a better way.
>
> Should it really take me 9 lines to code 'Make sure SyslogFacility is
> set to AUTHPRIV in /etc/ssh/sshd_config' as he does it:
> ---
>        BeginGroupIfNoLineMatching '^SyslogFacility.*'
>          Append 'SyslogFacility'
>        EndGroup
>        ResetSearch 1
>        LocateLineMatching '^SyslogFacility.*'
>        BeginGroupIfNoMatch '^SyslogFacility AUTHPRIV$'
>          ReplaceLineWith 'SyslogFacility AUTHPRIV'
>        EndGroup
>        ResetSearch 1
> ---
>
> If any of you cfengine gurus wish to share a better idiom, I would
> appreciate it.

I'm not a guru, just a clever newb :), but here's how I do something similar, 
changing 4 parameters in sshd_config using 8 cfengine statements:

        HashCommentLinesMatching "[^#]*StrictModes.*$"
        AppendIfNoSuchLine "StrictModes no"

        HashCommentLinesMatching "[^#]*ChallengeResponseAuthentication.*$"
        AppendIfNoSuchLine "ChallengeResponseAuthentication no"

        HashCommentLinesMatching "[^#]*PrintMotd.*$"
        AppendIfNoSuchLine "PrintMotd no"

        HashCommentLinesMatching "[^#]*MaxStartups.*$"
        AppendIfNoSuchLine "MaxStartups 10:30:60"

David




reply via email to

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