Projet

Général

Profil

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

root / manifests / init.pp @ cd664666

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

1
# manage nftables
2
class nftables (
3
  Boolean $in_ssh    = true,
4
  Boolean $out_ntp   = true,
5
  Boolean $out_dns   = true,
6
  Boolean $out_http  = true,
7
  Boolean $out_https = true,
8
) {
9

    
10
  package{'nftables':
11
    ensure => installed,
12
  } -> file_line{
13
    'enable_nftables':
14
      line   => 'include "/etc/nftables/puppet.nft"',
15
      path   => '/etc/sysconfig/nftables.conf',
16
      notify => Service['nftables'],
17
  } -> file{
18
    default:
19
      owner  => 'root',
20
      group  => 'root',
21
      mode   => '0640';
22
    '/etc/nftables/puppet.nft':
23
      source => 'puppet:///modules/nftables/config/puppet.nft';
24
    '/etc/nftables/puppet':
25
      ensure  => directory,
26
      purge   => true,
27
      force   => true,
28
      recurse => true;
29
  } ~> service{'nftables':
30
    ensure    => running,
31
    enable    => true,
32
  }
33

    
34
  nftables::config{
35
    'filter':
36
      source => 'puppet:///modules/nftables/config/puppet-filter.nft';
37
    'nat':
38
      source => 'puppet:///modules/nftables/config/puppet-nat.nft';
39
  }
40

    
41
  nftables::filter::chain{
42
    [
43
      'forward-default_fwd',
44
      'output-default_out',
45
      'input-default_in',
46
    ]:;
47
  }
48

    
49
  # basic ingoing rules
50
  if $in_ssh {
51
    include nftables::rules::ssh
52
  }
53

    
54
  # basic outgoing rules
55
  if $out_ntp {
56
    include nftables::rules::out::ntp
57
  }
58
  if $out_dns {
59
    include nftables::rules::out::dns
60
  }
61
  if $out_http {
62
    include nftables::rules::out::http
63
  }
64
  if $out_https {
65
    include nftables::rules::out::https
66
  }
67
}