Puppet Class: nessus::config

Inherits:
nessus
Defined in:
manifests/config.pp

Overview



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'manifests/config.pp', line 1

class nessus::config inherits nessus {

  if $caller_module_name != $module_name {
    fail("Use of private class ${name} by ${caller_module_name}")
  }

  if $security_center {
    if $activation_code {
      fail('security_center and activation_code are mutually exclusive.')
    }

    #default for versions without nessuscli
    if $::nessus_cli {
      $activate_command = 'nessuscli fetch --security-center'
    } else {
      $activate_command = 'nessus-fetch --security-center'
    }

    exec { 'Activate Nessus':
      path    => [ '/bin', '/opt/nessus/bin', '/opt/nessus/sbin' ],
      command => "${activate_command} && touch /opt/nessus/var/nessus/security_center_activated",
      creates => '/opt/nessus/var/nessus/security_center_activated',
      notify  => Exec['Wait 60 seconds for Nessus activation'],
    }
  } else {
    if ! $::nessus_activation_code {
      # This nessus is not yet activated, let's do it!
      if $activation_code {
        #default for versions without nessuscli
        if $::nessus_cli {
          $activate_command = "nessuscli fetch --register ${activation_code}"
        } else {
          $activate_command = "nessus-fetch --register ${activation_code}"
        }

        exec { 'Activate Nessus':
          path    => [ '/opt/nessus/bin', '/opt/nessus/sbin' ],
          command => $activate_command,
          notify  => Exec['Wait 60 seconds for Nessus activation'],
        }
      }
    }
  }

  # Wait, then restart nessusd after activation
  exec { 'Wait 60 seconds for Nessus activation':
    path        => [ '/bin' ],
    command     => 'sleep 60',
    refreshonly => true,
    notify      => Service[$service_name],
  }

  #TODO:
  # More config items will be added in the next version of this module
}