We ran an article on हम एक लेख पर भागा How to block an IP address in iptables in Linux कैसे Linux में iptables में एक आईपी पता खंड के लिए a few days ago. पहले कुछ दिनों के लिए. Here's a complimentary article that shows you how to detect the IP addresses of attackers in case of aa denial of service (or DOS) attack. यहाँ एक मानार्थ लेख से पता चलता है कि तुम कैसे सेवा के आ इनकार के मामले में हमलावरों के आईपी पते का पता लगाने के लिए (या डॉस) हमला है.
To do this we will use free software called यह हम मुक्त सॉफ्टवेयर का इस्तेमाल किया होगा psad psad . psad works in sync with iptables and monitors the iptables logs and checks for port scans and other suspicious traffic which are usually signs of someone trying to break into your Linux server. . Iptables के साथ सिंक में psad काम करती है और निगरानी iptables लॉग और चेक पोर्ट स्कैन और अन्य संदिग्ध यातायात, जो आम तौर पर आपके Linux सर्वर में किसी को तोड़ने की कोशिश कर के संकेत हैं.
To begin, install psad. Psad शुरू करने के लिए, स्थापित करें. If you are running a flavor of Linux that has a fancy package management system like Ubuntu or Fedora you should be able to use either of the following commands to get psad on your system: यदि आप लिनक्स का स्वाद कि एक Ubuntu या Fedora की तरह कल्पना पैकेज प्रबंधन प्रणाली आपको निम्नलिखित कमांड के किसी भी उपयोग में सक्षम होना चाहिए है चल रहे हैं आपके सिस्टम पर psad करने के लिए:
# sudo apt-get install psad # उपयुक्त-मिल psad स्थापित sudo
or या
# yum install psad # Yum psad स्थापित
If this doesn't work for you head to the psad यदि यह आपके लिए काम नहीं करता है psad के सिर download page डाउनलोड पृष्ठ and download the format that works for you. और प्रारूप में डाउनलोड करें कि आप के लिए काम करता है.
As I use an Ubuntu Linux server the rest of this tutorial will be Ubuntu specific. जैसा कि मैंने एक Ubuntu Linux सर्वर इस ट्यूटोरियल होगा Ubuntu विशेष के आराम का उपयोग करें. However, with some minor tweaking you should be able to make it work on other flavors of Linux. हालांकि, कुछ छोटे tweaking आप इसे लिनक्स के अन्य जायके पर काम करने में सक्षम होना चाहिए के साथ. Open the syslog.conf file with your favorite text editor: अपने पसंदीदा पाठ संपादक के साथ syslog.conf फ़ाइल खोलें:
# vim /etc/syslog.conf शक्ति # / etc / syslog.conf
Add the following line at the end of the of the file: फ़ाइल के अंत में निम्नलिखित पंक्ति जोड़ें:
kern.info |/var/lib/psad/psadfifo kern.info | / var / lib / / psadfifo psad
You can use the following command to accomplish the same thing: आप निम्न कमांड का प्रयोग एक ही बात को पूरा कर सकते हैं:
# echo -e 'kern.info\t|/var/lib/psad/psadfifo' >> /etc/syslog.conf # गूंज-ए 'kern.info \ T | / var / lib / psad / psadfifo'>> / etc / syslog.conf
Now restart the sysklogd and klog daemons: अब sysklogd और klog daemons पुनः आरंभ:
/etc/init.d/sysklogd restart / etc / init.d sysklogd / पुनः आरंभ
/etc/init.d/klogd restart / etc / init.d klogd / पुनः आरंभ
The way psad works is that it will detect and instruct iptables to block any suspicious IPs. जिस तरह से काम करता है psad यह है कि यह पता लगाने और iptables को किसी भी संदेहास्पद आईपी ब्लॉक शिक्षा जाएगा. Sometimes this might result in the blocking of an IP which you use. कभी कभी यह एक आईपी के अवरुद्ध है जो आप प्रयोग में परिणाम हो सकता है. To overcome this issue you should create a file containing a list of safe IP addresses. इस मुद्दे को आप एक सुरक्षित आई पी पतों की एक सूची जिसमें फाइल बनाने पर काबू पाने चाहिए. Create a file like this one: यह एक तरह एक फ़ाइल बनाएँ:
# vim /home/calvin/safeiplist.cfg # शक्ति / घर / केल्विन / safeiplist.cfg
Enter the IP addresses that you need psad to whitelist: आईपी पते दर्ज करें कि आप श्वेतसूची में psad की जरूरत है:
127.0.0.0/24 127.0.0.0/24
192.168.0.0/24 192.168.0.0/24
122.164.34.240 122.164.34.240
No use a script like following one to configure iptables with the necessary rules. Note that this script will remove all previous settings from your iptables setup. कोई फायदा नहीं एक आवश्यक नियमों के साथ विन्यस्त iptables निम्नलिखित की तरह एक स्क्रिप्ट. ध्यान दें कि यह लिपि अपनी iptables स्थापना से पहले सभी सेटिंग्स हटा देंगे. Copy and paste the following script on your Linux server, and replace the variables WORKDIR and SAFEIPLIST with the correct settings from your setup. कॉपी और आपके Linux सर्वर पर निम्न स्क्रिप्ट पेस्ट, और चर की जगह WORKDIR और SAFEIPLIST अपनी स्थापना से सही सेटिंग्स के साथ.
WORKDIR="/home/calvin/" WORKDIR = "/ home / केल्विन /"
INTERVAL="5" = "5 अंतराल"
HITCOUNT="5" = "5 HITCOUNT"
SAFEIPLIST="safeiplist.cfg" SAFEIPLIST safeiplist.cfg = ""
cd $WORKDIR सीडी $ WORKDIR
iptables -F iptables-F
if [ -f $SAFEIPLIST ]; then अगर [-F $ SAFEIPLIST], तो
IPS=$(grep -Ev “^#” $SAFEIPLIST) आईपीएस = ($ grep-Ev "^" # SAFEIPLIST $)
for i in $IPS मैं के लिए $ में आईपीएस
do करना
iptables -A INPUT -s $i -j ACCEPT iptables-एक निवेश-$ S i-j स्वीकार
done हो गया
fi fi
iptables -A INPUT -m state –state NEW -m recent –set iptables-एक निवेश मी राज्य राज्य की नई मी हाल ही में किया गया
iptables -A INPUT -m state –state NEW -m recent –update –seconds $INTERVAL –hitcount $HITCOUNT -j LOG iptables-एक निवेश मी राज्य राज्य की नई मी हाल के नवीनीकृत सेकंड $ अंतराल-hitcount $ HITCOUNT-j LOG
What the script does is that it logs an IP address if it makes five or more attempts at making a connection in the span of five seconds. स्क्रिप्ट है क्या यह है कि यह एक आईपी पता अगर यह पाँच सेकंड के अंतराल में एक कनेक्शन बनाने में पांच या इससे अधिक प्रयास लॉग बनाता है. I would suggest you use the script as is unless you know what you are doing while modifying it. मेरा सुझाव है कि तुम स्क्रिप्ट का प्रयोग के रूप में जब तक तुम जानते हो कि तुम क्या करते हुए इसे संशोधित कर रहे है. One you are done, give it executable permissions and run it. एक तुम, यह किया निष्पादन योग्य अनुमति देने और इसे चला रहे हैं.
# chmod +x /home/calvin/ipblock.sh # Chmod + x / घर केल्विन / / ipblock.sh
# /home/calvin/ipblock.sh # / घर / केल्विन / ipblock.sh
Now back to psad. अब वापस psad है. Open the psad configuration file and edit it. खुला psad विन्यास फाइल और संपादित करें. These are the changes I suggest you make. इन परिवर्तनों को मैं सुझाव है कि आप कर रहे हैं. Feel free to go through the psad documentation and make other changes: बेझिझक psad प्रलेखन के माध्यम से जाने के लिए और अन्य परिवर्तन करें:
EMAIL_ADDRESSES you@yourdomain.com; EMAIL_ADDRESSES you@yourdomain.com;
Set machine's hostname: सेट मशीन का होस्टनाम:
HOSTNAME yourdomain.com; होस्टनाम yourdomain.com;
If you have only one network interface on this server, set HOME_NET to: यदि आप इस सर्वर पर केवल एक नेटवर्क इंटरफेस है, HOME_NET स्थापित है:
HOME_NET NOT_USED; HOME_NET NOT_USED;
You can also need to adjust danger levels for psad, and define a set of ports to ignore, for example to ask psad ignore udp ports 80 and 8080, make the following change: आप यह भी करने के लिए psad, और बंदरगाहों का एक सेट को परिभाषित करने के लिए खतरे की अनदेखी स्तर समायोजित करने की जरूरत है, उदाहरण के लिए पूछने के लिए कर सकते हैं psad UDP 80 बंदरगाहों और 8,080, उपेक्षा निम्नलिखित बदलाव करें:
IGNORE_PORTS udp/80, udp/8080; IGNORE_PORTS udp/80, udp/8080;
Save and close the file. फ़ाइल सहेजें और बंद करें. Then restart psad: तो psad पुनः आरंभ:
# /etc/init.d/psad restart # / Etc / init.d psad / पुनः आरंभ
You are now good to go. अब तुम जाने के अच्छे हैं. To monitor psad's reports run the following command: को psad रिपोर्ट की निगरानी निम्न कमांड चलायें:
# psad -S Psad #-S
To remove automatically clocked IPs run the following command: स्वचालित रूप से दर्ज आईपी हटा निम्न कमांड चलायें:
# psad -F # Psad एफ
psad is a very versatile and powerful tool. psad एक बहुत बहुमुखी और शक्तिशाली उपकरण है. If you know how to use it it can do wonders for you, but if you don't you can really mess up your computer. यदि आपको पता है कि यह कैसे उपयोग यह तुम्हारे लिए चमत्कार कर सकते हैं, लेकिन यदि आप क्या तुम सच में अपने कंप्यूटर गड़बड़ नहीं कर सकते. So please use psad with caution. बहुत सावधानी के साथ psad कृपया का उपयोग करें.























{ 1 trackback } (1) Trackback
{ 0 comments… (0 टिप्पणियाँ ... add one now एक अभी जोड़ें } )
Leave a Comment एक टिप्पणी छोड़ दो