# reject all mails with executable attachements
# this will be checked before all whitelists:
BLACKLIST_FILE_EXTENTIONS {
  # type = filename: matches attachment filenames and filenames in archives
  # against map. It also includes detected filename match from version 2.0.
  # For example, if some attachment has .png extension but it has real type
  # detected as image/jpeg then two checks would be performed: for the original
  # attachment and for the detected one. This does not include files in
  # archives as Rspamd does not extract them.
  type = "filename";
  filter = "extension";
  map = "${LOCAL_CONFDIR}/local.d/banned_extensions.map";
  description = "List of forbidden file extensions";
  symbol = "FORBIDDEN_FILE_EXTENSION";
  # No filters will be processed for a message if prefilter matches
  #prefilter = true;
  action = "reject";
  # Uncomment if filenames in archives should be excluded from this check:
  # skip_archives = true;
}

###   Whitelists   ###
WHITELIST_SENDER_EMAIL {
  type = "from";
  map = "${LOCAL_CONFDIR}/local.d/whitelist_sender_email.map";
  score = -8;
}

## prepare for whitelisting by IP-address
#WHITELIST_SENDER_IP {
#  type = "ip";
#  map = "${LOCAL_CONFDIR}/local.d/whitelist_sender_ip.map";
#  score = -5;
#}

WHITELIST_SENDER_DOMAIN {
  type = "from";
  filter = "email:domain";
  map = "${LOCAL_CONFDIR}/local.d/";
  score = -5;
}

###   Blacklists   ###
BLACKLIST_REJECT_SENDER_DOMAIN {
  type = "from";
  filter = "email:domain";
  map = "${LOCAL_CONFDIR}/local.d/blacklist_reject_sender_domain.map";
  # No filters will be processed for a message if prefilter matches
  prefilter = true;
  action = "reject";
}

BLACKLIST_REJECT_SENDER_EMAIL {
  type = "from";
  map = "${LOCAL_CONFDIR}/local.d/blacklist_reject_sender_email";
  prefilter = true;
  action = "reject";
}

## prepare for blacklisting by IP-address
#BLACKLIST_SENDER_IP {
#  type = "ip";
#  map = "${LOCAL_CONFDIR}/local.d/blacklist_sender_ip.map";
#  prefilter = true;
#  action = "reject";
#}
