Saltstack Official UFW Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Nicolas Rodriguez 6e781345b9 Fix tests 6 years ago
_modules Handle test mode when enabling ufw 6 years ago
_states Adds "Rule inserted" validation 6 years ago
test/integration/ufw Adds ability to limit or deny services and applications. 6 years ago
ufw Allow multiple configurations for the same port 6 years ago
.gitignore Add kitchen tests 6 years ago
.kitchen.yml Fix tests 6 years ago
.travis.yml Also perform tests on bionic/18.04 6 years ago
Gemfile Add kitchen tests 6 years ago
LICENSE Initial commit 10 years ago
README.md Update README and pillar.example with new to_port property 6 years ago
pillar.example Update README and pillar.example with new to_port property 6 years ago

README.md

Ufw Salt Formula

Build Status

This module manages your firewall using ufw with pillar configured rules.

See the full Salt Formulas installation and usage instructions.

Usage

All the configuration for the firewall is done via pillar (pillar.example).

Enable firewall, applying default configuration:

ufw:
  enabled: True

Allow 80/tcp (http) traffic from only two remote addresses:

ufw:
  services:
    http:
      protocol: tcp
      from_addr:
        - 10.0.2.15
        - 10.0.2.16

Allow 443/tcp (https) traffic from network 10.0.0.0/8 to an specific local ip:

ufw:
  services:
    https:
      protocol: tcp
      from_addr:
        - 10.0.0.0/8
      to_addr: 10.0.2.1

Allow from a service port:

ufw:
  services:
    smtp:
      protocol: tcp

Allow from an specific port, by number:

ufw:
  services:
    139:
      protocol: tcp

Allow from a range of ports, udp:

ufw:
  services:
    "10000:20000":
      protocol: udp

Allow from a range of ports, tcp and udp

ufw:
  services:
    "10000:20000/tcp":
      to_port: "10000:20000"
      protocol: tcp
    "10000:20000/udp":
      to_port: "10000:20000"
      protocol: udp

Allow from two specific ports, udp:

ufw:
  services:
    "30000,40000":
      protocol: udp

Allow an application defined at /etc/ufw/applications.d/:

ufw:
  applications:
    - OpenSSH

Run tests

This formula is tested with Kitchen and Inspec in a Docker container.

To run tests you need to

  • install Ruby dependencies : bundle install
  • run Kitchen : kitchen test

Authors

Original state and module based on the work from Yigal Duppen.

Salt formula originally developed by Mario del Pozo.