Puppet Class: ufw::config

Defined in:
manifests/config.pp

Summary

Manages ufw related configuration files

Overview

Manages ufw related configuration files.

Examples:

class {'ufw::config':
  log_level                => 'low',
  manage_default_config    => true,
  default_config_content   => file('ufw/default'),
  manage_logrotate_config  => true,
  logrotate_config_content => file('ufw/logrotate'),
  manage_rsyslog_config    => true,
  rsyslog_config_content   => file('ufw/rsyslog'),
  manage_sysctl_config     => true,
  sysctl_config_content    => file('ufw/sysctl'),
  manage_before_rules      => true,
  before_rules_content     => file('ufw/before.rules'),
  manage_before6_rules     => true,
  before6_rules_content    => file('ufw/before6.rules'),
  manage_after_rules       => true,
  after_rules_content      => file('ufw/after.rules'),
  manage_after6_rules      => true,
  after6_rules_content     => file('ufw/after.rules'),
}

Parameters:

  • log_level (Ufw::LogLevel) (defaults to: $ufw::log_level)

    Logging level. Default: ‘low’

  • manage_default_config (Boolean) (defaults to: $ufw::manage_default_config)

    Controls if the module should manage /etc/default/ufw.

  • default_config_content (String[1]) (defaults to: $ufw::default_config_content)

    Configuration content to put to /etc/default/ufw.

  • manage_logrotate_config (Boolean) (defaults to: $ufw::manage_logrotate_config)

    Controls if the module should manage /etc/logrotate.d/ufw.

  • logrotate_config_content (String[1]) (defaults to: $ufw::logrotate_config_content)

    Configuration content to put to /etc/logrotate.d/ufw.

  • manage_rsyslog_config (Boolean) (defaults to: $ufw::manage_rsyslog_config)

    Controls if the module should manage /etc/rsyslog.d/20-ufw.conf.

  • rsyslog_config_content (String[1]) (defaults to: $ufw::rsyslog_config_content)

    Configuration content to put to /etc/rsyslog.d/20-ufw.conf.

  • manage_sysctl_config (Boolean) (defaults to: $ufw::manage_sysctl_config)

    Controls if the module should manage /etc/ufw/sysctl.conf.

  • sysctl_config_content (String[1]) (defaults to: $ufw::sysctl_config_content)

    Configuration content to put to /etc/ufw/sysctl.conf.

  • manage_before_rules (Boolean) (defaults to: $ufw::manage_before_rules)

    Controls if the module should manage /etc/ufw/before.rules.

  • before_rules_content (String[1]) (defaults to: $ufw::before_rules_content)

    Configuration content to put to /etc/ufw/before.rules.

  • manage_before6_rules (Boolean) (defaults to: $ufw::manage_before6_rules)

    Controls if the module should manage /etc/ufw/before6.rules.

  • before6_rules_content (String[1]) (defaults to: $ufw::before6_rules_content)

    Configuration content to put to /etc/ufw/before6.rules.

  • manage_after_rules (Boolean) (defaults to: $ufw::manage_after_rules)

    Controls if the module should manage /etc/ufw/after.rules.

  • after_rules_content (String[1]) (defaults to: $ufw::after_rules_content)

    Configuration content to put to /etc/ufw/after.rules.

  • manage_after6_rules (Boolean) (defaults to: $ufw::manage_after6_rules)

    Controls if the module should manage /etc/ufw/after6.rules.

  • after6_rules_content (String[1]) (defaults to: $ufw::after6_rules_content)

    Configuration content to put to /etc/ufw/after6.rules.



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'manifests/config.pp', line 61

class ufw::config(
  Ufw::LogLevel         $log_level                        = $ufw::log_level,
  Boolean               $manage_default_config            = $ufw::manage_default_config,
  String[1]             $default_config_content           = $ufw::default_config_content,
  Boolean               $manage_logrotate_config          = $ufw::manage_logrotate_config,
  String[1]             $logrotate_config_content         = $ufw::logrotate_config_content,
  Boolean               $manage_rsyslog_config            = $ufw::manage_rsyslog_config,
  String[1]             $rsyslog_config_content           = $ufw::rsyslog_config_content,
  Boolean               $manage_sysctl_config             = $ufw::manage_sysctl_config,
  String[1]             $sysctl_config_content            = $ufw::sysctl_config_content,
  Boolean               $manage_before_rules              = $ufw::manage_before_rules,
  String[1]             $before_rules_content             = $ufw::before_rules_content,
  Boolean               $manage_before6_rules             = $ufw::manage_before6_rules,
  String[1]             $before6_rules_content            = $ufw::before6_rules_content,
  Boolean               $manage_after_rules               = $ufw::manage_after_rules,
  String[1]             $after_rules_content              = $ufw::after_rules_content,
  Boolean               $manage_after6_rules              = $ufw::manage_after6_rules,
  String[1]             $after6_rules_content             = $ufw::after6_rules_content,
) {
  if $manage_default_config {
    file {'/etc/default/ufw':
      path    => '/etc/default/ufw',
      content => $default_config_content,
    }
  }

  if $manage_logrotate_config {
    file {'/etc/logrotate.d/ufw':
      path    => '/etc/logrotate.d/ufw',
      content => $logrotate_config_content,
    }
  }

  if $manage_rsyslog_config {
    file {'/etc/rsyslog.d/20-ufw.conf':
      path    => '/etc/rsyslog.d/20-ufw.conf',
      content => $rsyslog_config_content,
    }
  }

  if $manage_sysctl_config {
    file {'/etc/ufw/sysctl.conf':
      path    => '/etc/ufw/sysctl.conf',
      content => $sysctl_config_content,
    }
  }

  if $manage_before_rules {
    file {'/etc/ufw/before.rules':
      path    => '/etc/ufw/before.rules',
      content => $before_rules_content,
    }
  }

  if $manage_before6_rules {
    file {'/etc/ufw/before6.rules':
      path    => '/etc/ufw/before6.rules',
      content => $before6_rules_content,
    }
  }

  if $manage_after_rules {
    file {'/etc/ufw/after.rules':
      path    => '/etc/ufw/after.rules',
      content => $after_rules_content,
    }
  }

  if $manage_after6_rules {
    file {'/etc/ufw/after6.rules':
      path    => '/etc/ufw/after6.rules',
      content => $after6_rules_content,
    }
  }

  file_line { 'loglevel':
    ensure => present,
    path   => '/etc/ufw/ufw.conf',
    line   => "LOGLEVEL=${log_level}",
    match  => '^LOGLEVEL\=',
  }
}