Code Monkey home page Code Monkey logo

ansible-role-configure_firewall's Introduction

Ansible Role : configure_firewall

CI

Installs and configures either ufw or firewalld depending on if the systems is based on Debian or RedHat.

Requirements

None.

Role Variables

defaults/main.yml

ufw

Variable Description
firewall_ufw_rule Add a firewall rule.
(Options: allow, deny, limit, reject), (Default: null).
firewall_ufw_direction The direction for the rule.
(Options: in, incoming, out, outgoing, routed), (Default: null).
firewall_ufw_interface The network interface for rule.
firewall_ufw_from_ip The source IP address.
firewall_ufw_from_port The source port
firewall_ufw_to_ip The destination IP address.
firewall_ufw_to_port The destination port.
firewall_ufw_proto The TCP/IP protocol for the rule.
(Options: any, tcp, udp, ipv6, esp, ah, gre, igmp), (Default: null).
firewall_ufw_comment A comment for the rule.

firewalld

Variable Description
firewall_firewalld_state Should the rule be enabled or disabled.
(Options: absent, disabled, enabled, present).
firewall_firewalld_port The name or number of a port, can also be used to define a port range.
This should be in the format or port/protocol or start_port-end_port/protocol for port ranges.
(Default: null).
firewall_firewalld_zone The firewalld zone to add/remove the rule to/from.

vars/RedHat.yml

Variable Description
__firewall_package: firewalld The name of the firewall package on RedHat based systems.
This value is used to define firewall_package_name in the tasks/main.yml file.
This value can be overridden by setting firewall_package_name in the playbook.

vars/Debian.yml

Variable Description
__firewall_package: ufw The name of the firewall package on Debian based systems.
This value is used to define firewall_package_name in the tasks/main.yml file.
This value can be overridden by setting firewall_package_name in the playbook.

Examples

UFW Firewall

Limits the connections coming in on interfaec enp0s8 from 192.168.60.1 on TCP port 22.

  - firewall_ufw_rule: 'limit'
    firewall_ufw_direction: 'in'
    firewall_ufw_interface: 'enp0s8'
    firewall_ufw_from_ip: '192.168.60.1'
    firewall_ufw_from_port: ''
    firewall_ufw_to_ip: ''
    firewall_ufw_to_port: '22'
    firewall_ufw_proto: 'tcp'
    firewall_ufw_comment: ''
firewalld Firewall

Enable the public zone to accept TCP connections on port 8080.

  - firewall_firewalld_state: 'enabled'
    firewall_firewalld_port: '8080/tcp'
    firewall_firewalld_zone: 'public'

Disables the cockpit service on the public zone.

  - firewall_firewalld_state: 'disabled'
    firewall_firewalld_service: 'cockpit'
    firewall_firewalld_zone: 'public'

Dependencies

None.

Example Playbook

- hosts: servers
  vars_files:
    - vars/main.yml
  roles:
    - glillico.configure_firewall

License

MIT

Author Information

Created in 2020 by Graham Lillico.

ansible-role-configure_firewall's People

Contributors

glillico avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.