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
# @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
class nftables (
30
  Boolean $in_ssh    = true,
31
  Boolean $out_ntp   = true,
32
  Boolean $out_dns   = true,
33
  Boolean $out_http  = true,
34
  Boolean $out_https = true,
35
  Boolean $out_all   = false,
36
) {
37

    
38
  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
      owner => 'root',
48
      group => 'root',
49
      mode  => '0640';
50
    '/etc/nftables/puppet.nft':
51
      ensure => file,
52
      source => 'puppet:///modules/nftables/config/puppet.nft';
53
    '/etc/nftables/puppet':
54
      ensure  => directory,
55
      mode    => '0750',
56
      purge   => true,
57
      force   => true,
58
      recurse => true;
59
  } ~> service{'nftables':
60
    ensure => running,
61
    enable => true,
62
  }
63

    
64
  service{'firewalld':
65
    ensure => stopped,
66
    enable => mask,
67
  }
68

    
69
  include nftables::inet_filter
70
  include nftables::ip_nat
71
}