def get_list(): a = list() for i in helper.get_apache_dir(): with os.popen("find -L " + i + " 2>/dev/null \! -xtype l -perm /o=w ") as f: for line in f: a.append(line[:-1]) f.close() return a
def check(): # print '' # print ' Set Ownership on Apache Directories and Files '.center(85, '#') # print '' a = list() for i in helper.get_apache_dir(): with os.popen("find "+ i +" 2>/dev/null \! -user root ") as f: for line in f: a.append(line[:-1]) f.close() if len(a) != 0: error_list.append('[WARNING] Detect file in Apache directory not owned by root') error_list.insert(0, 4) else: error_list.insert(0, 0) return error_list
def check(): # print '' # print ' Restrict Other Write Access on Apache Directories and Files '.center(85, '#') # print '' a = list() for i in helper.get_apache_dir(): with os.popen("find -L " + i + " 2>/dev/null \! -xtype l -perm /o=w ") as f: for line in f: a.append(line[:-1]) f.close() if len(a) != 0: error_list.append( '[WARNING] Detect file or directory with other write access') error_list.insert(0, 6) else: error_list.insert(0, 0) return error_list