Перейти к содержимому
Калькуляторы

FastNetMon - программа для выявления входящих/исходящих атак

Чудесным образом починилось =) Теперь еще фишка - можно собирать полный дампы атак в pcap: https://github.com/FastVPSEestiOu/fastnetmon/commit/6aa74d489a69814670e969d4f42bbe6042aaf8df

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Павел, спасибо большущее!

 

В последней версии с гита сети разбаниваются корректно:

/var/log/fastnetmon.log

2015-07-17 15:53:15,630 [ERROR] Attack to IP 10.10.17.40 still going! We should not unblock this host

2015-07-17 15:53:15,630 [iNFO] We will unban banned IP: 10.10.16.68 because it ban time 300 seconds is ended

2015-07-17 15:53:15,630 [iNFO] Call script for unban client: 10.10.16.68

2015-07-17 15:53:15,630 [iNFO] Script for unban client is finished: 10.10.16.68

2015-07-17 15:53:15,630 [iNFO] Call ExaBGP for unban client started: 10.10.16.68

2015-07-17 15:53:15,632 [iNFO] Call to ExaBGP for unban client is finished: 10.10.16.68

2015-07-17 15:53:15,632 [iNFO] ExaBGP announce message: withdraw route 10.10.16.0/24

 

/valof/exabgp.log

exabgp 414186 processes Command from process service-dynamic : withdraw route 10.10.16.0/24

exabgp 414186 reactor Route removed : 10.10.16.0/24 next-hop 0.0.0.0

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Rolex, я помню про Вас - JSON есть в родмэпе, но скорее всего будет засунут в MongoDB вместо Redis :)
Спасибо. ;)

Пытаюсь понять, но пока не совсем ухватил ход мыслей. Почему именно Монго? Почему не редис. Для него же уже почти все есть.

Почитав, понял. Окей, не вопрос... будем изучать Монго... ;)

Изменено пользователем Rolex

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

=)

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Есть чем порадовать! Мы интегрировали DPI!

 

Теперь репорты об атаках могут включать определенные автоматически протоколы и даже сервисы:

 

 

Protocol: DNS query_type: 1 query_class: 1 rsp_code: 0 num answers: 0,num queries: 1 2015-07-29 22:31:34.081626 188.40.35.183:80 >37.190.50.41:18037 protocol: tcp flags: syn,ack frag: 0  packets: 1size: 74 bytes ttl: 0 sample ratio: 1Protocol: HTTP 2015-07-29 22:31:34.081626 188.40.35.183:80 >37.190.50.41:18037 protocol: tcp flags: syn,ack frag: 0  packets: 1size: 74 bytes ttl: 0 sample ratio: 1Protocol: HTTP 2015-07-29 22:31:34.081626 188.40.35.183:80 >37.190.50.41:18037 protocol: tcp flags: syn,ack frag: 0  packets: 1size: 74 bytes ttl: 0 sample ratio: 1Protocol: HTTP 2015-07-29 22:31:34.081626 188.40.35.183:80 >37.190.50.41:18037 protocol: tcp flags: syn,ack frag: 0  packets: 1size: 74 bytes ttl: 0 sample ratio: 1Protocol: HTTP 2015-07-29 22:31:34.081626 188.40.35.183:80 >37.190.50.41:18037 protocol: tcp flags: syn,ack frag: 0  packets: 1size: 74 bytes ttl: 0 sample ratio: 1Protocol: HTTP 2015-07-29 22:31:34.081626 188.40.35.183:80 >37.190.50.41:18037 protocol: tcp flags: syn,ack frag: 0  packets: 1size: 74 bytes ttl: 0 sample ratio: 1Protocol: HTTP 2015-07-29 22:31:34.081626 188.40.35.183:80 >37.190.50.41:18037 protocol: tcp flags: syn,ack frag: 0  packets: 1size: 74 bytes ttl: 0 sample ratio: 1

 

 

 

Этот код есть только в Гит версии, чтобы упростить ее установку я нарисовал скриптик:

 

wget https://raw.githubusercontent.com/FastVPSEestiOu/fastnetmon/master/src/fastnetmon_install.pl-Ofastnetmon_install.plsudo perl fastnetmon_install.pl --use-git-master

 

 

Чтобы включить фичу забиваем в конфиг /etc/fastnetmon.conf:

 

collect_attack_pcap_dumps = onprocess_pcap_attack_dumps_with_dpi = on

 

 

Точно поддерживается разбор попсовых протоколов DDoS атак:

 

