Puppet Class: misp::install

Inherits:
misp
Defined in:
manifests/install.pp

Overview



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
56
57
58
59
60
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# File 'manifests/install.pp', line 2

class misp::install inherits misp {

  require '::misp::dependencies'

  # MISP

  vcsrepo { $misp::install_dir:
    ensure     => present,
    provider   => git,
    submodules => true,
    force      => false,
    source     => 'https://github.com/MISP/MISP.git',
    revision   => $misp::misp_git_tag,
  }

  exec {'git ignore permissions':
    command     => '/usr/bin/git config core.filemode false',
    cwd         => $misp::install_dir,
    refreshonly => true,
    subscribe   => Vcsrepo[$misp::install_dir],
    notify      => Vcsrepo["${misp::install_dir}/app/files/scripts/python-cybox","${misp::install_dir}/app/files/scripts/python-stix", "${misp::install_dir}/app/files/scripts/mixbox"],
  }

  vcsrepo { "${misp::install_dir}/app/files/scripts/python-cybox":
    ensure   => present,
    provider => git,
    force    => false,
    source   => $misp::cybox_git_repo,
    revision => $misp::cybox_git_tag,
  }

  vcsrepo { "${misp::install_dir}/app/files/scripts/python-stix":
    ensure   => present,
    provider => git,
    force    => false,
    source   => $misp::stix_git_repo,
    revision => $misp::stix_git_tag,
  }

  vcsrepo { "${misp::install_dir}/app/files/scripts/mixbox":
    ensure   => present,
    provider => git,
    force    => false,
    source   => $misp::mixbox_git_repo,
    revision => $misp::mixbox_git_tag,
  }

  exec {'python-cybox config':
    command     => '/usr/bin/git config core.filemode false && /usr/bin/python setup.py install',
    cwd         => "${misp::install_dir}/app/files/scripts/python-cybox/",
    unless      => '/usr/bin/pip list | grep cybox',
    umask       => '0022',
    refreshonly => true,
    subscribe   => Vcsrepo["${misp::install_dir}/app/files/scripts/python-cybox"],
  }

  exec {'python-stix config':
    command     => '/usr/bin/git config core.filemode false && /usr/bin/python setup.py install',
    cwd         => "${misp::install_dir}/app/files/scripts/python-stix/",
    unless      => '/usr/bin/pip list | grep stix',
    umask       => '0022',
    refreshonly => true,
    subscribe   => Vcsrepo["${misp::install_dir}/app/files/scripts/python-stix"],
  }

  exec {'mixbox config':
    command     => '/usr/bin/git config core.filemode false && /usr/bin/python setup.py install',
    cwd         => "${misp::install_dir}/app/files/scripts/mixbox/",
    unless      => '/usr/bin/pip list | grep mixbox',
    umask       => '0022',
    refreshonly => true,
    subscribe   => Vcsrepo["${misp::install_dir}/app/files/scripts/mixbox"],
  }

  # CakePHP

  exec {'CakeResque curl':
    command     => '/usr/bin/curl -s https://getcomposer.org/installer | php',
    cwd         => "${misp::install_dir}/app/",
    environment => ["COMPOSER_HOME=${misp::install_dir}/app/"],
    refreshonly => true,
    notify      => Exec['CakeResque kamisama'],
    subscribe   => Exec['git ignore permissions'],
  }

  exec {'CakeResque kamisama':
    command     => '/usr/bin/php composer.phar require kamisama/cake-resque:4.1.2',
    cwd         => "${misp::install_dir}/app/",
    environment => ["COMPOSER_HOME=${misp::install_dir}/app/"],
    refreshonly => true,
    notify      => Exec['CakeResque config'],
  }

  exec {'CakeResque config':
    command     => '/usr/bin/php composer.phar config vendor-dir Vendor',
    cwd         => "${misp::install_dir}/app/",
    environment => ["COMPOSER_HOME=${misp::install_dir}/app/"],
    refreshonly => true,
    notify      => Exec['CakeResque install'],
  }

  exec {'CakeResque install':
    command     => '/usr/bin/php composer.phar install',
    cwd         => "${misp::install_dir}/app/",
    environment => ["COMPOSER_HOME=${misp::install_dir}/app/"],
    refreshonly => true,
    notify      => File['/etc/opt/rh/rh-php56/php-fpm.d/redis.ini', '/etc/opt/rh/rh-php56/php-fpm.d/timezone.ini'],
  }

  file {'/etc/opt/rh/rh-php56/php-fpm.d/redis.ini':
    ensure  => file,
    content => 'extension=redis.so',
  }

  file {'/etc/opt/rh/rh-php56/php.d/99-redis.ini':
    ensure    => link,
    target    => '/etc/opt/rh/rh-php56/php-fpm.d/redis.ini',
    subscribe => File['/etc/opt/rh/rh-php56/php-fpm.d/redis.ini'],
  }

  file {'/etc/opt/rh/rh-php56/php-fpm.d/timezone.ini':
    ensure  => file,
    content => "date.timezone = '${misp::timezone}'",
  }

  file {'/etc/opt/rh/rh-php56/php.d/99-timezone.ini':
    ensure    => link,
    target    => '/etc/opt/rh/rh-php56/php-fpm.d/timezone.ini',
    subscribe => File['/etc/opt/rh/rh-php56/php-fpm.d/timezone.ini'],
  }

  #File cration for managing workers

  file { "${misp::install_dir}/app/Console/worker/status.sh":
    ensure    => file,
    source    => "puppet:///modules/${module_name}/status.sh",
    owner     => $misp::default_high_user,
    group     => $misp::default_high_group,
    mode      => '0755',
    subscribe => Vcsrepo[$misp::install_dir],
  }

  # Logrotate

  #file {'/etc/logrotate.d/misp':
  #  ensure => file,
  #  source => "puppet:///modules/${module_name}/misp.logrotate",
  #  owner  => $misp::default_high_user,
  #  group  => $misp::default_high_group,
  #  mode   => '0755',
  #}

  #selinux::module{ 'misplogrotate':
  #  source    => "puppet:///modules/${module_name}/misplogrotate.te",
  #  subscribe => File['/etc/logrotate.d/misp'],
  #}
}