Как включить отображение журналов fail2ban и mod_secure в logwatch на Centos 6.4?

Primero, por qué hay /liby/lib64:

separados

El Estándar de jerarquía del sistema de archivos menciona que existen /liby /lib64separados porque:

10.1. There may be one or more variants of the /lib directory on systems which support more than one binary format requiring separate libraries. (...) This is commonly used for 64-bit or 32-bit support on systems which support multiple binary formats, but require libraries of the same name. In this case, /lib32 and /lib64 might be the library directories, and /lib a symlink to one of them.

En mi Slackware 14.2, por ejemplo, hay /liby /lib64directorios para bibliotecas de 32 -bits y 64 -bits respectivamente, aunque /libno es un enlace simbólico como sugeriría el fragmento de FHS:

$ ls -l /lib/libc.so.6
lrwxrwxrwx 1 root root 12 Aug 11  2016 /lib/libc.so.6 -> libc-2.23.so
$ ls -l /lib64/libc.so.6
lrwxrwxrwx 1 root root 12 Aug 11  2016 /lib64/libc.so.6 -> libc-2.23.so

Hay dos bibliotecas libc.so.6en /liby /lib64.

Cada uno construido dinámicamente Binario ELF contiene una ruta codificada al intérprete, en este caso, ya sea /lib/ld-linux.so.2o/lib64/ld-linux-x86-64.so.2:

$ file main
main: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, not stripped
$ readelf  -a main  | grep 'Requesting program interpreter'
      [Requesting program interpreter: /lib/ld-linux.so.2]

$ file./main64
./main64: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, not stripped
$ readelf  -a main64  | grep 'Requesting program interpreter'
      [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]

El trabajo del intérprete es cargar las bibliotecas compartidas necesarias.Ustedes puede preguntarle a un intérprete de GNU qué bibliotecas cargaría sin siquiera ejecutando un binario usando LD_TRACE_LOADED_OBJECTS=1o un contenedor ldd:

$ LD_TRACE_LOADED_OBJECTS=1./main
        linux-gate.so.1 (0xf77a9000)
        libc.so.6 => /lib/libc.so.6 (0xf760e000)
        /lib/ld-linux.so.2 (0xf77aa000)
$ LD_TRACE_LOADED_OBJECTS=1./main64
        linux-vdso.so.1 (0x00007ffd535b3000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f56830b3000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f568347c000)

Como puede ver, un intérprete dado sabe exactamente dónde buscar bibliotecas -La versión de 32 -bits busca bibliotecas en /liby 64 -bits versión busca bibliotecas en /lib64.

El estándar FHS dice lo siguiente sobre/bin:

/bin contains commands that may be used by both the system administrator and by users, but which are required when no other filesystems are mounted (e.g. in single user mode). It may also contain commands which are used indirectly by scripts.

En mi opinión, la razón por la que no hay /biny /bin64separados es que si tuviéramos el archivo con el mismo nombre en ambos directorios no pudimos llamar a uno de ellos indirectamente porque tendríamos que poner /bino /bin64primero en $PATH.

Sin embargo, tenga en cuenta que lo anterior es solo la convención -de Linux Al kernel realmente no le importa si tiene /biny /bin64separados. Si los desea, puede crearlos y configurar su sistema en consecuencia.

También mencionó Android -tenga en cuenta que, excepto para ejecutar un Kernel de Linux no tiene nada que ver con los sistemas GNU como Ubuntu -no glibc, no bash (de forma predeterminada, por supuesto, puede compilarlo e implementarlo manualmente ), y también la estructura del directorio es completamente diferente.

1
23.07.2013, 17:45
1 ответ

Я нашел этот вопрос 7 лет назад, и у меня была та же проблема. logwatchобрабатывал fail2banжурналы, но ничего не сообщал, только если я ставил его в режим отладки вот так:

logwatch --debug High --service fail2ban

Настоящая проблема со всеми моими коробками Centos6 — это фильтр logwatchдля fail2ban, я нашел другую статью, указывающую на решение:

Отредактируйте /usr/share/logwatch/scripts/services/fail2banв строке 81 и выполните следующую замену.

ОРИГИНАЛ

} elsif ( my ($Service,$Action,$Host) = ($ThisLine =~ m/WARNING:?\s\[?(.*?)[]:]?\s(Ban|Unban)[^\.]* (\S+)/)) {

ИСПРАВЛЕНО

} elsif ( my ($Service,$Action,$Host) = ($ThisLine =~ m/NOTICE:?\s+\[?(.*?)[]:]?\s(Ban|Unban)[^\.]* (\S+)/)) {

Источник:https://www.gyrocode.com/articles/centos-7-fail2ban-and-logwatch/

0
29.07.2020, 12:40

Теги

Похожие вопросы