NTP amplificationDNS amplificationSSDP amplificationSNMP amplification

 

 

Да, позволю заметить, что фича будет работать только у тех, кто захватывает весь трафик - netmap, PF_RING. Сэмплированные NetFlow / sFLOW, к сожалению не позволяют это делать :(

Изменено пользователем pavel.odintsov

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Как я понимаю ndpi используется, тогда почему pfring не поддерживается?

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Как я понимаю ndpi используется, тогда почему pfring не поддерживается?

 

Еще как поддерживается :) Просто я несколько гхм, переработал и криво описал, сейчас исправил :)

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Ура ура!

 

И еще одна мегафича - теперь мы умеет не просто блокировать ВЕСЬ свой хост, а мы можем находить паразитный трафик и отсекать лишь его, прошу: https://github.com/FastVPSEestiOu/fastnetmon/blob/master/docs/BGP_FLOW_SPEC.md

 

Поддерживаются пока лишь ntp/dns/ssdp/snmp амплификации, но скоро, безусловно, список начнет расти (помощь приветствуется)!

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Кому поддержку syslog как удаленного, так и локального? :) Налетай!

 

 

logging:local_syslog_logging = nologging:remote_syslog_logging = nologging:remote_syslog_server = 10.10.10.10logging:remote_syslog_port = 514

 

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Кому поддержку syslog как удаленного, так и локального? :) Налетай!

 

logging:local_syslog_logging = no
logging:remote_syslog_logging = no
logging:remote_syslog_server = 10.10.10.10
logging:remote_syslog_port = 514

круто, как раз хотел предложить

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Всегда welcome :)

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

доброго времени суток. Отличная программа. Спасибо.

 

Есть вопрос:

 

We run execute_ip_ban code with following params in_pps: 2042 out_pps: 418 in_bps: 17321932 out_bps: 28623 and we decide it's incoming attack

2015-08-21 08:44:55,019 [iNFO] Attack with direction: incoming IP: хх.хх.хх.хх Power: 2042

2015-08-21 08:44:55,054 [iNFO] Call script for ban client: хх.хх.хх.хх

 

Почему банит при чуть более 2000 ппс, хотя в настройках выставлено 12000?

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Пожалуйста :)

 

А покажите конфиг весь?

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Вот бы кто рассказал как флоуспек работает и с чем его снюхать можно )))

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Хорошо работает :) Снюхать можно с Cisco ASR, Juniper MX, ALU.

 

Вот гайда есть подробная, как его включить: https://github.com/FastVPSEestiOu/fastnetmon/blob/master/docs/BGP_FLOW_SPEC.md

 

Сначала нужно поднять BGP unicast и flow сессию между бордером и ExaBGP, все конфиги есть в статейке. А после этого переключиться в режим флоу спека.

 

Но там есть пара проблем:

1) Я не умею снимать flow spec анонсы пока, потому что пока нет интеграции с SNMP, чтобы знать - работает ли правило

2) Определяются только типовые амплификации, но движок позволяет адаптироваться к реально любой атаке

 

Ну или пишите energy_true в Skype, так будет эффективнее :)

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

###
### Main configuration params
###

# Enable/Disable any actions in case of attack
enable_ban = on

# We could disable processing for certain direction of traffic
process_incoming_traffic = on
process_outgoing_traffic = on

# How much packets we will collect from attack's traffic
ban_details_records_count = 500

# How long we should stay IP in blocked state
# If you set 0 here it completely disables unban capability
ban_time = 1900

# With this variable you could enable per subnet speed meters
# For each subnet from subnet list we will track speed in bps and pps for both directions
enable_subnet_counters = on

# In this file you should list all your networks in CIDR format
networks_list_path = /etc/networks_list

# In this file you could list networks in CIDR format which will be not monitored for attacks
white_list_path = /etc/networks_whitelist

# How often we redraw client's screen
check_period = 1

# Connection tracking is very useful for attack detectiob because it provides huge amount of information
# But it's very CPU intensive and not recommended in big networks
enable_connection_tracking = off

# Different approaches to attack detection
ban_for_pps = on
ban_for_bandwidth = on
ban_for_flows = off

# Limits for Dos/DDoS attacks
threshold_pps = 12000
threshold_mbps = 110
threshold_flows = 3500

###
### Traffic capture methods
###

# PF_RING traffic capture, enough fast but wire speed version need paid license
mirror = on

# Netmap traffic capture (very fast but need patched drivers)
mirror_netmap = off

