Skip to content

Network firewall rules made easy!

Notifications You must be signed in to change notification settings

opus-codium/puffy

Repository files navigation

Puffy

Build Status Maintainability Test Coverage Inline docs

Features

  • Generate rules for iptables and PF (extensible);
  • IPv6 and IPv4 support;
  • Define the configuration of multiple nodes in a single file;
  • Define services as group of rules to mix-in in nodes rules definitions;
  • Handle NAT & port redirection;

Requirements

  • Accurate DNS information;

Syntax

The Puffy syntax is inspired by the syntax of the OpenBSD Packet Filter, with the ability to group rules in reusable blocks in order to describe all rules of a network of nodes in a single file.

Rules must appear in either a node or service definition, services being reusable blocks of related rules:

service ntp do
  pass proto udp to port ntp
end

service postgresql do
  pass proto tcp to port postgresql
end

service ssh do
  pass proto tcp to port ssh
end

service www do
  pass proto tcp to port {http https}
end

service base do
  client ntp
  server ssh
end

node 'db.example.com' do
  service base
  server postgresql from 'www1.example.com'
end

node /www\d+.example.com/ do
  service base
  server www
  client postgresql to 'db.example.com'
  pass in proto tcp from any to port 8000
end