Metainformationen zur Seite
  •  

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
Letzte Überarbeitung Beide Seiten der Revision
start:linux:ubuntu:ufw [2020/06/29 14:41]
wikiadmin [Installation]
start:linux:ubuntu:ufw [2020/06/29 15:15]
wikiadmin [Einige Beispielanwendungen]
Zeile 1: Zeile 1:
 ====== UFW Firewall ====== ====== UFW Firewall ======
-===== Installation =====+===== Installation und Status =====
 [[https://wiki.ubuntuusers.de/iptables2/|iptables2]] ist eine Firewall Einrichtungen bei Ubuntu oder Debian. Eine vereinfachte Version ist [[https://wiki.ubuntuusers.de/ufw/|ufw ]]. [[https://wiki.ubuntuusers.de/iptables2/|iptables2]] ist eine Firewall Einrichtungen bei Ubuntu oder Debian. Eine vereinfachte Version ist [[https://wiki.ubuntuusers.de/ufw/|ufw ]].
  
Zeile 27: Zeile 27:
 </code> </code>
  
 +===== Wo wird was gespeichert ? =====
  
 Die Einstellungen werden in folgenden drei Dateien gespeichern: Die Einstellungen werden in folgenden drei Dateien gespeichern:
Zeile 118: Zeile 119:
 </code> </code>
  
 +Hier eine Beispielausgabe der Datei: **/etc/ufw/user.rules**
 <code CPP [enable_line_numbers="false",highlight_lines_extra="0,"]> <code CPP [enable_line_numbers="false",highlight_lines_extra="0,"]>
 +root@HPGen10-1:~# root@HPGen10-1:~# cat /etc/ufw/user.rules
 +*filter
 +:ufw-user-input - [0:0]
 +:ufw-user-output - [0:0]
 +:ufw-user-forward - [0:0]
 +:ufw-before-logging-input - [0:0]
 +:ufw-before-logging-output - [0:0]
 +:ufw-before-logging-forward - [0:0]
 +:ufw-user-logging-input - [0:0]
 +:ufw-user-logging-output - [0:0]
 +:ufw-user-logging-forward - [0:0]
 +:ufw-after-logging-input - [0:0]
 +:ufw-after-logging-output - [0:0]
 +:ufw-after-logging-forward - [0:0]
 +:ufw-logging-deny - [0:0]
 +:ufw-logging-allow - [0:0]
 +:ufw-user-limit - [0:0]
 +:ufw-user-limit-accept - [0:0]
 +### RULES ###
 +
 +### tuple ### allow tcp 22 0.0.0.0/0 any 0.0.0.0/0 OpenSSH - in
 +-A ufw-user-input -p tcp --dport 22 -j ACCEPT -m comment --comment 'dapp_OpenSSH'
 +
 +### tuple ### allow tcp 22 0.0.0.0/0 any 0.0.0.0/0 in
 +-A ufw-user-input -p tcp --dport 22 -j ACCEPT
 +
 +### END RULES ###
 +
 +### LOGGING ###
 +-A ufw-after-logging-input -j LOG --log-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10
 +-A ufw-after-logging-forward -j LOG --log-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10
 +-I ufw-logging-deny -m conntrack --ctstate INVALID -j RETURN -m limit --limit 3/min --limit-burst 10
 +-A ufw-logging-deny -j LOG --log-prefix "[UFW BLOCK] " -m limit --limit 3/min --limit-burst 10
 +-A ufw-logging-allow -j LOG --log-prefix "[UFW ALLOW] " -m limit --limit 3/min --limit-burst 10
 +### END LOGGING ###
 +
 +### RATE LIMITING ###
 +-A ufw-user-limit -m limit --limit 3/minute -j LOG --log-prefix "[UFW LIMIT BLOCK] "
 +-A ufw-user-limit -j REJECT
 +-A ufw-user-limit-accept -j ACCEPT
 +### END RATE LIMITING ###
 +COMMIT
 +root@HPGen10-1:~# 
 +                                                                                                                                                                                                                  
 </code> </code>
 +
 +Hier eine Beispielausgabe der Datei: **/etc/ufw/after.rules**
 <code CPP [enable_line_numbers="false",highlight_lines_extra="0,"]> <code CPP [enable_line_numbers="false",highlight_lines_extra="0,"]>
 +root@HPGen10-1:~# root@HPGen10-1:~# cat /etc/ufw/after.rules
 +#
 +# rules.input-after
 +#
 +# Rules that should be run after the ufw command line added rules. Custom
 +# rules should be added to one of these chains:
 +#   ufw-after-input
 +#   ufw-after-output
 +#   ufw-after-forward
 +#
 +
 +# Don't delete these required lines, otherwise there will be errors
 +*filter
 +:ufw-after-input - [0:0]
 +:ufw-after-output - [0:0]
 +:ufw-after-forward - [0:0]
 +# End required lines
 +
 +# don't log noisy services by default
 +-A ufw-after-input -p udp --dport 137 -j ufw-skip-to-policy-input
 +-A ufw-after-input -p udp --dport 138 -j ufw-skip-to-policy-input
 +-A ufw-after-input -p tcp --dport 139 -j ufw-skip-to-policy-input
 +-A ufw-after-input -p tcp --dport 445 -j ufw-skip-to-policy-input
 +-A ufw-after-input -p udp --dport 67 -j ufw-skip-to-policy-input
 +-A ufw-after-input -p udp --dport 68 -j ufw-skip-to-policy-input
 +
 +# don't log noisy broadcast
 +-A ufw-after-input -m addrtype --dst-type BROADCAST -j ufw-skip-to-policy-input
 +
 +# don't delete the 'COMMIT' line or these rules won't be processed
 +COMMIT
 +root@HPGen10-1:~#   
 +
 </code> </code>
 +
 +===== Einige Beispielanwendungen =====
 +
 <code CPP [enable_line_numbers="false",highlight_lines_extra="0,"]> <code CPP [enable_line_numbers="false",highlight_lines_extra="0,"]>
 +# Listet alle Anwendungen auf die durch die Firewall gelangen soll.
 +ufw app list 
 +
 +# Zeigt die Details zu OpenSSH an.
 +ufw app info OpenSSH
 +
 +# Lässt OpenSSH durch die Firewall.
 +ufw allow OpenSSH
 +
 +# Zeigt die Einstellungen an.
 +ufw status
 +
 +# Den Port 32456 über TCP freizugeben
 +ufw 32456/tcp
 +
 </code> </code>