Absicherung von CCcam mit fail2ban auf Debian Server

Wer einen CCcam Server zu Testzecken betreibt, kann die merkwürdigsten Dinge erleben.

Hier möchte ich kurz aufzeigen, wie man einen CCcam Server etwas absichern kann. Mit den folgenden Zeilen wird die IP von der “bad command”, “double login” oder “signature failed” kommt für eine halbe Stunde gesperrt.

Installation der Software:
apt-get install fail2ban -y

Bearbeiten von /etc/fail2ban/jail.conf und folgende Zeilen anfügen.
Ggf. muss port an den Port von eurem CCcam Server angepasst werden.
Mit maxretry geben wir die Fehlversuche an. Nach diesen wird die IP via iptable Regel für eine halbe Stunde gesperrt. Diese Zeit können wir durch bantime anpassen. Die Angabe ist in Sekunden. 30 Minuten = 1800 Sekunden.

Code:
[cccam_signaturefailed]
enabled  = true
port     = 12000
filter   = cccam-signature
logpath  = /var/log/daemon.log
bantime  = 1800
maxretry = 10

[cccam_badcommand]
enabled  = true
port     = 12000
filter   = cccam-command
logpath  = /var/log/daemon.log
bantime  = 1800
maxretry = 10

[cccam_doublelogin]
enabled  = true
port     = 12000
filter   = cccam-login
logpath  = /var/log/daemon.log
bantime  = 1800
maxretry = 10

Jetzt noch die drei Filter unter /etc/fail2ban/filter.d/ anlegen. Das könnt ihr mit eurem Lieblingseditor machen

cccam-signature.conf
# Fail2Ban configuration file
#
# Author: Cyril Jaquier
#
# $Revision: 510 $
#
[Definition]
# Option:  failregex
# Notes.:  regex to match the password failures messages in the logfile. The
#          host must be matched by a group named “host”. The tag “<HOST>” can
#          be used for standard IP/hostname matching and is only an alias for
#          (?:::f{4,6}:)?(?P<host>\S+)
# Values:  TEXT
#
failregex = CCcam: kick <HOST>, signature failed
# Option:  ignoreregex
# Notes.:  regex to ignore. If this regex matches, the line is ignored.
# Values:  TEXT
#
ignoreregex =

cccam-login.conf
# Fail2Ban configuration file
#
# Author: Cyril Jaquier
#
# $Revision: 510 $
#
[Definition]
# Option:  failregex
# Notes.:  regex to match the password failures messages in the logfile. The
#          host must be matched by a group named “host”. The tag “<HOST>” can
#          be used for standard IP/hostname matching and is only an alias for
#          (?:::f{4,6}:)?(?P<host>\S+)
# Values:  TEXT
#
failregex = CCcam: double login .*, .* \(<HOST>\)
# Option:  ignoreregex
# Notes.:  regex to ignore. If this regex matches, the line is ignored.
# Values:  TEXT
#
ignoreregex =

cccam-command.conf
# Fail2Ban configuration file
#
# Author: Cyril Jaquier
#
# $Revision: 510 $
#
[Definition]
# Option:  failregex
# Notes.:  regex to match the password failures messages in the logfile. The
#          host must be matched by a group named “host”. The tag “<HOST>” can
#          be used for standard IP/hostname matching and is only an alias for
#          (?:::f{4,6}:)?(?P<host>\S+)
# Values:  TEXT
#
failregex = CCcam: kick <HOST>.*, bad command
# Option:  ignoreregex
# Notes.:  regex to ignore. If this regex matches, the line is ignored.
# Values:  TEXT
#
ignoreregex =

Zum Schluss wird das Programm nochmal durchgestartet.

/etc/init.d/fail2ban restart

Warnungen und Banvorgänge könnt ihr von nun an unter /var/log/fail2ban.log sehen.

Share Save 171 16 in Absicherung von CCcam mit fail2ban auf Debian Server

Dieser Beitrag wurde unter EMU, Linux abgelegt und mit , , , , verschlagwortet. Setze ein Lesezeichen auf den Permalink.

Hinterlasse eine Antwort

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind markiert *


*

Du kannst folgende HTML-Tags benutzen: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>