# Pcap mode, very slow not suitable for production
pcap = off
# Netflow capture method with v5, v9 and IPFIX suppotr
netflow = off
# sFLOW capture suitable for switches
sflow = off

# PF_RING configuration
# If you have license for PF_RING ZC could could enable this mode and it could achieve wire speed for 10GE
enable_pf_ring_zc_mode = off

# Configuration for netmap, mirror, pcap modes
# For pcap and PF_RING we could specify "any"
# For netmap and PF_RING we could specify multiple interfaces = eth0
interfaces = bond0

# We use average values for traffic speed to certain IP and we calculate average over this time slice
average_calculation_time = 5

# We use average values for traffic speed for subnet and we calculate average over this time slice
average_calculation_time_for_subnets = 20

# Netflow configuration
netflow_port = 2055
netflow_host = 0.0.0.0

# For bind to all interfaces = eth0
# For bind to all interfaces = eth0
# For bind to localhost for specific protocol:      ::1 or 127.0.0.1

# Netflow agents uses different and very complex approaches for notifying about sample ratio
# Here you could specify sampling ratio for all agents
netflow_sampling_ratio = 1

# sFLOW configuration
sflow_port = 6343
sflow_host = 0.0.0.0

###
### Actions when attack detected
###

# This script executed for ban, unban and atatck detailes collection
notify_script_path = /usr/local/bin/notify_about_attack.sh

# We could put attack details to Redis
redis_enabled = no

# Reddis configuration
redis_port = 6379
redis_host = 127.0.0.1

# ExaBGP could announce blocked IPs with BGP protocol
exabgp = off
exabgp_command_pipe = /var/run/exabgp.cmd
exabgp_community = 65001:666
exabgp_next_hop = 10.0.3.114

# Announce origin subnet of IP address instead IP itself
exabgp_announce_whole_subnet = no

# Graphite monitoring
graphite = off
graphite_host = 127.0.0.1
graphite_port = 2003

# With this option enabled we could add local IP addresses and aliases to monitoring list
# Works only for Linux
monitor_local_ip_addresses = off

###
### Client configuration
###

# Field used for sorting in client, could be: packets, bytes or flows
sort_parameter = packets
# How much IP's we will list for incoming and outgoing channel eaters
max_ips_in_list = 20

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Честно говоря, идей почему так вышло нет вовсе... Что написано в fastnetmon_client в самом низу где указаны значения трешолдов ?

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Честно говоря, идей почему так вышло нет вовсе... Что написано в fastnetmon_client в самом низу где указаны значения трешолдов ?

Скорее всего проблема в том, что машина не тянет. Процессор перегружен. Ставили для теста. Будем переходить на более мощное железо.

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

А что за конфиг, сколько трафика?

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Подскажите пожалуйста что я делаю не так.

Вот конфиг

###
### Main configuration params
###

# Enable/Disable any actions in case of attack
enable_ban = no

# We could disable processing for certain direction of traffic
process_incoming_traffic = on
process_outgoing_traffic = on

# How much packets we will collect from attack's traffic
ban_details_records_count = 500

# How long we should stay IP in blocked state 
# If you set 0 here it completely disables unban capability
ban_time = 1900

# With this variable you could enable per subnet speed meters
# For each subnet from subnet list we will track speed in bps and pps for both directions
enable_subnet_counters = off

# In this file you should list all your networks in CIDR format
networks_list_path = /etc/networks_list

# In this file you could list networks in CIDR format which will be not monitored for attacks 
white_list_path = /etc/networks_whitelist

# How often we redraw client's screen
check_period = 3

# Connection tracking is very useful for attack detectiob because it provides huge amount of information
# But it's very CPU intensive and not recommended in big networks
enable_connection_tracking = off

# Different approaches to attack detection
ban_for_pps = on
ban_for_bandwidth = on
ban_for_flows = off

# Limits for Dos/DDoS attacks
threshold_pps = 500000
threshold_mbps = 1000
threshold_flows = 3500

###
### Traffic capture methods
###

# PF_RING traffic capture, enough fast but wire speed version need paid license
mirror = off

# Netmap traffic capture (very fast but need patched drivers)
mirror_netmap = off

# Pcap mode, very slow not suitable for production
pcap = off
# Netflow capture method with v5, v9 and IPFIX suppotr
netflow = off
# sFLOW capture suitable for switches
sflow = on

# PF_RING configuration
# If you have license for PF_RING ZC could could enable this mode and it could achieve wire speed for 10GE
enable_pf_ring_zc_mode = off

