{"id":19518421,"url":"https://github.com/projectpotos/ansible-role-potos_firewall","last_synced_at":"2026-02-05T21:31:44.283Z","repository":{"id":136185111,"uuid":"588090818","full_name":"projectpotos/ansible-role-potos_firewall","owner":"projectpotos","description":null,"archived":false,"fork":false,"pushed_at":"2024-08-19T15:15:40.000Z","size":179,"stargazers_count":0,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-08T12:50:56.075Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/projectpotos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-12T09:56:39.000Z","updated_at":"2024-05-16T07:37:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"f4e0bc9b-71db-4349-b071-bb18927b3373","html_url":"https://github.com/projectpotos/ansible-role-potos_firewall","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":"projectpotos/ansible-role-potos_template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectpotos%2Fansible-role-potos_firewall","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectpotos%2Fansible-role-potos_firewall/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectpotos%2Fansible-role-potos_firewall/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectpotos%2Fansible-role-potos_firewall/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/projectpotos","download_url":"https://codeload.github.com/projectpotos/ansible-role-potos_firewall/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240766606,"owners_count":19854119,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T00:11:31.010Z","updated_at":"2026-02-05T21:31:44.228Z","avatar_url":"https://github.com/projectpotos.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Ansible Role - potos\\_firewall \n\nRole to configure firewall rules of Potos Linux Clients.\n\n[![Test](https://github.com/projectpotos/ansible-role-potos_firewall/actions/workflows/test.yml/badge.svg)](https://github.com/projectpotos/ansible-role-potos_firewall/actions/workflows/test.yml)\n\n## Example Playbook\n\nAs this role is tested via Molecule, one can use [that\nplaybook](./molecule/default/converge.yml) as a starting point:\n\n```yaml\n---\n\n- name: Converge\n  hosts: all\n  gather_facts: yes\n  vars:\n    potos_firewall_package_state: 'latest'\n    potos_firewall_rules:\n      - rule: allow\n        from_ip: 123.123.123.123\n        to_port: 124\n        protocol: tcp\n        comment: \"allow access to port 124\"\n  tasks:\n    - name: run role\n      ansible.builtin.include_role:\n        name: 'ansible-role-potos_firewall'\n\n```\n\n## Role Variables\n\nThe default variables are defined in [defaults/main.yml](./defaults/main.yml).\n\n\n```yaml\n---\n# to define if ufw or firewalld should be used\npotos_firewall_force_type: 'none'\n\n# to disable ufw\npotos_firewall_disable_ufw: 'false'\n\n# to define default Firewall policies\npotos_firewall_incoming_default_policy: 'reject'\npotos_firewall_outgoing_default_policy: 'allow'\n\n# to define loglevel\npotos_firewall_loglevel: 'on'\n\n# to define to define state of the firewall package\npotos_firewall_package_state: 'present'\n\n# to define firewall rules as a list\npotos_firewall_rules: []\n# Each rule can be defined with the following:\n  # define action of the rule \"allow, deny, reject, limit\"\n  rule:\n  # define an interface for the rule\n  interface:\n  # define the direction of the rule \"in, out, routed\"\n  direction: in\n  # define source IP address\n  from_ip:\n  # define destination IP address\n  to_ip: \n  # define source port\n  from_port:\n  # define destination port\n  to_port:\n  # define protocol \"any, tcp, udp, ipv6, esp, ah\"\n  protocol: any\n  # apply the rule to routed/forwarded packets\n  route: false\n  # log new connections matched to this rule\n  log: false\n  # add a comment to the rule\n  comment: \"{{ item.comment | default(omit) }}\"\n  # delete the rule\n  delete: \"{{ item.delete | default(omit) }}\"\n```\n\nFor example:\n```yaml\npotos_firewall_rules:\n  - rule: allow\n    from_ip: 123.123.123.123\n    to_port: 124\n    protocol: tcp\n    comment: \"allow access to port 124\"\n  - rule: allow\n    to_ip: 8.8.8.8\n    direction: out\n    to_port: 53\n```\nCreates the following ufw configuration:\n```\n# ufw status\nStatus: active\n\nTo                         Action      From\n--                         ------      ----\n124/tcp                    ALLOW       123.123.123.123            # allow access to port 124\n\n8.8.8.8 53                 ALLOW OUT   Anywhere \n```\nIf a rule should be changed or removed, `delete: true` has to be added, to delete the rule. After that, `delete: true` can be removed and the rule changed or removed entirely. If changed, it will then be added to the ufw configuration as a new rule.\n```yaml\npotos_firewall_rules:\n  - rule: allow\n    to_ip: 8.8.8.8\n    direction: out\n    to_port: 53\n    delete: yes\n```\n\n\n## Requirements\n```\nansible-galaxy collection install community.general\n```\n\n## License\n\nSee [LICENSE](./LICENSE)\n\n## Author Information\n\n[Project Potos](https://github.com/projectpotos)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprojectpotos%2Fansible-role-potos_firewall","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprojectpotos%2Fansible-role-potos_firewall","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprojectpotos%2Fansible-role-potos_firewall/lists"}