Forum: Cfengine Help
Subject: Re: Cfengine Help: Please help with regex format
Author: raymondcox
Link to topic: https://cfengine.com/forum/read.php?3,20905,20967#msg-20967

Thank you for catching my misconfiguration, I was able to get a lot more 
output. I am still having a problem with parsing the /etc/security/passwd 
formatted file though. 

On my LINUX systems parsing each line of a shadow formatted file into fields is 
fairly easy by using a ":" as a delimiter, however in AIX the formatting of the 
/etc/security/passwd (AIX's version of the /etc/shadow file in LINUX) looks 
like:


tstusr2:
        password = 7f23WTTmyCHg6
        lastupdate = 1299165612
        flags = ADMCHG

tstusr3:
        password = 6Xj8SCmOIx0LQ
        lastupdate = 1299165619
        flags = ADMCHG




I tried using a regex of "^*$" with readstringarray as it looks like the 
stanzas break on a blank line, but had no luck with that. I suspect the regex 
will be a bit more complex. I intend to combine this with a select_region to 
set the password, update the lastupdate field, and clear the ADMCHG flag based 
on a master copy of /etc/security/passwd.

Am I heading in the right direction with readstringarray, or is there a better 
way to do this?

_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to