# Configuration for netmap, mirror, pcap modes
# For pcap and PF_RING we could specify "any"
# For netmap and PF_RING we could specify multiple interfaces = 
interfaces = 

# We use average values for traffic speed to certain IP and we calculate average over this time slice
average_calculation_time = 5

# We use average values for traffic speed for subnet and we calculate average over this time slice
average_calculation_time_for_subnets = 20

# Netflow configuration
netflow_port = 2055
netflow_host = 0.0.0.0

# For bind to all interfaces = 
# For bind to all interfaces = 
# For bind to localhost for specific protocol:      ::1 or 127.0.0.1

# Netflow agents uses different and very complex approaches for notifying about sample ratio
# Here you could specify sampling ratio for all agents
netflow_sampling_ratio = 1

# sFLOW configuration
sflow_port = 6343
sflow_host = 0.0.0.0

###
### Actions when attack detected
###

# This script executed for ban, unban and atatck detailes collection 
notify_script_path = /usr/local/bin/notify_about_attack.sh

# We could put attack details to Redis
redis_enabled = no

# Reddis configuration
redis_port = 6379
redis_host = 127.0.0.1

# ExaBGP could announce blocked IPs with BGP protocol
exabgp = off
exabgp_command_pipe = /var/run/exabgp.cmd
exabgp_community = 65001:666
exabgp_next_hop = 10.0.3.114

# Announce origin subnet of IP address instead IP itself
exabgp_announce_whole_subnet = no

# Graphite monitoring
graphite = off
graphite_host = 127.0.0.1
graphite_port = 2003

# With this option enabled we could add local IP addresses and aliases to monitoring list
# Works only for Linux 
monitor_local_ip_addresses = on

# We could create group of hosts with non standard thresholds
# You should create this groups before (in configuration file) specifying any limits 
hostgroup = IPTV:**.**.60.40/32

# Configure this group
IPTV_enable_ban = no

IPTV_ban_for_pps = no
IPTV_ban_for_bandwidth = no
IPTV_ban_for_flows = no

IPTV_threshold_pps = 300000
IPTV_threshold_mbps = 4000
IPTV_threshold_flows = 53500

###
### Client configuration
###

# Field used for sorting in client, could be: packets, bytes or flows
sort_parameter = packets
# How much IP's we will list for incoming and outgoing channel eaters 
max_ips_in_list = 15

 

С глобальными счетчиками все ясно

# Limits for Dos/DDoS attacks
threshold_pps = 500000
threshold_mbps = 1000
threshold_flows = 3500

 

А вот с группами траблы, создал группу в которой описал хост

hostgroup = IPTV:**.**.60.40/32

# Configure this group
IPTV_enable_ban = no

IPTV_ban_for_pps = no
IPTV_ban_for_bandwidth = no
IPTV_ban_for_flows = no

IPTV_threshold_pps = 300000
IPTV_threshold_mbps = 4000
IPTV_threshold_flows = 53500

В логах все равно постоянно валит

[iNFO] We do not ban: **.**.60.40 because ban disabled completely

И как у fastnetmon обстоят дела с Notifications?

Я правильно понимаю что скрипт notify_about_attack.sh нужно самому писать?

Изменено пользователем FATHER_FBI

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Включите бан глобально:

enable_ban = on

 

Да, для нотификаций нужно скрипт свой писать. Если есть какой-то вариант, чтобы сделать универсальный уведомлятор - предлагайте, попробую интегрироваться.

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Включите бан глобально:

enable_ban = on

 

Да, для нотификаций нужно скрипт свой писать. Если есть какой-то вариант, чтобы сделать универсальный уведомлятор - предлагайте, попробую интегрироваться.

Сделал, и все равно

2015-08-25 15:21:44,568 [iNFO] We do not ban: **.**.60.40 because ban disabled completely

Изменено пользователем FATHER_FBI

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

А тут IPTV_enable_ban = no ?

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

А тут IPTV_enable_ban = no ?

###
### Main configuration params
###

# Enable/Disable any actions in case of attack
enable_ban = yes

# We could disable processing for certain direction of traffic
process_incoming_traffic = on
process_outgoing_traffic = on

# How much packets we will collect from attack's traffic
ban_details_records_count = 500

# How long we should stay IP in blocked state 
# If you set 0 here it completely disables unban capability
ban_time = 1900

# With this variable you could enable per subnet speed meters
# For each subnet from subnet list we will track speed in bps and pps for both directions
enable_subnet_counters = off

