def detain(address, profile, comment=''): """Detain address with the given profile""" _logger.debug("Trying to detain %s", address) username = getpass.getuser() candidate = find_computer_info(address) if profile.active_on_vlans and not is_inside_vlans( candidate.ip, profile.active_on_vlans): _logger.error( "%s is not inside defined vlanrange for this predefined " "detention", address, ) return duration = find_duration(candidate, profile) if profile.detention_type == 'disable': disable(candidate, profile.justification, username, comment, duration) else: quarantine( candidate, profile.quarantine_vlan, profile.justification, username, comment, duration, ) return address
def should_pursue(identity, profile): """Verify that this identity is inside the defined vlans for the profile""" LOGGER.debug('%s is %s by a profile' % (identity.mac, identity.status)) if profile.active_on_vlans: if not is_inside_vlans(identity.ip, profile.active_on_vlans): LOGGER.info("Ip not in activeonvlans") return False else: LOGGER.debug("Ip in activeonvlans") else: LOGGER.debug("Profile has no activeonvlans set") return True
def should_pursue(identity, profile): """Verify that this identity is inside the defined vlans for the profile""" _logger.debug('%s is %s by a profile', identity.mac, identity.status) if profile.active_on_vlans: if not is_inside_vlans(identity.ip, profile.active_on_vlans): _logger.info("Ip not in activeonvlans") return False else: _logger.debug("Ip in activeonvlans") else: _logger.debug("Profile has no activeonvlans set") return True
def detain(address, profile, comment=''): """Detain address with the given profile""" LOGGER.debug("Trying to detain %s" % address) username = getpass.getuser() candidate = find_computer_info(address) if profile.active_on_vlans and not is_inside_vlans( candidate.ip, profile.active_on_vlans): LOGGER.error( "%s is not inside defined vlanrange for this predefined " "detention" % address) return duration = find_duration(candidate, profile) if profile.detention_type == 'disable': disable(candidate, profile.justification, username, comment, duration) else: quarantine(candidate, profile.quarantine_vlan, profile.justification, username, comment, duration) return address