Systemverwaltungshandbuch: IP Services

Erstellen und Bearbeiten von Konfigurationsdateien für Oracle Solaris IP Filter

Zum Erstellen oder Ändern von Regellisten und Adresspools müssen Sie die Konfigurationsdateien direkt bearbeiten. Die Konfigurationsdateien werden nach den Standardregeln zur UNIX-Syntax erstellt:

ProcedureSo erstellen Sie eine Konfigurationsdatei für Oracle Solaris IP Filter

Im folgenden Verfahren wird beschrieben, wie Sie Folgendes einrichten:

  1. Nehmen Sie eine Rolle an, die das IP Filter Management-Rechteprofil umfasst, oder melden Sie sich als Superuser an.

    Sie können das IP Filter Management-Rechteprofil einer von Ihnen erstellten Rolle zuweisen. Informationen zum Erstellen von Rollen und Zuweisen von Rollen zu Benutzern finden Sie in Configuring RBAC (Task Map) in System Administration Guide: Security Services .

  2. Starten Sie einen Dateieditor Ihrer Wahl. Erstellen oder bearbeiten Sie die Konfigurationsdateien für die Funktion, die Sie konfigurieren möchten.

    • Zum Erstellen einer Konfigurationsdatei für Paketfilterregeln bearbeiten Sie die Datei ipf.conf.

      Oracle Solaris IP Filter verwendet die Paketfilterregeln in der Datei ipf.conf. Wenn Sie die Paketfilterregeln in der Datei /etc/ipf/ipf.conf angeben, wird diese Datei beim Booten des Systems geladen. Sollen die Filterregeln nicht beim Booten geladen werden, speichern Sie die Datei in einem beliebigen anderen Verzeichnis. Sie können die Regeln dann gemäß der Beschreibung unter So aktivieren Sie eine andere oder aktualisierte Paketfilter-Regelliste mit dem Befehl ipf aktivieren.

      Informationen zum Erstellen der Paketfilterregeln finden Sie unter Verwenden der Paketfilter-Funktionen in Oracle Solaris IP Filter.


      Hinweis –

      Ist die Datei ipf.conf leer, findet keine Filterung statt. Eine leere ipf.conf-Datei verhält sich wie eine Regelliste mit dem folgenden Inhalt:


      pass in all
      pass out all

    • Zum Erstellen einer Konfigurationsdatei für NAT-Regeln bearbeiten Sie die Datei ipnat.conf.

      Oracle Solaris IP Filter verwendet die NAT-Regeln in der Datei ipnat.conf. Wenn Sie die NAT-Regeln in der Datei /etc/ipf/ipnat.conf angeben, wird diese Datei beim Booten des Systems geladen. Sollen die NAT-Regeln nicht während des Bootens geladen werden, Datei ipnat.conf in einem beliebigen anderen Verzeichnis. Sie können die NAT-Regeln dann mit dem Befehl ipnat aktivieren.

      Informationen zum Erstellen der NAT-Regeln finden Sie unter Verwenden der NAT-Funktion in Oracle Solaris IP Filter.

    • Zum Erstellen einer Konfigurationsdatei für Adresspools bearbeiten Sie die Datei ippool.conf.

      Oracle Solaris IP Filter verwendet den Adresspool in der Datei ippool.conf. Wenn Sie die Adresspool-Regeln in der Datei /etc/ipf/ippool.conf angeben, wird diese Datei beim Booten geladen. Soll der Adresspool nicht beim Booten geladen werden, speichern Sie die Dateiippool.conf in einem beliebigen anderen Verzeichnis. Sie können den Adresspool dann mit dem Befehl ippool aktivieren.

      Informationen zum Erstellen von Adresspools finden Sie unter Verwenden der Adresspool-Funktion in Oracle Solaris IP Filter.

Beispiel für Oracle Solaris IP Filter-Konfigurationsdateien

Die folgenden Beispiele verdeutlichen die Anwendung von Paketfilterregeln in Paketfilterkonfigurationen.


Beispiel 26–25 Oracle Solaris IP Filter-Hostkonfiguration

In diesem Beispiel wird eine Konfiguration auf einem Host-Computer mit der Netzwerkschnittstelle elxl gezeigt.


# pass and log everything by default
pass in log on elxl0 all
pass out log on elxl0 all

