Important note about SSL VPN compatibility for 20.0 MR1 with EoL SFOS versions and UTM9 OS. Learn more in the release notes.

This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

FTP Login-Versuche limitieren

Hallo,

wir haben hier hinter einer Astaro ASG 120 7.305 einen W2k3 Server mit IIS-FTP-Server stehen. Der Port 21 wird von aussen an diesen weitergeleitet, damit man von extern auf den internen FTP-Server zugreifen kann. Das funktioniert auch soweit.
Was leider auch dazu führt, daß mittlerweile im Sekundentakt versucht wird, sich per Brute-Force auf dem FTP-Server einzuloggen. Das Windows-Ereignisprotokoll ist voll davon...

Da der IIS leider von sich aus keine Möglichkeiten bietet, die Login-Versuche pro Zeit zu begrenzen (1 Versuch pro 5 Sek zB), würde ich das gerne in der Astaro realisieren, bin aber bisher noch nicht fündig geworden. 
Hat da jemand eine Idee oder einen Vorschlag, der mich in die richtige Richtung lenkt?

Vielen Dank!

Gruß,

Patrick Schneider


This thread was automatically locked due to age.
Parents
  • Ich würde die empfehlen den FTP auf nen völlig anderen Port zulegen. Das kannst du per NAT ganz einfach machen. Nimm zum Beispiel den Port 27852. Diesen schaltest du in der Astaro frei und sagst alles was auf diesem Port reinkommt, soll auf den Port 21 deines IIS weitergeleitet werden. Schon hast du die meisten Bruteforcer vom Hals, da diese erstmal scannen müssten um den IIS zu finden.
    Das andere dürfte schwerlich möglich sein, da du ja dann etwas haben müsstest was auf OSI Schicht 7 in den Stream schaut und dort liest, das die Verbindung abgewiesen wurde. Weil rein netzwerktechnisch (Layer 3) kommt eine normale Verbindung zustande, das Ding ist für die Astaro also als "dat läuft" erledigt.

    Mach das mit nem anderen Port, ist einfacher.... [;)]
  • I would also make sure that IPS is on for FTP servers.

    Gruß - Bob
     
    Sophos UTM Community Moderator
    Sophos Certified Architect - UTM
    Sophos Certified Engineer - XG
    Gold Solution Partner since 2005
    MediaSoft, Inc. USA
  • I would also make sure that IPS is on for FTP servers.

    It was already enabled, but didn't stop the ftp-hammering. [:(]

    Kind Regards,
    Patrick
  • Das meine ich auf Anwendungsebene ... Der IIS muss natürlich conform den Request abweisen, ergo, eine Standartantwort zurückgeben, diese zählt die Astaro und sperrt den "Hammerer" damit aus.
    Ich versuche das die Tage mal nachzuspielen, vielleicht finde ich etwas für dich.

    Grüße

    Björn
  • Zur Information:
    Ich habe das Skript von http://www2.irobx.net:8010/serendipity/index.php?/archives/1-FTP-autoban-script-for-IIS.html benutzt, um das Problem zu lösen.


    :TOP

    if exist diff.txt del diff.txt

    for /f %%f in ('dir /od C:\WINDOWS\system32\LogFiles\MSFTPSVC1 /b/s') do @set t11=%%f

    if exist current.log fc %t11% current.log > diff.txt

    findstr /c:"PASS - 530" diff.txt 

    if not errorlevel 1 call cscript autobanftp.vbs diff.txt >> autoban.log

    copy %t11% current.log /y



    sleep 10

    goto :TOP


    sleep war bei mir nicht vorhanden, ist aber aus dem Windows Server 2003 Resource Kit Tools ( Download details: Windows Server 2003 Resource Kit Tools ) extrahierbar.


    Const ForReading = 1

    Dim ips

    Set counts = CreateObject("Scripting.Dictionary")

    Set objFSOstats = CreateObject("Scripting.FileSystemObject")

    Set objFTPSVC = GetObject("IIS://localhost/MSFTPSVC")

    Set objFTPIPSec = objFTPSVC.IPSecurity



    If Wscript.Arguments.Count > 0 Then

    strFlag = Wscript.arguments.Item(0)

    End If



    If IsEmpty(strFlag) Then                'No arguments have been received

    wscript.echo "Must supply an filename"

    wscript.quit

    End If



    Set objTextFile = objFSOstats.OpenTextFile(strflag, ForReading)



    'Read each line and count the number for badpass login attempts per IP

    i=0

    Do Until objTextFile.AtEndOfStream

        i=i+1

        logline = objTextFile.Readline

        If InStr(logline,"PASS - 530") Then 

         parsevar=split(logline)

         If not counts.exists(parsevar(2)) Then 

         counts.add parsevar(2),1 

         wscript.echo "*****"

         wscript.echo "New IP: " & parsevar(2)

         Else 

         counts(parsevar(2))=counts(parsevar(2))+1

        End If

         End If

    Loop



    For each ip in Counts.keys

    tempd=date()

    tempt=Time()

    wscript.echo tempd,tempt

    wscript.echo "Counteed " &  counts(ip) & " failed logons on IP: " & ip

    If counts(ip) > 5 Then 

    'Kill the route to the machine then add it to the array of banned IPs.

    wscript.echo "Killing route for ip: " & ip 

    Set WshShell = WScript.CreateObject("WScript.Shell")

    WshShell.Run "ROUTE ADD " & ip & " MASK 255.255.255.255 192.168.1.2", 1, True

    Set WshShell = Nothing

    ftpban(ip)

    End If

    Next





    Sub ftpban(ipaddress)

    'Append the newly banned IPs to the currently banned IPs  



    nogo=0 ' Dont do the ban if the address is already in the deny list

    bannedIPArray = objFTPIPSec.IPDeny

      Dim newiparray()

      ReDim newiparray(ubound(bannedIPArray)+1)

      'wscript.echo newiparray(ubound(bannedIPArray)+1)

      For i = 0 to ubound(bannedIPArray)

    newiparray(i)=bannedIPArray(i)

       'wscript.echo i,newiparray(i)

       clientIP = Left(bannedIPArray(i),InStr(bannedIPArray(i),",")-1)

       If ipaddress = ClientIP Then nogo=1

      Next



    If not nogo=1 Then 



    newiparray(ubound(bannedIPArray)+1)= ipaddress & ",255.255.255.255"

    wscript.echo "Banned: " &ipaddress & ",255.255.255.255"



    objFTPIPSec.IPDeny = newiparray

    objFTPSVC.IPSecurity = objFTPIPSec

    objFTPSVC.SetInfo    

    End If

    End Sub

  • Es gibt von FileZilla einen OpenSource FTP Server,
    der kann ua. auch IPs blacklisten nach x Versuchen.

    Gregor Kemter
Reply Children
No Data