-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for Puppet installation on Amazon Linux OS #197
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -244,37 +244,28 @@ | |
} | ||
|
||
## ossec.conf generation concats | ||
case $::kernel { | ||
'Linux': { | ||
case $::osfamily { | ||
'Redhat', 'redhat', 'OracleLinux': { | ||
$apply_template_os = 'rhel' | ||
if ( $::operatingsystemrelease =~ /^7.*/ ) { | ||
$rhel_version = '7' | ||
} elsif ( $::operatingsystemrelease =~ /^6.*/ ) { | ||
$rhel_version = '6' | ||
} elsif ( $::operatingsystemrelease =~ /^5.*/ ) { | ||
$rhel_version = '5' | ||
} else { | ||
fail('This ossec module has not been tested on your distribution') | ||
} | ||
} | ||
'Debian', 'debian', 'Ubuntu', 'ubuntu': { | ||
$apply_template_os = 'debian' | ||
if ( $::lsbdistcodename == 'wheezy') or ($::lsbdistcodename == 'jessie') { | ||
$debian_additional_templates = 'yes' | ||
} | ||
} | ||
'Amazon': { | ||
$apply_template_os = 'amazon' | ||
} | ||
'CentOS', 'Centos', 'centos': { | ||
$apply_template_os = 'centos' | ||
} | ||
default: { fail('This ossec module has not been tested on your distribution') } | ||
case $::operatingsystem{ | ||
'Redhat', 'redhat', 'OracleLinux':{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please check if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @jm404 ! After starting a RHEL7 virtual machine and install Puppet on it, when checking Puppet facts we get: [root@rhel ~]# puppet facts find operatingsystem
{"name":"operatingsystem","values":{" ...
"dhcp_servers":"{
\"system\"eratingsystem":"RedHat",
"os":"{\"name\"=>\"RedHat\",
\"family\"=>\"RedHat\",
\"release\"=>{\"major\"=>\"7\", ....
Corporation","boardproductname":"VirtualBox","boardserialnumbe[root@rhel ~]# As you can see the operating system is called RedHat, so the case check would not match it: case $::operatingsystem{
'Redhat', 'redhat', 'OracleLinux':{ kr, Rshad There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The I assume that So in our manifests we have:
So, neither Best regards, Jose There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @jm404 ! After the changes made in cfed5f3, I tested the instsallation of a wazuh-manager and a wazuh-agent in RHEL operating system and both installations were done successfully. My test Operating System characteristics:
Puppet Facts (puppet 6.11.1)
Kr, Rshad |
||
$apply_template_os = 'rhel' | ||
if ( $::operatingsystemrelease =~ /^7.*/ ){ | ||
$rhel_version = '7' | ||
}elsif ( $::operatingsystemrelease =~ /^6.*/ ){ | ||
$rhel_version = '6' | ||
}elsif ( $::operatingsystemrelease =~ /^5.*/ ){ | ||
$rhel_version = '5' | ||
}else{ | ||
fail('This ossec module has not been tested on your distribution') | ||
} | ||
} | ||
'windows': { | ||
}'Debian', 'debian', 'Ubuntu', 'ubuntu':{ | ||
$apply_template_os = 'debian' | ||
if ( $::lsbdistcodename == 'wheezy') or ($::lsbdistcodename == 'jessie'){ | ||
$debian_additional_templates = 'yes' | ||
} | ||
}'Amazon':{ | ||
$apply_template_os = 'amazon' | ||
}'CentOS','Centos','centos':{ | ||
$apply_template_os = 'centos' | ||
}'windows': { | ||
$apply_template_os = 'windows' | ||
} | ||
default: { fail('OS not supported') } | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer the
case $::kernel {
block, we use it multiple times in the file instead of just filtering byoperatingssystem
which raises few questions like:operatingsystem
? (Windows server, Windows 10, etc...)windows
and notWindows
the proper operatingsystem?Please review best practices and or other common manifests examples and let me know your conclusions and required changes.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @jm404
I agree with you; Dealing with Windows case by only checking the operating system could produce errors.
To solve such an issue, I added a higher layer of a conditional statement check, which checks the Kernel first, if It's Linux, then it proceeds to run the operating system case condition. If it's Windows then it's directly select the corresponding config.
Find the changes in b1a706f.
Kr,
Rshad