# block, but don't log, incoming packets from other reserved addresses
block in quick on elxl0 from 10.0.0.0/8 to any
block in quick on elxl0 from 172.16.0.0/12 to any

# block and log untrusted internal IPs. 0/32 is notation that replaces 
# address of the machine running Solaris IP Filter.
block in log quick from 192.168.1.15 to <thishost>
block in log quick from 192.168.1.43 to <thishost>

# block and log X11 (port 6000) and remote procedure call 
# and portmapper (port 111) attempts
block in log quick on elxl0 proto tcp from any to elxl0/32 port = 6000 keep state
block in log quick on elxl0 proto tcp/udp from any to elxl0/32 port = 111 keep state

Diese Regel beginnt mit zwei nicht eingeschränkten Regeln, die den gesamten über die Schnittstelle elxl eingehenden und ausgehenden Verkehr zulassen. Die zweite Regelliste blockiert die eingehenden Pakete von den privaten Adressbereichen 10.0.0.0 und 172.16.0.0 und verhindert deren Eintritt in die Firewall. Die nächste Regelliste blockiert bestimmte interne Adressen vom Host-Computer. Abschließend blockiert die letzte Regelliste Pakete, die an Port 6000 und Port 111 eingehen.



Beispiel 26–26 Oracle Solaris IP Filter-Serverkonfiguration

In diesem Beispiel wird die Konfiguration für einen Host-Computer gezeigt, der als Webserver arbeitet. Dieser Computer verfügt über die Netzwerkschnittstelle eri.


# web server with an eri interface
# block and log everything by default; then allow specific services
# group 100 - inbound rules
# group 200 - outbound rules
# (0/32) resolves to our IP address)
*** FTP proxy ***


# block short packets which are packets fragmented too short to be real.
block in log quick all with short


# block and log inbound and outbound by default, group by destination
block in log on eri0 from any to any head 100
block out log on eri0 from any to any head 200


# web rules that get hit most often
pass in quick on eri0 proto tcp from any \
to eri0/32 port = http flags S keep state group 100
pass in quick on eri0 proto tcp from any \
to eri0/32 port = https flags S keep state group 100


# inbound traffic - ssh, auth
pass in quick on eri0 proto tcp from any \
to eri0/32 port = 22 flags S keep state group 100
pass in log quick on eri0 proto tcp from any \
to eri0/32 port = 113 flags S keep state group 100
pass in log quick on eri0 proto tcp from any port = 113 \
to eri0/32 flags S keep state group 100


# outbound traffic - DNS, auth, NTP, ssh, WWW, smtp
pass out quick on eri0 proto tcp/udp from eri0/32 \
to any port = domain flags S keep state group 200
pass in quick on eri0 proto udp from any port = domain to eri0/32 group 100

pass out quick on eri0 proto tcp from eri0/32 \
to any port = 113 flags S keep state group 200
pass out quick on eri0 proto tcp from eri0/32 port = 113 \
to any flags S keep state group 200

pass out quick on eri0 proto udp from eri0/32 to any port = ntp group 200
pass in quick on eri0 proto udp from any port = ntp to eri0/32 port = ntp group 100

pass out quick on eri0 proto tcp from eri0/32 \
to any port = ssh flags S keep state group 200

pass out quick on eri0 proto tcp from eri0/32 \
to any port = http flags S keep state group 200
pass out quick on eri0 proto tcp from eri0/32 \
to any port = https flags S keep state group 200

pass out quick on eri0 proto tcp from eri0/32 \
to any port = smtp flags S keep state group 200


# pass icmp packets in and out
pass in quick on eri0 proto icmp from any to eri0/32  keep state group 100
pass out quick on eri0 proto icmp from eri0/32 to any keep state group 200


# block and ignore NETBIOS packets
block in quick on eri0 proto tcp from any \
to any port = 135 flags S keep state group 100

block in quick on eri0 proto tcp from any port = 137 \
to any flags S keep state group 100
block in quick on eri0 proto udp from any to any port = 137 group 100
block in quick on eri0 proto udp from any port = 137 to any group 100

block in quick on eri0 proto tcp from any port = 138 \
to any flags S keep state group 100
block in quick on eri0 proto udp from any port = 138 to any group 100

