Diferencia entre revisiones de «Extrae-servidores-bloqueados»
De FJWiki
| Línea 12: | Línea 12: | ||
# bloqueados por la politica de NO admitir DNS reverso. | # bloqueados por la politica de NO admitir DNS reverso. | ||
| − | egrep "NOQUEUE:.* 450 .*Client host rejected" | sed -e "{s/^.*\[\([0123456789\.]\+\)\]; from=<\([^>]*\)> to=<\([^>]\+\)>.* helo=<\([^>]\+\)>.*$/\1\t\2\t\3\t\4/g}" | sort -t @ -k 2 | + | egrep "NOQUEUE:.* 450 .*Client host rejected" \ |
| + | | sed -e "{s/^.*\[\([0123456789\.]\+\)\]; from=<\([^>]*\)> to=<\([^>]\+\)>.* helo=<\([^>]\+\)>.*$/\1\t\2\t\3\t\4/g}" \ | ||
| + | | sort -t @ -k 2 \ | ||
| + | | uniq -c \ | ||
| + | | sed -e "{s/^ *\([0123456789]\+\) /\1\t/g}" | ||
[[Category:Bash Scripts]] | [[Category:Bash Scripts]] | ||
[[Category:Postfix]] | [[Category:Postfix]] | ||
Revisión del 16:34 2 sep 2008
Este script lee el maillog que genera postfix e interpreta qué servidores está bloqueando el servicio postfix.
Ejemplo de uso del script:
[root]# cat /var/log/maillog | extrae-servidores-bloqueados
Código de extrae-servidores-bloqueados :
#!/bin/bash
# Via STDIN se lee el maillog y se saca que servidores estan siendo
# bloqueados por la politica de NO admitir DNS reverso.
egrep "NOQUEUE:.* 450 .*Client host rejected" \
| sed -e "{s/^.*\[\([0123456789\.]\+\)\]; from=<\([^>]*\)> to=<\([^>]\+\)>.* helo=<\([^>]\+\)>.*$/\1\t\2\t\3\t\4/g}" \
| sort -t @ -k 2 \
| uniq -c \
| sed -e "{s/^ *\([0123456789]\+\) /\1\t/g}"