Hello list, I'm trying to check if a symlink is linked to a certain directory. Basically what I want to do is: - fill a local variable using a file_object, basically returning all directories in a directory. - check with a symlink_test that a symlink target is one of these directories
Unfortunately, oscap returns error when trying to get this to work. Looking in the verbose log, I see *I: oscap: Variable 'oval:com.flubber.internal.test.test_link_target:var:1' has no values.* Seems it never collects the directories. Is this related to https://www.redhat.com/archives/open-scap-list/2018-April/msg00000.html ? Example: $ mkdir -p /tmp/link-target/foo /tmp/link-target/foo2 $ ln -s /tmp/link-target/foo2 /tmp/link-source ----------------------------------------------------------------------------------------------- <definitions> <definition class="compliance" id="oval:com.flubber.internal.test.test:def:1" version="1"> <metadata> <title>TEST</title> <description>Test</description> <reference ref_id="tst-000001" source="XCCDF"/> <affected family="unix"> <platform>Red Hat Enterprise Linux 7</platform> </affected> </metadata> <criteria operator="AND"> <criterion comment="TEST" test_ref="oval:com.flubber.internal.test.test:tst:1"/> </criteria> </definition> </definitions> <tests> <symlink_test check="all" check_existence="all_exist" comment="TEST" id="oval:com.flubber.internal.test.test:tst:1" version="1" xmlns=" http://oval.mitre.org/XMLSchema/oval-definitions-5#unix"> <object object_ref="oval:com.flubber.internal.test.test:obj:2"/> <state state_ref="oval:com.flubber.internal.test.test:ste:1"/> </symlink_test> </tests> <objects> <file_object id="oval:com.flubber.internal.test.test:obj:1" version="1" xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#unix"> <behaviors max_depth="1" recurse_direction="down"/> <path>/tmp/link-target</path> <filename operation="pattern match">^.*$</filename> </file_object> <symlink_object id="oval:com.flubber.internal.test.test:obj:2" version="1" xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#unix"> <filepath var_ref="oval:com.flubber.internal.test.test_link_source:var:1"/> </symlink_object> </objects> <states> <symlink_state id="oval:com.flubber.internal.test.test:ste:1" version="1" xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#unix"> <filepath var_check="at least one" var_ref="oval:com.flubber.internal.test.test_link_target:var:1"/> </symlink_state> </states> <variables> <constant_variable comment="Link source" datatype="string" id="oval:com.flubber.internal.test.test_link_source:var:1" version="1"> <value>/tmp/link-source</value> </constant_variable> <local_variable comment="Link target" datatype="string" id="oval:com.flubber.internal.test.test_link_target:var:1" version="1"> <object_component item_field="filepath" object_ref="oval:com.flubber.internal.test.test:obj:1"/> </local_variable> </variables> </oval_definitions> ----------------------------------------------------------------------------------------------- Anyone any idea?
_______________________________________________ Open-scap-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/open-scap-list
