fabtools.shorewall

Shorewall firewall

Firewall status

fabtools.shorewall.status()[source]

Get the firewall status.

fabtools.shorewall.is_started()[source]

Check if the firewall is started.

fabtools.shorewall.is_stopped()[source]

Check if the firewall is stopped.

Firewall rules

fabtools.shorewall.rule(port, action='ACCEPT', source='net', dest='$FW', proto='tcp')[source]

Helper to build a firewall rule.

Examples:

from fabtools.shorewall import rule

# Rule to accept connections from example.com on port 1234
r1 = rule(port=1234, source=hosts(['example.com']))

# Rule to reject outgoing SMTP connections
r2 = rule(port=25, action='REJECT', source='$FW', dest='net')
fabtools.shorewall.hosts(hostnames, zone='net')[source]

Builds a host list suitable for use in a firewall rule.

fabtools.shorewall.Ping(**kwargs)[source]

Helper to build a firewall rule for ICMP pings.

Extra args will be passed to rule().

fabtools.shorewall.SSH(port=22, **kwargs)[source]

Helper to build a firewall rule for SSH connections

Extra args will be passed to rule().

fabtools.shorewall.HTTP(port=80, **kwargs)[source]

Helper to build a firewall rule for HTTP connections

Extra args will be passed to rule().

fabtools.shorewall.HTTPS(port=443, **kwargs)[source]

Helper to build a firewall rule for HTTPS connections

Extra args will be passed to rule().

fabtools.shorewall.SMTP(port=25, **kwargs)[source]

Helper to build a firewall rule for SMTP connections

Extra args will be passed to rule().