Skip to content

Commit

Permalink
Merge pull request #689 from wazuh/511-support-agents-on-suse
Browse files Browse the repository at this point in the history
Support agents on suse
  • Loading branch information
teddytpc1 committed Jul 20, 2023
2 parents 83d4016 + 78bc2ca commit d7baee1
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 13 deletions.
3 changes: 3 additions & 0 deletions kitchen/Puppetfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ mod "wazuh/wazuh"

# A module from Github pre-packaged tarball
# mod 'puppetlabs-apache', '0.6.0', :github_tarball => 'puppetlabs/puppetlabs-apache'

# A module for configure zypper repo
# mod 'puppet-zypprepo', '4.0.1'
4 changes: 3 additions & 1 deletion manifests/agent.pp
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@
'Linux': {
## ossec.conf generation concats
case $::operatingsystem {
'RedHat', 'OracleLinux':{
'RedHat', 'OracleLinux', 'Suse':{
$apply_template_os = 'rhel'
if ( $::operatingsystemrelease =~ /^9.*/ ){
$rhel_version = '9'
Expand All @@ -342,6 +342,8 @@
$apply_template_os = 'amazon'
}'CentOS','Centos','centos','AlmaLinux':{
$apply_template_os = 'centos'
}'SLES':{
$apply_template_os = 'suse'
}
default: { fail('OS not supported') }
}
Expand Down
19 changes: 19 additions & 0 deletions manifests/params_agent.pp
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,25 @@
default: { fail('This ossec module has not been tested on your distribution') }
}
}
'Suse': {
$service_has_status = true

$default_local_files = [
{ 'location' => '/var/log/audit/audit.log', 'log_format' => 'audit' },
{ 'location' => '/var/ossec/logs/active-responses.log', 'log_format' => 'syslog' },
{ 'location' => '/var/log/messages', 'log_format' => 'syslog' },
{ 'location' => '/var/log/secure', 'log_format' => 'syslog' },
{ 'location' => '/var/log/maillog', 'log_format' => 'syslog' },
]
case $::operatingsystem {
'SLES': {
if ( $::operatingsystemrelease =~ /^(12|15).*/ ) {
$ossec_service_provider = 'redhat'
}
}
default: { fail('This ossec module has not been tested on your distribution') }
}
}
default: { fail('This ossec module has not been tested on your distribution') }
}
}
Expand Down
25 changes: 25 additions & 0 deletions manifests/params_manager.pp
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,31 @@
default: { fail('This ossec module has not been tested on your distribution') }
}
}
'Suse': {

$agent_service = 'wazuh-agent'
$agent_package = 'wazuh-agent'
$server_service = 'wazuh-manager'
$server_package = 'wazuh-manager'
$service_has_status = true

$default_local_files =[
{ 'location' => '/var/log/audit/audit.log' , 'log_format' => 'audit'},
{ 'location' => '/var/ossec/logs/active-responses.log' , 'log_format' => 'syslog'},
{ 'location' => '/var/log/messages', 'log_format' => 'syslog'},
{ 'location' => '/var/log/secure' , 'log_format' => 'syslog'},
{ 'location' => '/var/log/maillog' , 'log_format' => 'syslog'},
]
case $::operatingsystem {
'SLES': {
if ( $::operatingsystemrelease =~ /^(12|15).*/ ) {
$ossec_service_provider = 'redhat'
$api_service_provider = 'redhat'
}
}
default: { fail('This ossec module has not been tested on your distribution') }
}
}
default: { fail('This ossec module has not been tested on your distribution') }
}
}
Expand Down
38 changes: 26 additions & 12 deletions manifests/repo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
default: { fail('This ossec module has not been tested on your distribution (or lsb package not installed)') }
}
}
'Linux', 'RedHat' : {
'Linux', 'RedHat', 'Suse' : {
case $::os[name] {
/^(CentOS|RedHat|OracleLinux|Fedora|Amazon|AlmaLinux)$/: {
/^(CentOS|RedHat|OracleLinux|Fedora|Amazon|AlmaLinux|SLES)$/: {
if ( $::operatingsystemrelease =~ /^5.*/ ) {
$baseurl = 'https://packages.wazuh.com/4.x/yum/5/'
$gpgkey = 'http://packages.wazuh.com/key/GPG-KEY-WAZUH'
Expand All @@ -46,16 +46,30 @@
}
default: { fail('This ossec module has not been tested on your distribution.') }
}
# Set up OSSEC repo
yumrepo { 'wazuh':
descr => 'WAZUH OSSEC Repository - www.wazuh.com',
enabled => true,
gpgcheck => 1,
gpgkey => $gpgkey,
baseurl => $baseurl
}

# Set up OSSEC repo
case $::os[name] {
/^(CentOS|RedHat|OracleLinux|Fedora|Amazon|AlmaLinux)$/: {
yumrepo { 'wazuh':
descr => 'WAZUH OSSEC Repository - www.wazuh.com',
enabled => true,
gpgcheck => 1,
gpgkey => $gpgkey,
baseurl => $baseurl
}
}
/^(SLES)$/: {
zypprepo { 'wazuh':
ensure => present,
name => 'WAZUH OSSEC Repository - www.wazuh.com',
enabled => 1,
gpgcheck => 0,
repo_gpgcheck => 0,
pkg_gpgcheck => 0,
gpgkey => $gpgkey,
baseurl => $baseurl
}
}
}
}
default: { fail('This ossec module has not been tested on your distribution') }
}
}
4 changes: 4 additions & 0 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
"name": "puppetlabs/powershell",
"version_requirement": ">= 2.0.0 < 5.0.0"
},
{
"name": "puppet/zypprepo",
"version_requirement": "= 4.0.1"
},
{
"name": "puppet/archive",
"version_requirement": ">= 0.4.8 < 7.0.0"
Expand Down

0 comments on commit d7baee1

Please sign in to comment.