def check_chef_config_dir(self): """Validates chef configuration directories.""" print "Checking Chef configurations......", message = health_check_utils.check_path(self.NAME, '/etc/chef-server/') if not message == "": self._set_status(0, message) return message = health_check_utils.check_path(self.NAME, '/opt/chef-server/') if not message == "": self._set_status(0, message) return
def check_squid_files(self): """Validates squid config, cache directory and ownership.""" print "Checking Squid Files......", var_map = { 'match_squid_conf': False, 'match_squid_cache': False, 'match_squid_ownership': False, } conf_err_msg = health_check_utils.check_path(self.NAME, "/etc/squid/squid.conf") if not conf_err_msg == "": self._set_status(0, conf_err_msg) elif int(oct(os.stat('/etc/squid/squid.conf').st_mode)) < 100644: self._set_status( 0, "[%s]Error: squid.conf has incorrect " "file permissions" % self.NAME) else: var_map['match_squid_conf'] = True squid_path_err_msg = health_check_utils.check_path( self.NAME, '/var/squid/') if not squid_path_err_msg == "": self._set_status(0, squid_path_err_msg) elif health_check_utils.check_path(self.NAME, '/var/squid/cache') != "": self._set_status( 0, health_check_utils.check_path(self.NAME, '/var/squid/cache')) else: var_map['match_squid_cache'] = True uid = os.stat('/var/squid/').st_uid gid = os.stat('/var/squid/').st_gid if uid != gid or pwd.getpwuid(23).pw_name != 'squid': self._set_status( 0, "[%s]Error: /var/squid directory ownership " "misconfigured" % self.NAME) else: var_map['match_squid_ownership'] = True fails = [] for key in var_map.keys(): if var_map[key] is False: fails.append(key) if len(fails) != 0: self.messages.append( "[%s]Info: Failed components for squid config: " "%s" % (self.NAME, ', '.join(item for item in fails))) return True
def check_snmp_mibs(self): """Checks if SNMP MIB files are properly placed.""" print "Checking SNMP MIBs......", conf_err_msg = health_check_utils.check_path(self.NAME, '/etc/snmp/snmp.conf') if not conf_err_msg == "": self._set_status(0, conf_err_msg) mibs_err_msg = health_check_utils.check_path( self.NAME, '/usr/local/share/snmp/mibs') if not mibs_err_msg == "": self._set_status(0, mibs_err_msg) return True
def check_rsyslogd(self): """Validates rsyslogd configuration and service.""" print "Checking rsyslog......", conf_err_msg = health_check_utils.check_path(self.NAME, '/etc/rsyslog.conf') if not conf_err_msg == "": self._set_status(0, conf_err_msg) dir_err_msg = health_check_utils.check_path(self.NAME, '/etc/rsyslog.d/') if not dir_err_msg == "": self._set_status(0, dir_err_msg) serv_err_msg = health_check_utils.check_service_running(self.NAME, 'rsyslogd') if not serv_err_msg == "": self._set_status(0, serv_err_msg) return True
def check_rsyslogd(self): """Validates rsyslogd configuration and service.""" print "Checking rsyslog......", conf_err_msg = health_check_utils.check_path(self.NAME, '/etc/rsyslog.conf') if not conf_err_msg == "": self._set_status(0, conf_err_msg) dir_err_msg = health_check_utils.check_path(self.NAME, '/etc/rsyslog.d/') if not dir_err_msg == "": self._set_status(0, dir_err_msg) serv_err_msg = health_check_utils.check_service_running( self.NAME, 'rsyslogd') if not serv_err_msg == "": self._set_status(0, serv_err_msg) return True
def check_apache_conf(self, apache_service): """Validates if Apache settings. :param apache_service : service type of apache, os dependent. e.g. httpd or apache2 :type apache_service : string """ print "Checking Apache Config......", conf_err_msg = health_check_utils.check_path( self.NAME, "/etc/%s/conf.d/ods-server.conf" % apache_service) if not conf_err_msg == "": self._set_status(0, conf_err_msg) wsgi_err_msg = health_check_utils.check_path( self.NAME, '/var/www/compass/compass.wsgi') if not wsgi_err_msg == "": self._set_status(0, wsgi_err_msg) return True
def check_ntp(self): """Validates ntp configuration and service.""" print "Checking NTP......", conf_err_msg = health_check_utils.check_path(self.NAME, '/etc/ntp.conf') if not conf_err_msg == "": self._set_status(0, conf_err_msg) serv_err_msg = health_check_utils.check_service_running(self.NAME, 'ntpd') if not serv_err_msg == "": self._set_status(0, serv_err_msg) return True
def check_ntp(self): """Validates ntp configuration and service.""" print "Checking NTP......", conf_err_msg = health_check_utils.check_path(self.NAME, '/etc/ntp.conf') if not conf_err_msg == "": self._set_status(0, conf_err_msg) serv_err_msg = health_check_utils.check_service_running( self.NAME, 'ntpd') if not serv_err_msg == "": self._set_status(0, serv_err_msg) return True
def check_squid_files(self): """Validates squid config, cache directory and ownership.""" print "Checking Squid Files......", var_map = { 'match_squid_conf': False, 'match_squid_cache': False, 'match_squid_ownership': False, } conf_err_msg = health_check_utils.check_path( self.NAME, "/etc/squid/squid.conf") if not conf_err_msg == "": self._set_status(0, conf_err_msg) elif int(oct(os.stat('/etc/squid/squid.conf').st_mode)) < 644: self._set_status( 0, "[%s]Error: squid.conf has incorrect " "file permissions" % self.NAME) else: var_map['match_squid_conf'] = True squid_path_err_msg = health_check_utils.check_path( self.NAME, '/var/squid/') if not squid_path_err_msg == "": self._set_status(0, squid_path_err_msg) elif health_check_utils.check_path( self.NAME, '/var/squid/cache' ) != "": self._set_status( 0, health_check_utils.check_path( self.NAME, '/var/squid/cache' ) ) else: var_map['match_squid_cache'] = True uid = os.stat('/var/squid/').st_uid gid = os.stat('/var/squid/').st_gid if uid != gid or pwd.getpwuid(23).pw_name != 'squid': self._set_status( 0, "[%s]Error: /var/squid directory ownership " "misconfigured" % self.NAME) else: var_map['match_squid_ownership'] = True fails = [] for key in var_map.keys(): if var_map[key] is False: fails.append(key) if len(fails) != 0: self.messages.append( "[%s]Info: Failed components for squid config: " "%s" % ( self.NAME, ', '.join(item for item in fails) ) ) return True