Hi,
I am trying to create custom analyses for Red Hat Enterprise server 6, to check Compliance of Hosts file Entry in Red Hat.
Need to verify Hosts entry for example 192.168.x.x ABC abc.xyz.com
Hi,
I am trying to create custom analyses for Red Hat Enterprise server 6, to check Compliance of Hosts file Entry in Red Hat.
Need to verify Hosts entry for example 192.168.x.x ABC abc.xyz.com
If you’re looking to confirm an exact match, you can use:
exists lines whose (it contains "192.168.x.x ABC abc.xyz.com") of files "/etc/hosts"
Rather than looking for the specific entry, you would almost be better off extending the the analysis mentioned by cjwolford to return everything and then using a report to find the entry. Just thinking that you will probably be asked to look for other entries in the future
Unless you want applicability relevance for a fixlet.
This is how you would get the valid lines of the hosts file on EVERY operating system:
(it as trimmed string) whose(it !="") of lines whose(it does not start with "#") of files "hosts" of folders ("/private/etc"; "/etc"; "\windows\sysnative\drivers\etc"; "\windows\system32\drivers\etc")
Then this is how you would check for a specific entry: (again, this works on ALL operating systems)
exists following texts whose(it as lowercase contains "abc.zyx.com") of firsts "192.168.1.1" of lines containing "192.168.1.1" whose(it does not start with "#") of files "hosts" of folders ("/private/etc"; "/etc"; "\windows\sysnative\drivers\etc"; "\windows\system32\drivers\etc")
You would just replace 192.168.1.1
and abc.zyx.com
above as needed.
The @jgstew that wrote the analysis mentioned by @cjwolford was not as experienced as the @jgstew of today at writing cross platform relevance.
Can we create custom checklist for SCM
As far as I know, Yes, but I don’t have much context here. Do you mean for the hosts file? This is probably best asked separately.
yes for the hosts file