2024-11-13 16:25:14 +01:00
|
|
|
class soc::intelmq(
|
|
|
|
) {
|
|
|
|
|
|
|
|
group { 'intelmq':
|
|
|
|
ensure => present,
|
|
|
|
}
|
|
|
|
|
|
|
|
user { 'intelmq':
|
2024-11-13 16:49:11 +01:00
|
|
|
ensure => present,
|
|
|
|
gid => 'intelmq',
|
|
|
|
groups => 'www-data',
|
|
|
|
home => '/opt/intelmq',
|
|
|
|
managehome => true,
|
2024-11-14 10:24:57 +01:00
|
|
|
shell => '/bin/bash',
|
2024-11-13 16:25:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
file { '/etc/intelmq':
|
|
|
|
ensure => directory,
|
|
|
|
owner => 'intelmq',
|
|
|
|
group => 'intelmq',
|
|
|
|
}
|
|
|
|
|
|
|
|
# file { '/opt/sso/apache/groups.txt':
|
|
|
|
# ensure => file,
|
|
|
|
# content => template('soc/sso/apache-groups.txt.erb')
|
|
|
|
# }
|
|
|
|
|
2024-11-14 12:20:05 +01:00
|
|
|
ensure_packages(['apache2'])
|
2024-11-14 12:16:26 +01:00
|
|
|
package { ['apache2', 'libapache2-mod-wsgi-py3', 'postgresql', 'python3-venv', 'python3-pip', 'python3-gpg', 'python3-psycopg2', 'redict', ]:
|
2024-11-13 16:25:14 +01:00
|
|
|
ensure => 'latest',
|
|
|
|
}
|
|
|
|
|
2024-11-14 12:16:26 +01:00
|
|
|
exec { 'Install IntelMQ venv':
|
|
|
|
command => 'sudo -u intelmq /usr/bin/python3 -m venv --system-site-packages /opt/intelmq/venv',
|
|
|
|
creates => '/opt/intelmq/venv',
|
2024-11-13 16:25:14 +01:00
|
|
|
}
|
|
|
|
|
2024-11-14 10:24:57 +01:00
|
|
|
file { '/opt/intelmq/install-intelmq.sh':
|
|
|
|
ensure => file,
|
|
|
|
content => file('soc/intelmq/install-intelmq.sh'),
|
2024-11-14 10:27:12 +01:00
|
|
|
mode => '0555',
|
2024-11-14 10:24:57 +01:00
|
|
|
}
|
|
|
|
|
2024-11-14 12:16:26 +01:00
|
|
|
exec { 'Install IntelMQ':
|
|
|
|
command => 'sudo -u intelmq /opt/intelmq/install-intelmq.sh',
|
|
|
|
creates => '/opt/intelmq/.installed'
|
2024-11-13 16:25:14 +01:00
|
|
|
}
|
2024-11-14 10:51:10 +01:00
|
|
|
|
2024-11-14 12:16:26 +01:00
|
|
|
exec { 'Run IntelMQ setup script':
|
|
|
|
command => '/opt/intelmq/venv/bin/intelmqsetup --state-file /opt/intelmq/.setup_state',
|
2024-11-14 10:58:37 +01:00
|
|
|
creates => '/opt/intelmq/.setup_state',
|
|
|
|
returns => ['0', '1',],
|
2024-11-14 10:51:10 +01:00
|
|
|
}
|
|
|
|
|
2024-11-14 10:52:32 +01:00
|
|
|
file { '/etc/sudoers.d/01_intelmq-api':
|
2024-11-14 10:51:10 +01:00
|
|
|
ensure => file,
|
|
|
|
content => file('soc/intelmq/sudoers-01-intelmq-api'),
|
|
|
|
mode => '0440',
|
|
|
|
}
|
|
|
|
|
2024-11-14 12:16:26 +01:00
|
|
|
service { 'apache2':
|
|
|
|
ensure => 'running',
|
|
|
|
enable => true,
|
|
|
|
require => Package['apache2'],
|
|
|
|
}
|
|
|
|
|
|
|
|
exec { 'Enable Apache2 modules':
|
2024-11-14 12:17:22 +01:00
|
|
|
command => 'a2enmod ssl wsgi proxy proxy_http header rewrite',
|
2024-11-14 12:18:00 +01:00
|
|
|
creates => ['/etc/apache2/mods-enabled/ssl.load', '/etc/apache2/mods-enabled/wsgi.load', '/etc/apache2/mods-enabled/proxy.load', '/etc/apache2/mods-enabled/proxy_http.load', '/etc/apache2/mods-enabled/header.load', '/etc/apache2/mods-enabled/rewrite.load'],
|
2024-11-14 12:16:26 +01:00
|
|
|
notify => Service['apache2'],
|
|
|
|
}
|
2024-11-13 16:25:14 +01:00
|
|
|
}
|