Nutzung der hosts.deny

neudeck

Neuer User
Mitglied seit
9 Mai 2009
Beiträge
2
Punkte für Reaktionen
0
Punkte
0
Ich möchte bestimmte Connectionsversuche auf der Fritzbox verhindern. Dazu möchte ich eine Datei hosts.deny erstellen und mit entsprechenden Infos füttern.

Standardmäßg soll diese Datei wohl unter /var/tmp liegen. Auf Grund der einfacheren Administration möchte ich diese jedoch auf einen angeschlossenen USB Stick legen. Gibt es eine Möglichkeit, die Datei von dort funktionstüchtig einzubinden?

Bereits versucht habe ich, das jeweilige Verzeichnis unter /var/tmp zu mounten. Das war aber kontraproduktiv, da die Box dann nicht mehr auf die (benötigten) Dateien im echten /var/tmp-Verzeichnis zugreifen kann.

Besten Dank für die Hilfe!

Gruß
Stefan
 
schau mal ob es fail2ban für freetz gibt, das wertet die auth.log aus und blockt dann ips per iptablets
 
Nein, gibt es nicht, das fail2ban python und iptables benötigt. iptables sind kein Problem, python ist aber definitiv nicht vorhanden in den offiziellen Repositories.

@neudeck: Schau mal im Forum nach so etwas wie "mount -o bind".
 
@neudeck:
Versuch es mal mit einem symlink.
Die hosts.deny sollte man nicht mehr benutzen. D. h. nicht, dass man sie nicht benutzen kann. Das kann man aber mit der hosts.allow machen.
Z. B. als letzte Zeile in der hosts.allow:
Code:
ngircd,vsftpd,httpd,dropbear,telnetd : ALL : [B]deny[/B]
 
fail2ban ist eine komplexe Antwort auf eine Frage, die hier nicht gestellt wurde.

Unter /var/tmp kann man einfach Symlinks erstellen.
 
Mir ist nicht ganz klar warum eine Administration über das Freetz Webinterface nicht einfach sein soll?

Dummerweise ist hosts.deny und hosts.allow im "falschen" Paket. Eigentlich sollte das zu den tcp_wrappers und nicht zum nfsd-cgi? Aber das entsprechende Paket muss dann doch auch mit Support dafür gebaut sein.

MfG Oliver
 
Here a simple script that adds IP addresses of foreign hosts that have failed to authenticate with dropbear to the iptables firewall so that it drops packets from those sources. The script should be run at regular intervals from crontab. The script may serve as a sample.

Code:
####################### ipv4 firewall - update droplist ###############################
# Adds IP addresses of foreign hosts that failed to authenticate with dropbear to firewall to drop packets from.
# To be run from the crontab.

# execution context
IPTABLES=iptables
SYSLOG=/media/ftp/uStora1/var/log/messages
DROPLIST=/media/ftp/uStora1/var/lib/fw/droplist
# iptable chain and target to use,
#   target INPUT to $IPT_DROPLIST for test on IP sources to be dropped,
#     $IPT_DROPLIST must pre-exist.
#   target matched packets to a target that besides DROP may also perform other actions, e.g. log the match.
#     $IPT_DROPTARGET must pre-exist.
IPT_DROPLIST=droplist
IPT_DROPTARGET=log_and_drop

echo -n "Updating firewall (ipv4) droplist..." |logger -t "IPV4FW" -p local0.info 

# update droplist with failed user/password SSH logon tries from the syslog.
[ -f ${DROPLIST} ] || touch ${DROPLIST} 
CNT=$(wc -l <${DROPLIST})
cp ${DROPLIST} ${DROPLIST}.tmp
grep -B1 'dropbear.*: exit before auth' ${SYSLOG} |grep 'Child connection from' |awk '{print $10}' |sed -e 's/:.*//g' >>${DROPLIST}.tmp
grep -v '10\.27\.' ${DROPLIST}.tmp |sort |uniq >${DROPLIST}
rm ${DROPLIST}.tmp
CNT=$(expr $(wc -l <${DROPLIST}) - ${CNT})

# update the iptables chain droplist.
echo -n "Adding ${CNT} new entries to $IPT_DROPLIST"  |logger -t "IPV4FW" -p local0.info
$IPTABLES -F $IPT_DROPLIST
for IP in `cat ${DROPLIST}`; do $IPTABLES -A $IPT_DROPLIST -s ${IP} -j $IPT_DROPTARGET; done

echo "done."
 
Kostenlos!

Statistik des Forums

Themen
248,924
Beiträge
2,305,302
Mitglieder
378,651
Neuestes Mitglied
rehe992