'iptables'에 해당하는 글 2건

#!/bin/bash

for i in $( tail -n50 /usr/local/apache/logs/*log | grep '301 ' | awk '{print $1}' | sort | uniq -c | awk '$1 >30 {print $2}'); do
echo "$i blocked"
/root/block $i
done

sleep 30

for i in $( tail -n50 /usr/local/apache/logs/*log | grep '301 ' | awk '{print $1}' | sort | uniq -c | awk '$1 >30 {print $2}'); do
echo "$i blocked"
/root/block $i
done


for i in $(tail -n50 /usr/local/apache/logs/*log | grep 'htmGET' | awk '{print $2}' | grep -v 'Jan'); do

echo "$i blocked"

/root/block $i

done



cat block 

#!/usr/local/bin/php

<?

posix_setuid(0);

$ip = $argv[1];


//$id = sem_get(0x12341234, 1);

//sem_acquire($id);


$a = `iptables -L -n | grep $ip`;

if(!$a)`iptables -I INPUT -s $ip -j DROP`;


//sem_release($id);

?>


신고
크리에이티브 커먼즈 라이선스
Creative Commons License

WRITTEN BY
김병국
유용했던 자료를 기록해 두었습니다. 도움이 되시길~~~ Welcome! I started this blog as a way to give back to all of the other system administrators who have taught me something in the past. Writing these posts brings me a lot of enjoyment and I hope you fun

받은 트랙백이 없고 , 댓글이 없습니다.
secret


신고
크리에이티브 커먼즈 라이선스
Creative Commons License

WRITTEN BY
김병국
유용했던 자료를 기록해 두었습니다. 도움이 되시길~~~ Welcome! I started this blog as a way to give back to all of the other system administrators who have taught me something in the past. Writing these posts brings me a lot of enjoyment and I hope you fun

받은 트랙백이 없고 , 댓글이 없습니다.
secret