Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root @ 67cdcf15

Nom Taille Révision Âge Auteur Commentaire
  .github b0b538e0 presque 2 ans Tim Meusel modulesync 7.0.0
  .vscode ece9be27 plus de 4 ans tr Do PDK convert
  data 0b7bcb5d plus de 2 ans mh Align filemode on RedHat to distro default The...
  files baad986e plus d'un an Vadym Chepkov add ftp helper This adds ability to enable a c...
  lib c82b960a plus de 3 ans Steve Traylen rubocop:auto_correct results
  manifests 67cdcf15 plus d'un an Steve Traylen Support input interface specification to dns se...
  spec 67cdcf15 plus d'un an Steve Traylen Support input interface specification to dns se...
  templates 861169e5 presque 2 ans Javier Angulo fix #184: Add unit string for timeout,gc-interval
  types 664d2bb0 presque 2 ans Tim Skirvin nftables::simplerule::dport - takes port ranges...
.editorconfig 289 octets 5fea281f plus de 3 ans Tim Stallmann modulesync 4.2.0
.fixtures.yml 377 octets 1a986e22 presque 4 ans Tim Meusel pull fixtures from git and not forge
.gitattributes 62 octets 321ae8ab plus de 4 ans tr Add Puppet module basic files
.gitignore 353 octets dcc15b02 environ 2 ans Massimiliano Adamo modulesync 5.5.0
.msync.yml 147 octets b0b538e0 presque 2 ans Tim Meusel modulesync 7.0.0
.overcommit.yml 1,35 ko 5fea281f plus de 3 ans Tim Stallmann modulesync 4.2.0
.pmtignore 491 octets dcc15b02 environ 2 ans Massimiliano Adamo modulesync 5.5.0
.puppet-lint.rc 19 octets 117519ce environ 3 ans Tim Meusel Enable parameter_documentation/parameter_types ...
.rspec 139 octets 5fea281f plus de 3 ans Tim Stallmann modulesync 4.2.0
.rspec_parallel 126 octets 5fea281f plus de 3 ans Tim Stallmann modulesync 4.2.0
.rubocop.yml 155 octets 5fea281f plus de 3 ans Tim Stallmann modulesync 4.2.0
.sync.yml 188 octets 435a5db2 environ 3 ans Steve Traylen rspec mock systemd process on docker On docker...
CHANGELOG.md 25,4 ko 54b5cf0b plus d'un an Tim Meusel Release 3.4.0
Dockerfile 576 octets 0893064d environ 3 ans Tim Meusel modulesync 5.2.0
Gemfile 1,07 ko b0b538e0 presque 2 ans Tim Meusel modulesync 7.0.0
LICENSE 11,1 ko 44ac0a4e plus de 4 ans mh add license file
README.md 5,31 ko 647b2d5c plus de 2 ans Antoine Beaupré fix nft sample command I don't know what the n...
REFERENCE.md 60,8 ko 67cdcf15 plus d'un an Steve Traylen Support input interface specification to dns se...
Rakefile 1,12 ko dcc15b02 environ 2 ans Massimiliano Adamo modulesync 5.5.0
hiera.yaml 685 octets ece9be27 plus de 4 ans tr Do PDK convert
metadata.json 1,72 ko 3413220c plus d'un an Tim Meusel [blacksmith] Bump version to 3.4.1-rc0

Dernières révisions

# Date Auteur Commentaire
67cdcf15 2023-11-24 02:52 Steve Traylen

Support input interface specification to dns server

Useful when you want to allow docker/podman containers
access to a hosts dns stub resolver.

```puppet
class{'nftables::rules::dns':
iifname => ['docker0'],
}
```

b5633532 2023-11-23 02:46 Tim Meusel

Merge pull request #189 from tskirvin/master

nftables::simplerule::dport - takes port ranges as part of the array

a7cb6803 2023-11-23 02:38 Steve Traylen

Merge pull request #214 from traylenator/podman

Additional rules for podman root containers

1085e990 2023-11-22 05:50 Steve Traylen

Merge pull request #183 from traylenator/redirect

Example how to redirect one port to another

94285e5f 2023-11-22 04:40 Steve Traylen

Example how to redirect one port to another

Add example how to redirect traffic from one port to another.

08b9f1d0 2023-11-22 03:53 Steve Traylen

Additional rules for podman root containers

This class defines additional forwarding rules to let root containers
reach external networks when using Netavark (since v4.0) or CNI (deprecated).
At the time of writing, Podman supports automatic configuration...

