Set alert preferences to more strict defaults

Fixed invalid URL generated in alerts, in case of blacklisted hosts
This commit is contained in:
Luca Deri 2016-12-20 09:04:44 +01:00
parent 273aa3172e
commit d12b9892d8
3 changed files with 11 additions and 6 deletions

View file

@ -206,7 +206,7 @@ function printAlerts()
"Enable alerts generated when probing attempts are detected.",
"On", "1", "success",
"Off","0", "danger",
"toggle_alert_probing", "ntopng.prefs.probing_alerts", "1",
"toggle_alert_probing", "ntopng.prefs.probing_alerts", "0",
false, nil, nil, showElements)
toggleTableButtonPrefs("Dump Flow Alerts",
@ -252,13 +252,16 @@ function printAlerts()
local retVal = multipleTableButtonPrefs("Notification Preference Based On Severity",
"Errors (errors only), Errors and Warnings (errors and warnings, no info), All (every kind of alerts will be notified).",
labels, values, "only_errors", "primary", "slack_notification_severity_preference", "ntopng.alerts.slack_alert_severity", nil, nil, nil, nil, showElements and showSlackNotificationPrefs)
labels, values, "only_errors", "primary", "slack_notification_severity_preference",
"ntopng.alerts.slack_alert_severity", nil, nil, nil, nil, showElements and showSlackNotificationPrefs)
prefsInputFieldPrefs("Notification Sender Username",
"Set the username of the sender of slack notifications", "ntopng.alerts.", "sender_username", "ntopng Webhook", nil, showElements and showSlackNotificationPrefs, false)
"Set the username of the sender of slack notifications", "ntopng.alerts.", "sender_username",
"ntopng Webhook", nil, showElements and showSlackNotificationPrefs, false)
prefsInputFieldPrefs("Notification Wekhook",
"Send your notification to this slack URL", "ntopng.alerts.", "slack_webhook", "", nil, showElements and showSlackNotificationPrefs, true, true)
"Send your notification to this slack URL", "ntopng.alerts.", "slack_webhook",
"", nil, showElements and showSlackNotificationPrefs, true, true)
if (ntop.isPro()) then

View file

@ -319,8 +319,8 @@ void Flow::checkBlacklistedFlow() {
snprintf(alert_msg, sizeof(alert_msg),
"%s <A HREF='%s/lua/host_details.lua?host=%s&ifname=%s&page=alerts'>%s</A> contacted %s host "
"<A HREF='%s/lua/host_details.lua?host=%s&ifname=%s&page=alerts'>%s</A> [%s]",
ntop->getPrefs()->get_http_prefix(),
cli_host->isBlacklisted() ? "blacklisted" : "",
ntop->getPrefs()->get_http_prefix(),
c, iface->get_name(),
cli_host->get_name() ? cli_host->get_name() : c,
srv_host->isBlacklisted() ? "blacklisted" : "",

View file

@ -588,7 +588,9 @@ patricia_search_exact (patricia_tree_t *patricia, prefix_t *prefix)
fprintf (stderr, "patricia_search_exact: found %s/%d\n",
prefix_toa (node->prefix), node->prefix->bitlen);
#endif /* PATRICIA_DEBUG */
return (node);
if(node->prefix->family == prefix->family)
return (node);
}
return (NULL);
}