()
Inspect D-Bus configuration items
Inspect D-Bus configuration items
Inspect D - Bus configuration items
def uptux_check_dbus_issues():
    """Inspect D-Bus configuration items"""
    units = set()
    mask = '*.conf'
    units = find_system_files(known_dirs=DBUS_DIRS,
                              search_mask=mask)

    tee("Found {} D-Bus conf files to analyse...\n".format(len(units)),
        box='ok')

    # Test for write access to any files.
    # Will resolve symlinks to their target and also check for broken links.
    text = 'Found writeable D-Bus conf files:'
    text2 = 'Found writeable directories referred to by broken symlinks'
    box = 'vuln'
    tee("")
    tee("Checking permissions on D-Bus conf files...",
        box='ok')
    check_file_permissions(file_paths=units,
                           files_message_text=text,
                           dirs_message_text=text2,
                           message_box=box)

    # Checking for overly permission policies in D-Bus configuration files.
    # For example, normally "policy" is defined as a username. When defined in
    # an XML tag on its own, it applies to everyone.
    tee("")
    tee("Checking for overly permissive D-Bus configuration rules...",
        box='ok')

    regex = re.compile(r'<policy>.*?</policy>',
                       re.MULTILINE|re.DOTALL)

    text = ('These D-Bus policies may be overly permissive as they do not'
            ' specify a user or group.')
    box = 'sus'
    regex_vuln_search(file_paths=units,
                      regex=regex,
                      message_text=text,
                      message_box=box)
def uptux_check_dbus_issues ( ) : units = set ( ) mask = '*.conf' units = find_system_files ( known_dirs = DBUS_DIRS , search_mask = mask ) tee ( "Found {} D-Bus conf files to analyse...\n" . format ( len ( units ) ) , box = 'ok' ) # Test for write access to any files. # Will resolve symlinks to their target and also check for broken links. text = 'Found writeable D-Bus conf files:' text2 = 'Found writeable directories referred to by broken symlinks' box = 'vuln' tee ( "" ) tee ( "Checking permissions on D-Bus conf files..." , box = 'ok' ) check_file_permissions ( file_paths = units , files_message_text = text , dirs_message_text = text2 , message_box = box ) # Checking for overly permission policies in D-Bus configuration files. # For example, normally "policy" is defined as a username. When defined in # an XML tag on its own, it applies to everyone. tee ( "" ) tee ( "Checking for overly permissive D-Bus configuration rules..." , box = 'ok' ) regex = re . compile ( r'<policy>.*?</policy>' , re . MULTILINE | re . DOTALL ) text = ( 'These D-Bus policies may be overly permissive as they do not' ' specify a user or group.' ) box = 'sus' regex_vuln_search ( file_paths = units , regex = regex , message_text = text , message_box = box )