Projet

Général

Profil

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

root / manifests / init.pp @ e17693e3

Historique | Voir | Annoter | Télécharger (1,51 ko)

1 e17693e3 Steve Traylen
# @summary Configure nftables
2
#
3
# @example
4
#   class{'nftables:
5
#     out_ntp = false,
6
#     out_dns = true,
7
#   }   
8
#
9
# @param out_all 
10
#   Allow all outbound connections. If `true` then all other
11
#   out parameters `out_ntp`, `out_dns`, ... will be assuemed
12
#   false.
13
#
14
# @param out_ntp
15
#   Allow outbound to ntp servers.
16
#
17
# @param out_http
18
#   Allow outbound to http servers.
19
#
20
# @param out_https
21
#   Allow outbound to https servers.
22
#
23
# @param out_https
24
#   Allow outbound to https servers.
25
#
26
# @param in_ssh
27
#   Allow inbound to ssh servers.
28
#
29 be0b08e1 tr
class nftables (
30
  Boolean $in_ssh    = true,
31
  Boolean $out_ntp   = true,
32
  Boolean $out_dns   = true,
33 cd664666 tr
  Boolean $out_http  = true,
34 be0b08e1 tr
  Boolean $out_https = true,
35 e17693e3 Steve Traylen
  Boolean $out_all   = false,
36 be0b08e1 tr
) {
37
38 0ba57c66 mh
  package{'nftables':
39
    ensure => installed,
40
  } -> file_line{
41
    'enable_nftables':
42
      line   => 'include "/etc/nftables/puppet.nft"',
43
      path   => '/etc/sysconfig/nftables.conf',
44
      notify => Service['nftables'],
45
  } -> file{
46
    default:
47 e140adff tr
      owner => 'root',
48
      group => 'root',
49
      mode  => '0640';
50 0ba57c66 mh
    '/etc/nftables/puppet.nft':
51 5acb554a tr
      ensure => file,
52 0ba57c66 mh
      source => 'puppet:///modules/nftables/config/puppet.nft';
53
    '/etc/nftables/puppet':
54
      ensure  => directory,
55 5acb554a tr
      mode    => '0750',
56 0ba57c66 mh
      purge   => true,
57
      force   => true,
58
      recurse => true;
59
  } ~> service{'nftables':
60 e140adff tr
    ensure => running,
61
    enable => true,
62 0ba57c66 mh
  }
63
64 f02562f2 tr
  service{'firewalld':
65
    ensure => stopped,
66
    enable => mask,
67
  }
68
69 c8092701 tr
  include nftables::inet_filter
70
  include nftables::ip_nat
71 0ba57c66 mh
}