Skip to content

Latest commit

 

History

History
55 lines (36 loc) · 1.48 KB

README.md

File metadata and controls

55 lines (36 loc) · 1.48 KB

Ansible Role: macos_pf

Build Status

An Ansible Role to manage the Packet Filter (pf) Firewall of macOS.

Requirements

These target host(s) must meet these requirements:

  1. It should be a Mac, ideally with a recent version of macOS (Snow Leopard won't work).
  2. System Integrity Protection (SIP) must temporarily be disabled. Otherwise the Packet Filter can't be enabled permanently across reboots.
  3. You need to have access as an admin user and become "root" via become: yes - see example playbook below.

Role Variables

Define your firewall rules with macos_pf_rules.

Please use IP addresses instead FQDN's in your firewall rules! Because the Mac might not be able to resolve those hostnames during boot and so the packet filter fails to start.

Dependencies

None.

Example Playbook

---
- name: Manage Packet Filter (pf) Firewall on macOS
  hosts: all
  # You have to become root to deploy the firewall rules!
  become: yes
  roles:
    - role: macos_pf
      macos_pf_rules: |
        # Block access to facebook.com for increased productivity :-)
        block drop out inet proto tcp from any to 157.240.27.35 port 443
        block drop out inet proto tcp from any to 157.240.27.35 port 80

License

This Ansible role is released under the MIT License.