Fail2ban Named query flood

Create named-flood.conf in the filter.d folder (etc/fail2ban/filter.d)

[Definition]
failregex = .* client \#.*: query: .* \+E
ignoreregex =

Enable the Named query flood with the following statement in your jail.local file (etc/fail2ban/jail.local)


[named-flood-udp]
enabled = true
port = 53
protocol = udp
filter = named-flood
logpath = /var/log/named/bind9.log
maxretry = 200
bantime = 3600
ignoreip = 1.2.3.4

[named-flood-tcp]
enabled = true
port = 53
protocol = tcp
filter = named-flood
logpath = /var/log/named/bind9.log
maxretry = 200
bantime = 3600
ignoreip = 1.2.3.4

Windows Server 2008 – Changing RDP Port

Open the Registry Editor

Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp

Open PortNumber, switch to dezimal and change the port.

Click ok and close the registry editor.
By the way: U have to add a Firewall Rule for the new port to Windows Firewall…

I believe, following pictures are self explained…

now you have to restart the server or restart the “Remotedesktopservices” under the Windows Services but befor u test it: You should have physic access to the server, if something went wrong!
If you don’t have this option, install TeamViewer or something like that.. so u could return the changes in the registry.

If it works, deactivate the old RDP Firewall Rule in the Windows Firewall.

IPs mittels Iptables blockieren

Heute hab ich bemerkt, dass wiedermal ein Bot an einem meiner Server klebt und beim Ftp Service standart Users durch probiert. Dies generiert, auch wenn nur eine sehr geringe Menge, unnötigen Traffic und unnötig endlose Logfiles … Obwohl ich fail2ban am laufen hab, was sehr zu empfehlen ist, hab ich Ihn dann doch noch manuell per iptables ausgesperrt.

Oft schon standart mässig installiert:
apt-get install iptables

Anzeigen von bestehenden Chains:
iptables -L
iptables -L CHAIN

Blockieren einer bestimmten source IP auf allen Ports:
iptables -A INPUT -s 11.22.33.88 -j DROP

Herausnehmen der blockierten IP aus Chain:
iptables -D INPUT -s 11.22.33.88 -j DROP

Anlegen einer eigenen Chain:
iptables -N CHAINNAME

Der Nachteil an diesen manuell gesetzen Einträgen ist, dass sie nach einem Neustart verloren gehen. Daher empfiehlt sich, für eine fixe Lösung die iptables Einträge zum Beispiel in der /etc/iptables.conf abzulegen.
echo "iptables -A INPUT -s 11.22.33.88 -j DROP" >> /etc/iptables.conf

Danach in der /etc/network/interfaces zum loopback Interface eine pre-up Zeile hinzufügen:

auto lo
iface lo inet loopback
pre-up /sbin/iptables-restore < /etc/iptables.conf

Diese Lösunge reicht für unseren gebrauch föllig aus, birgt aber trotzdem einige Nachteile. Zudem kann man die Rules nicht einfach aus/einschalten, dafür müsste man sich ein eigenes Init-Script schreiben oder ein bestehendes umschreiben, was mir aber für diese Situation zu aufwenidig wäre.

Wer ausführlich mehr über iptables wissen will Iptables Tutorial 1.2.2@frozentux.net