def fix_group_allow(self, element): if not files.contains(element['name'], '"domain admins"'): files.append(element['name'], '\n"domain admins"') if CONFIG.is_set('site','ldap_dev_team'): ldap_dev_team_val = '\n%s' % CONF_MAP('site','ldap_dev_team') if not files.contains(element['name'], ldap_dev_team_val): files.append(element['name'], ldap_dev_team_val)
def fix_ssh(self, element): if not files.contains(element['name'], self.CHROOT_RULE): files.append(element['name'], "\n%s\n" % self.CHROOT_RULE) cmd_list = [ "service ssh restart", ] completed, pinfo = core.exec_cmd_list(cmd_list) if not completed: raise Exception(t("Error in installation!"), element['name'])
def fix_secure(self, element): if not files.contains(element['name'], '\nServerTokens Prod'): files.replace_in(element['name'], 'ServerTokens OS', 'ServerTokens Prod') if not files.contains(element['name'], '\nServerSignature Off'): files.replace_in(element['name'], '#ServerSignature Off', 'ServerSignature Off') if not files.contains(element['name'], '\n#ServerSignature On'): files.replace_in(element['name'], 'ServerSignature On', '#ServerSignature On') if not files.contains(element['name'], self.root_directive): files.append(element['name'], self.root_directive)
def fix_ses_close(self, element): if not files.exists(element['name']): files.append(element['name'], "#! /bin/sh")
def fix_centrify_allow(self): g_allow = '/etc/centrifydc/groups.allow' ldap_group = self.conf.get('access','ldap_group') if ldap_group and not files.contains(g_allow, ldap_group): files.append(g_allow, '\n%s' % ldap_group)
def fix_acl_crontab(self, element): message = t("#Reapply ACL periodically to prevent wordpress like auto update errors.") if not files.contains('/etc/crontab', self.RESTORE_OWNERSHIP): files.append('/etc/crontab', "\n" + message + "\n" + self.RESTORE_OWNERSHIP + "\n")
def fix_sudoers(self, element): if not files.contains(element['name'], '%domain\ admins ALL=(ALL) ALL'): files.append(element['name'], '%domain\ admins ALL=(ALL) ALL') files.chmod(element['name'], **element['perm'])