Relevance check file paths

(imported topic written by jrbast)

I need to check the sha1 value of a file named cacert.pem, but it could exist in multiple locations like these.

/opt/oracle/webgate/access/oblix/tools/openssl/simpleCA/cacert.pem

/opt/oracle/Webgate/access/oblix/tools/openssl/simpleCA/cacert.pem

/opt/oracle/webGate/access/oblix/tools/openssl/simpleCA/cacert.pem

/opt/oracle/oam/webGate/access/oblix/tools/openssl/simpleCA/cacert.pem

You can see that webgate|Webgate|webGate are some of the many possible paths to the cacert.pm that I need to update if the sha1 value does not match a master copy of the certificate file to compare to. Is there a way to wildcard a relevance statement for a directory path?

(imported comment written by amelgares)

You can use “folders of folder” to get a wildcard function in a path. Like this:

files "cacert.pem" of folders "simpleCA" of folders "openssl" of folders "tools" of folders "oblix" of folders "access" of folders of folders "oracle" of folders "/opt"

That covers the first three paths. The last one would have an extra “oam” folder in there.

(imported comment written by jrbast)

Looking good, now how could I check the sha1 value on the resulting files to a specific sha1 value?

(imported comment written by dmoore21)

I use this relevance to check if the size and sha1 of a given file are correct:

size of it = 7038 AND sha1 of it = “328533622c33323d0c66bf56fcf57d018fe97bb9”

You’ll have to go and grab the size and sha1 of the file yourself (the easiest way is to use the fixlet debugger).

So, in the end, your relevance should look something like this:

(size of it = 7038 AND sha1 of it = “328533622c33323d0c66bf56fcf57d018fe97bb9”) of
files “cacert.pem” of folders “simpleCA” of folders “openssl” of folders “tools” of folders “oblix” of folders “access” of folders of folders “oracle” of folders “/opt”

(imported comment written by jrbast)

So since the result of above will display multiple answers, I want to know if any of the files do not have the defined sha1 value and return a true answer, but what if I get some true, some false, what will the overall relevance in a fixlet evaluate to? Like in this case below

(sha1 of it != “da39a3ee5e6b4b0d3255bfef95601890afd80709”) of files “cacert.pem” of folders “simpleCA” of folders “openssl” of folders “tools” of folders “oblix” of folders “access” of folders of folders “oracle” of folders “/opt”

A: True

A: False

So I want to update all the files if any of them do not match

(imported comment written by dmoore21)

I don’t have the ability to test this, so someone else will probably need to chime in, but you’ll need to do something like this:

(pathname of it, sha1 of it != “da39a3ee5e6b4b0d3255bfef95601890afd80709”) of files “cacert.pem” of folders “simpleCA” of folders “openssl” of folders “tools” of folders “oblix” of folders “access” of folders of folders “oracle” of folders “/opt”

(imported comment written by ssriv)

hi, i am new to relevance, i tried to find a solution…

hope it would help…

using ‘descendants of folder’ you can find the file located anywhere inside the parent folder.

q:exists ((descendants of folder “/opt”) whose (name of it contains “cacert.pem”)) whose(sha1 of it != “da39a3ee5e6b4b0d3255bfef95601890afd80709”)

It will return True if any of the file do not match the sha1 value.

thanks.

(imported comment written by jrbast)

Ok you onto an idea, but does not work in all cases:

Q: sha1 of file “/opt/oracle/Webgate/access/oblix/tools/openssl/simpleCA/cacert.pem”

A: e5b2e01ad9d40ad406ba14ad18bf775f21c81561

Q: sha1 of file “/opt/oracle/webgate/access/oblix/tools/openssl/simpleCA/cacert.pem”

A: 68c9e4730f3d45a4c3de811b8783dc4126059ac2

Q: exists ((descendants of folder “/opt/oracle”) whose (name of it contains “cacert.pem”)) whose(sha1 of it != “68c9e4730f3d45a4c3de811b8783dc4126059ac2”)

A: True

Q: ((descendants of folder “/opt/oracle”) whose (name of it contains “cacert.pem”)) whose(sha1 of it != “68c9e4730f3d45a4c3de811b8783dc4126059ac2”)

A: /opt/oracle/Webgate/access/oblix/tools/openssl/simpleCA/cacert.pem

(imported comment written by ssriv)

hi, i edited my first post to correct a mistake, that is…

‘It will return True if any of the file do not match the sha1 value.’

can you please tell the cases where it does not work?

thanks.

(imported comment written by jgstew)

This might be what you are looking for: (I have no way to test this)

files whose(“cacert.pem” = name of it as lowercase) of folders “access/oblix/tools/openssl/simpleCA” of folders whose(“webgate” = name of it as lowercase) of (it | folders “oam” of it) of folders “/opt/oracle”

T/F relevance:

exists files whose((“cacert.pem” = name of it as lowercase) AND (sha1 of it != “da39a3ee5e6b4b0d3255bfef95601890afd80709”)) of folders “access/oblix/tools/openssl/simpleCA” of folders whose(“webgate” = name of it as lowercase) of (it | folders “oam” of it) of folders “/opt/oracle”