3413220c 2023-11-17 13:07 Tim Meusel

[blacksmith] Bump version to 3.4.1-rc0

b5b49a36 2023-11-17 13:07 Tim Meusel

Merge pull request #212 from bastelfreak/rel340

Release 3.4.0

54b5cf0b 2023-11-17 12:47 Tim Meusel

Release 3.4.0

ab464b23 2023-11-17 12:45 Tim Meusel

Merge pull request #213 from vchepkov/systemd

allow puppet/systemd v6

Voir toutes les révisions | Voir les révisions

README


nftables puppet module

Puppet Forge Puppet Forge - downloads puppetmodule.info docs Apache-2.0 License

This module manages an opinionated nftables configuration.

By default it sets up a firewall that drops every connection, except outbound ICMP, DNS, NTP, HTTP, and HTTPS, and inbound ICMP and SSH traffic:

include nftables

This can be overridden using parameters, for example, this allows all outbound traffic:

class { 'nftables':
    out_all => true,
}

There are also pre-built rules for specific services, for example this will allow a web server to serve traffic over HTTPS:

include nftables
include nftables::rules::https

Note that the module conflicts with the firewalld system and will stop it in Puppet runs.

Configuration

The main configuration file loaded by the nftables service will be files/config/puppet.nft, all other files created by that module go into files/config/puppet and will also be purged if not managed anymore.

The main configuration file includes dedicated files for the filter and NAT tables, as well as processes any custom-*.nft files before hand.

The filter and NAT tables both have all the master chains (INPUT, OUTPUT, FORWARD in case of filter and PREROUTING and POSTROUTING in case of NAT) configured, to which you can hook in your own chains that can contain specific rules.

All filter masterchains drop by default. By default we have a set of default_MASTERCHAIN chains configured to which you can easily add your custom rules.

For specific needs you can add your own chain.

There is a global chain, that defines the default behavior for all masterchains. This chain is empty by default.

INPUT and OUTPUT to the loopback device is allowed by default, though you could restrict it later.

On the other hand, if you don't want any of the default tables, chains and rules created by the module, you can set nftables::inet_filter and/or nftables::nat to false and build your whole nftables configuration from scratch by using the building blocks provided by this module. Look at nftables::inet_filter for inspiration.

Rules Validation

Initially puppet deploys all configuration to /etc/nftables/puppet-preflight/ and /etc/nftables/puppet-preflight.nft. This is validated with nft -c -I /etc/nftables/puppet-preflight/ -f /etc/nftables/puppet-preflight.nft. If and only if successful the configuration will be copied to the real locations before the service is reloaded.

Basic types

nftables::config

Manages a raw file in /etc/nftables/puppet/${name}.nft

Use this for any custom table files.

nftables::chain

Prepares a chain file as a concat file to which you will be able to add dedicated rules through nftables::rule.

The name must be unique for all chains. The inject parameter can be used to directly add a jump to a masterchain. inject must follow the pattern ORDER-MASTERCHAIN, where order references a 2-digit number which defines the rule order (by default use e.g. 20) and masterchain references the chain to hook in the new chain. It's possible to specify the in-interface name and out-interface name for the inject rule.

nftables::rule

A simple way to add rules to any chain. The name must be: CHAIN_NAME-rulename, where CHAINNAME refers to your chain and an arbitrary name for your rule. The rule will be a concat::fragment to the chain `CHAINNAME`.

You can define the order by using the order param.

Before defining your own rule, take a look to the list of ready-to-use rules available in the REFERENCE, somebody might have encapsulated a rule definition for you already.

nftables::set

Adds a named set to a given table. It allows composing the set using individual parameters but also takes raw input via the content and source parameters.

nftables::simplerule

Allows expressing firewall rules without having to use nftables's language by adding an abstraction layer a-la-Firewall. It's rather limited how far you can go so if you need rather complex rules or you can speak nftables it's recommended to use nftables::rule directly.

Facts

One structured fact nftables is available

{ tables => [ "bridge-filter", "bridge-nat", "inet-firewalld", "ip-firewalld", "ip6-firewalld" ], version => "0.9.3" }

  • nftables.version is the version of the nft command from nft --version.
  • nftables.tables is the list of tables installed on the machine from nft list tables.

Editor goodies

If you're using Emacs there are some snippets for Yasnippet available here that could make your life easier when using the module. This is third party configuration that's only included here for reference so changes in the interfaces exposed by this module are not guaranteed to be automatically applied there.

Formats disponibles : Atom