find footprint script virus webhost server
find /home/*/domains/*/public_html/ -maxdepth 2 -type f -name '.htaccess' -print0 | xargs -0 grep -il '(py|exe|php)' find /home/*/domains/*/public_htm..
#การใช้ netstat ตรวจสอบการถูกยิงด้วย syn คำสั่ง
netstat -ntu | grep SYN_RECV | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr
อันนี้จะบอกว่า ณ ขณะเวลานั้นๆ มีคนส่ง syn เข้ามาเพื่อขอเชื่อมกับ server ของเรา โดยปกติไม่ควรเกิน 10 ครั้งต่อ 1 IP หากเกินกว่านั้นท่าน Block ได้เลย
#การใช้ netstat นับจำนวน connetion ของแต่ละ IP คำสั่ง
netstat -ntu | grep ESTABLISHED | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr
อันนี้จะบอกว่า ณ ขณะเวลานั้นๆ แต่ละ IP มีการเชื่อมต่อกับเรากี่ connetion โดยปกติไม่ควรเกิน 10-20 ครั้งต่อ 1 IP หากเกินกว่านั้นท่าน Block ได้เลย
#การ Block ก็ง่ายๆ ไม่ยากด้วย iptables ตัวอย่าง
iptables -A INPUT -s xxx.xxx.xxx.xxx -j DROP
ความหมาย -A = เพิ่ม(add), -s = IP ต้นทาง, -j DROP = Block IP นั้นซ่ะ
#Block เป็น IP Class
iptables -A INPUT -s xxx.xxx.xxx.xxx/xx -j DROP
#Block เป็น Protocal
iptables -A INPUT -p udp --dport 80 -j DROP
ความหมาย -p = เลือก Protocal(udp, tcp) ที่ต้องการ, --dport
= port ปลายทาง, --sport
= port ต้นทาง
ทำให้ server ยังอยู่ได้ไม่ม่องเท่งก่อน เวลาอันควร เอาคำสั่งนี้ไว้บนๆ สุดหน่อย จะช่วยได้มากครับ
คำสั่งแรกเป็นคำสั่ง Limit syn Packet ให้อยู่ในช่วง 25 Packet ต่อวินาที และไม่เกิน 30 ต่อวินาที
iptables -A INPUT -p tcp --syn -m limit --limit 25/s --limit-burst 30 -j ACCEPT
คำสั่งที่ 2 ถ้ามันเกินจากนั้นก็จะถูก Drop ด้วยคำสั่งถัดมา
iptables -A INPUT -p tcp --syn -j DROP
ปล. เครดิตเสี่ยโป้ง (Hostparagon)
cidr: https://tools.icez.net/cidr.php
October 12, 2009
Blog | #Command #Linux #Security
find /home/*/domains/*/public_html/ -maxdepth 2 -type f -name '.htaccess' -print0 | xargs -0 grep -il '(py|exe|php)' find /home/*/domains/*/public_htm..
ติดตั้ง squid รุ่นล่าสุด https://www.squid-cache.org/Versions/ cd /tmp wget http://www.squid-cache.org/Versions/v3/3.4/squid-3.4.9.tar.gz tar xvfz squ..
ยกตัวอย่างเช่น ssh จากเครื่อง A ไปเครื่อง B โดยไม่ใช้รหัสผ่านในการ ssh @เครื่อง A ssh-keygen -t rsa (มีอะไรขึ้นมาก็กด enter ผ่านไปให้หมด แล้วพิมพ์คำสั..
example error curl -I https://www.google.com/ curl: (60) SSL certificate problem: unable to get local issuer certificate . . ..
from https://github.com/vdeville/ssh-login-alert-telegram apt-get -y install git cd /opt/ && git clone https://github.com/vdeville/ssh-login-alert-tel..
How to set time log proftp same Server (OS: Debian + CP: DirectAdmin) 1. edit proftpd.conf vim /etc/proftpd.conf 2. edit to config TimesGMT off SetEnv..