If you are responsible for a Linux server, security becomes a big concern. Ja Jūs esat atbildīgs par Linux serveri, drošība kļūst lielas bažas. Some of the biggest threats to a server's security are DDOS attacks and repeated attempts to enter the server using automates bots. Daži no lielākajiem apdraudējumiem servera drošības DDOS uzbrukumi un atkārtotiem mēģinājumiem iekļūt serverī, izmantojot automatizē roboti. There are a number of ways by which you can detect the IP address of a potential intruder. Ir veidos, ar kuru jūs varat atklāt IP adresi potenciālo iebrucēju numuru. But what do you do after you have located his/her IP address? Bet tas, ko jūs darīt, kad esat atrodas viņa / viņas IP adresi? Well, you block it. Nu, tu to bloķēt. Here's how you do it using IPTables which is the firewall that ships with most flavors of Linux. Lūk, kā jūs to, izmantojot iptables, kas ir ugunsmūris, ka kuģi ar lielāko flavors of Linux.
If you have just one IP address that you want to block you can use the following method: Ja jums ir tikai viena IP adrese, kuru vēlaties bloķēt, varat izmantot šādu metodi:
# iptables -I INPUT -s 122.174.12.228 -j DROP # Iptables-I INPUT-s 122.174.12.228-j DROP
This command will add an entry into your iptables configuration file, instructing it to drop any packets that come from the IP 122.172.9.222 . Šī komanda pievienos stāšanās Jūsu iptables konfigurācijas failu, uzdodot tai samazināties visus paketes, kas nāk no 122.172.9.222 IP. If you face numerous attacks you are better of using a slightly more automated method to add the IPs from your ban list. Ja Jums nākas saskarties ar dažādiem uzbrukumiem jūs labāk izmantot nedaudz vairāk automatizēta metode, lai pievienotu IP no jūsu aizliegumu sarakstu. To do that create the following script: Lai to izdarītu, kas rada šādu skriptu:
#!/bin/sh #! / bin / sh
for i in $(< banned_IPs.cfg) ; do par i $ (<banned_IPs.cfg) do
iptables -I INPUT -i eth1 -s "$i" -j DROP iptables-I INPUT-i eth1-s "$ i"-j DROP
done izdarīts
Save the script into a file named something like banned_IPs.sh and grant it executable privileges: Saglabāt skriptu fails ar nosaukumu kaut kā banned_IPs.sh un piešķirt tai izpildāmā privilēģiju izmantošanas:
# chmod +x banned_IPs.sh # Chmod + x banned_IPs.sh
Now create a file called banned_IPs.cfg and enter the list of IP addressed you want to block, each in a new line: Tagad izveidot failu ar nosaukumu banned_IPs.cfg un ievadiet saraksta IP adresē, kuru vēlaties bloķēt, katra jauna pozīcija:
122.174.12.228 122.174.12.228
129.122.10.23 129.122.10.23
111.154.84.130 111.154.84.130
Now run the script banned_IPs.sh to have the IP addresses you want blocked added to the list of banned IPs in iptables: Tagad palaist skriptu banned_IPs.sh ir IP adreses, kuras vēlaties bloķēt pievienots sarakstam aizliegto IP in iptables:
# ./banned_IPs.sh #. / Banned_IPs.sh























Simple, clear and efficient. Vienkārša, skaidra un efektīva.
Btw, is there any nice black list website where we can sync the “banned_IPs.cfg” file dailly for example? Btw, ir kāda jauka melnais saraksts mājas lapā, kur mēs varam sinhronizēt "banned_IPs.cfg" failu Dailly piemēram? Should be nice…. Būtu nice ....
br, br,
TT TT