...
Бинарные файлы должны собираться с PIE/SSP (CFLAGS="-fPIE -fstack-protector-all -D_FORTIFY_SOURCE=2" LDFLAGS="-Wl,-z,now -Wl,-z,relro"
). Теперь ядро способно определять некоторые виды популярных атак, предотвращать их распространение и информировать нас о произошедшей попытке взлома. Можно отметить в этом разделе больше опций или меньше... Некоторые опции сильно влияют на производительность, которая в свою очередь зависит от аппаратной платформы и поддерживаемых процессором инструкций.
...
Настройка этого сервиса предельно понятна и удобна. Необходимо указать 4 главных параметра: источник событий (source), место назначения событий (destination), фильтр событий (filter) и дать команду журналировать (log). Фильтр событьй должен выбирать только события классифицируемые в NOC! Приведём рабочий пример файла настройки /etc/syslog-ng/syslog-ng.conf, локальные журналы с него удалены:
@version: 3.67
# $Header: /var/cvsroot/gentoo-x86/app-admin/syslog-ng/files/3.6/syslog-ng.conf.gentoo,v 1.1 2014/11/09 08:10:43 mr_bones_ Exp $$Id$
#
# Syslog-ng default configuration file for Gentoo Linux
# https://bugs.gentoo.org/show_bug.cgi?id=426814
@include "scl.conf"
options {
threaded(yes);
chain_hostnames(no);
# The default action of syslog-ng is to log a STATS line
# to the file every 10 minutes. That's pretty ugly after a while.
# Change it to every 12 hours so you get a nice daily update of
# how many messages syslog-ng missed (0).
stats_freq(43200);
# The default action of syslog-ng is to log a MARK line
# to the file every 20 minutes. That's seems high for most
# people so turn it down to once an hour. Set it to zero
# if you don't want the functionality at all.
mark_freq(3600);
};
source src {
system();
internal();
};
destination NOC { udp("1.1.1.1" port(514)); };
filter Environment { facility(daemon) and program("sensord") and level(alert); };
filter Network_Link { facility(kern) and message("^.*: (link up|link down)$"); };
filter Network_LAG { facility(kern) and message("^.*: (Adding slave|Removing slave)"); };
filter Network_NTP { facility(daemon) and program("^ntpd$") and (
message("(now valid|now invalid)$")
or message("adjusting local clock by")
or message("clock is now synced$")
); };
filter Security_ACL { facility(kern) and (
message("^iptables .*")
or message("^ebtables .*")
); };
filter Security_Attack_Hardened { facility(kern) and (
message("^PAX: terminating task: ")
or message("^grsec: banning user with uid ")
or message("^grsec: bruteforce prevention initiated ")
or message("^grsec: denied resource overstep ")
or message("^grsec: denied RWX mmap ")
or message("^grsec: denied untrusted exec ")
or message("^grsec: From ")
); };
filter Security_Audit_Command { facility(kern) and (
message("^grsec: chdir to") and not message("^.*uid/euid:0/0 gid/egid:0/0, parent /usr/sbin/(run-crons|cron)")
or message("^grsec: exec of") and not message("^.*uid/euid:0/0 gid/egid:0/0, parent /usr/sbin/(run-crons|cron)")
); };
filter Security_Audit_Cron { facility(cron) and message("^.* CMD .*$") and not message("^.*/usr/sbin/run-crons.*$"); };
filter Security_Authentication { facility(authpriv) and message("^(.*|)pam_unix.*$"); };
filter System { program("^init$") and message("^(Entering|Switching to) runlevel: "); };
...
or filter(Network_Link)
or filter(Network_LAG)
or filter(Network_NTP)
or filter(Security_ACL)
...