block in quick on eri0 proto tcp from any port = 139 to any flags S keep state
group 100
block in quick on eri0 proto udp from any port = 139 to any group 100


Beispiel 26–27 Oracle Solaris IP Filter-Routerkonfiguration

Das folgende Beispiel zeigt eine Konfiguration für einen Router, der über eine interne Schnittstelle ce0 und eine externe Schnittstelle ce1 verfügt.


# internal interface is ce0 at 192.168.1.1
# external interface is ce1 IP obtained via DHCP
# block all packets and allow specific services
*** NAT ***
*** POOLS ***


# Short packets which are fragmented too short to be real.
block in log quick all with short


# By default, block and log everything.
block in log on ce0 all
block in log on ce1 all
block out log on ce0 all
block out log on ce1 all


# Packets going in/out of network interfaces that aren't on the loopback
# interface should not exist.
block in log quick on ce0 from 127.0.0.0/8 to any
block in log quick on ce0 from any to 127.0.0.0/8
block in log quick on ce1 from 127.0.0.0/8 to any
block in log quick on ce1 from any to 127.0.0.0/8


# Deny reserved addresses.
block in quick on ce1 from 10.0.0.0/8 to any
block in quick on ce1 from 172.16.0.0/12 to any
block in log quick on ce1 from 192.168.1.0/24 to any
block in quick on ce1 from 192.168.0.0/16 to any


# Allow internal traffic
pass in quick on ce0 from 192.168.1.0/24 to 192.168.1.0/24
pass out quick on ce0 from 192.168.1.0/24 to 192.168.1.0/24


# Allow outgoing DNS requests from our servers on .1, .2, and .3
pass out quick on ce1 proto tcp/udp from ce1/32 to any port = domain keep state
pass in quick on ce0 proto tcp/udp from 192.168.1.2 to any port = domain keep state
pass in quick on ce0 proto tcp/udp from 192.168.1.3 to any port = domain keep state


# Allow NTP from any internal hosts to any external NTP server.
pass in quick on ce0 proto udp from 192.168.1.0/24 to any port = 123 keep state
pass out quick on ce1 proto udp from any to any port = 123 keep state


# Allow incoming mail
pass in quick on ce1 proto tcp from any to ce1/32 port = smtp keep state
pass in quick on ce1 proto tcp from any to ce1/32 port = smtp keep state
pass out quick on ce1 proto tcp from 192.168.1.0/24 to any port = smtp keep state


# Allow outgoing connections: SSH, WWW, NNTP, mail, whois
pass in quick on ce0 proto tcp from 192.168.1.0/24 to any port = 22 keep state
pass out quick on ce1 proto tcp from 192.168.1.0/24 to any port = 22 keep state

pass in quick on ce0 proto tcp from 192.168.1.0/24 to any port = 80 keep state
pass out quick on ce1 proto tcp from 192.168.1.0/24 to any port = 80 keep state
pass in quick on ce0 proto tcp from 192.168.1.0/24 to any port = 443 keep state
pass out quick on ce1 proto tcp from 192.168.1.0/24 to any port = 443 keep state

pass in quick on ce0 proto tcp from 192.168.1.0/24 to any port = nntp keep state
block in quick on ce1 proto tcp from any to any port = nntp keep state
pass out quick on ce1 proto tcp from 192.168.1.0/24 to any port = nntp keep state

pass in quick on ce0 proto tcp from 192.168.1.0/24 to any port = smtp keep state

pass in quick on ce0 proto tcp from 192.168.1.0/24 to any port = whois keep state
pass out quick on ce1 proto tcp from any to any port = whois keep state


# Allow ssh from offsite
pass in quick on ce1 proto tcp from any to ce1/32 port = 22 keep state


# Allow ping out
pass in quick on ce0 proto icmp all keep state
pass out quick on ce1 proto icmp all keep state


# allow auth out
pass out quick on ce1 proto tcp from ce1/32 to any port = 113 keep state
pass out quick on ce1 proto tcp from ce1/32 port = 113 to any keep state


# return rst for incoming auth
block return-rst in quick on ce1 proto tcp from any to any port = 113 flags S/SA


# log and return reset for any TCP packets with S/SA
block return-rst in log on ce1 proto tcp from any to any flags S/SA


# return ICMP error packets for invalid UDP packets
block return-icmp(net-unr) in proto udp all