# In this file you should list all your networks in CIDR format
networks_list_path = /etc/networks_list

# In this file you could list networks in CIDR format which will be not monitored for attacks 
white_list_path = /etc/networks_whitelist

# How often we redraw client's screen
check_period = 3

# Connection tracking is very useful for attack detectiob because it provides huge amount of information
# But it's very CPU intensive and not recommended in big networks
enable_connection_tracking = off

# Different approaches to attack detection
ban_for_pps = on
ban_for_bandwidth = on
ban_for_flows = off

# Limits for Dos/DDoS attacks
threshold_pps = 500000
threshold_mbps = 1000
threshold_flows = 3500

###
### Traffic capture methods
###

# PF_RING traffic capture, enough fast but wire speed version need paid license
mirror = off

# Netmap traffic capture (very fast but need patched drivers)
mirror_netmap = off

# Pcap mode, very slow not suitable for production
pcap = off
# Netflow capture method with v5, v9 and IPFIX suppotr
netflow = off
# sFLOW capture suitable for switches
sflow = on

# PF_RING configuration
# If you have license for PF_RING ZC could could enable this mode and it could achieve wire speed for 10GE
enable_pf_ring_zc_mode = off

# Configuration for netmap, mirror, pcap modes
# For pcap and PF_RING we could specify "any"
# For netmap and PF_RING we could specify multiple interfaces = 
interfaces = 

# We use average values for traffic speed to certain IP and we calculate average over this time slice
average_calculation_time = 5

# We use average values for traffic speed for subnet and we calculate average over this time slice
average_calculation_time_for_subnets = 20

# Netflow configuration
netflow_port = 2055
netflow_host = 0.0.0.0

# For bind to all interfaces = 
# For bind to all interfaces = 
# For bind to localhost for specific protocol:      ::1 or 127.0.0.1

# Netflow agents uses different and very complex approaches for notifying about sample ratio
# Here you could specify sampling ratio for all agents
netflow_sampling_ratio = 1

# sFLOW configuration
sflow_port = 6343
sflow_host = 0.0.0.0

###
### Actions when attack detected
###

# This script executed for ban, unban and atatck detailes collection 
notify_script_path = /usr/local/bin/notify_about_attack.sh

# We could put attack details to Redis
redis_enabled = no

# Reddis configuration
redis_port = 6379
redis_host = 127.0.0.1

# ExaBGP could announce blocked IPs with BGP protocol
exabgp = off
exabgp_command_pipe = /var/run/exabgp.cmd
exabgp_community = 65001:666
exabgp_next_hop = 10.0.3.114

# Announce origin subnet of IP address instead IP itself
exabgp_announce_whole_subnet = no

# Graphite monitoring
graphite = off
graphite_host = 127.0.0.1
graphite_port = 2003

# With this option enabled we could add local IP addresses and aliases to monitoring list
# Works only for Linux 
monitor_local_ip_addresses = on

# We could create group of hosts with non standard thresholds
# You should create this groups before (in configuration file) specifying any limits 
hostgroup = IPTV:**.**.60.40/32

# Configure this group
IPTV_enable_ban = yes

IPTV_ban_for_pps = no
IPTV_ban_for_bandwidth = no
IPTV_ban_for_flows = no

IPTV_threshold_pps = 300000
IPTV_threshold_mbps = 4000
IPTV_threshold_flows = 53500

###
### Client configuration
###

# Field used for sorting in client, could be: packets, bytes or flows
sort_parameter = packets
# How much IP's we will list for incoming and outgoing channel eaters 
max_ips_in_list = 15

 

В логах

2015-08-25 15:28:35,893 [iNFO] We do not ban: **.**.60.40 because ban disabled completely

 

Изначально хочется создать группу для отдельных хостов в сети, у которых рабочая нагрузка это 4-6Гбит и ~250k PPS

Такое вообще реально?

Изменено пользователем FATHER_FBI

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Да, фича делалась именно для такого случая :) Чудесная замена yes на on везде решит вашу проблему :)

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Гость
Ответить в тему...

×   Вставлено в виде отформатированного текста.   Вставить в виде обычного текста

  Разрешено не более 75 смайлов.

×   Ваша ссылка была автоматически встроена.   Отобразить как ссылку

×   Ваш предыдущий контент был восстановлен.   Очистить редактор

×   Вы не можете вставить изображения напрямую. Загрузите или вставьте изображения по ссылке.