edestecd / puppet-clamav

Puppet Module for managing ClamAV
GNU General Public License v3.0
6 stars 59 forks source link

AmazonLinux 2017.03 does not have clamav-scanner-systemd package. #37

Closed pillarsdotnet closed 5 years ago

pillarsdotnet commented 7 years ago
[root@ip-10-254-250-45 ~]# cat /etc/issue
Amazon Linux AMI release 2017.03
Kernel \r on an \m

[root@ip-10-254-250-45 ~]# cat /etc/os-release
NAME="Amazon Linux AMI"
VERSION="2017.03"
ID="amzn"
ID_LIKE="rhel fedora"
VERSION_ID="2017.03"
PRETTY_NAME="Amazon Linux AMI 2017.03"
ANSI_COLOR="0;33"
CPE_NAME="cpe:/o:amazon:linux:2017.03:ga"
HOME_URL="http://aws.amazon.com/amazon-linux-ami/"
[root@ip-10-254-250-45 ~]# yum search clamav-scanner
Loaded plugins: priorities, update-motd, upgrade-helper
2012 packages excluded due to repository priority protections
======================================================================== N/S matched: clamav-scanner =========================================================================
clamav-scanner.noarch : Clamav scanner daemon
clamav-scanner-sysvinit.noarch : SysV initscripts for clamav scanner daemon

  Name and summary matches only, use "search all" for everything.
[root@ip-10-254-250-45 ~]#
pillarsdotnet commented 7 years ago

Considered relying on camptocamp/puppet-systemd to tell whether systemd is running, but its test fails on AmazonLinux:

[root@ip-10-254-250-45 ~]# ps -p 1 -o comm=
init
edestecd commented 7 years ago

I have never used amazon linux. I'm not sure if it has systemd, but if its based off of RedHat 7, it should. DO you have epel configured? I think those packages come from epel on CentOS

edestecd commented 7 years ago

You can set the name of the package to fix it for now:

class { 'clamav':
  manage_clamd   => true,
  clamav_package => 'clamav-scanner-sysvinit',
}
pillarsdotnet commented 7 years ago

This test succeeds:

[root@ip-10-254-250-45 ~]# if /proc/1/exe --version | grep -q 'systemd' ; then echo "Init is systemd" ; else echo "Init is NOT systemd" ; fi
Init is NOT systemd
pillarsdotnet commented 7 years ago

On a standard sysvinit system, /proc/1/exe --version outputs the following:

[root@ip-10-254-250-239 ~]# /proc/1/exe --version
/proc/1/exe: invalid option -- -
Usage: exe 0123456SsQqAaBbCcUu
pillarsdotnet commented 7 years ago

On an upstart-based system, /proc/1/exe --version outputs the following:

[root@ip-10-254-250-45 ~]# /proc/1/exe --version
exe (upstart 0.6.5)
Copyright (C) 2010 Canonical Ltd.

This is free software; see the source for copying conditions.  There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
pillarsdotnet commented 7 years ago

On a systemd-based system, /proc/1/exe --version output the following:

systemd 233
+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN default-hierarchy=hybrid
edestecd commented 7 years ago

So it seems like you have systemd. Just missing the package. whats the output of: yum info clamav-scanner-sysvinit

What repo are those packages coming from?

edestecd commented 7 years ago

Wait maybe I misunderstood. Do you have systemd?

pillarsdotnet commented 7 years ago

AmazonLinux 2017.03 does not appear to have systemd:

[root@ip-10-254-250-45 ~]# cat /cat /etc/os-release
cat: /cat: No such file or directory
NAME="Amazon Linux AMI"
VERSION="2017.03"
ID="amzn"
ID_LIKE="rhel fedora"
VERSION_ID="2017.03"
PRETTY_NAME="Amazon Linux AMI 2017.03"
ANSI_COLOR="0;33"
CPE_NAME="cpe:/o:amazon:linux:2017.03:ga"
HOME_URL="http://aws.amazon.com/amazon-linux-ami/"
[root@ip-10-254-250-45 ~]# yum search systemd
Loaded plugins: priorities, update-motd, upgrade-helper
2012 packages excluded due to repository priority protections
============================================================================ N/S matched: systemd ============================================================================
golang-github-coreos-go-systemd-devel.noarch : Go bindings to systemd socket activation, journal and D-BUS APIs
golang-github-coreos-go-systemd-unit-test.x86_64 : Unit tests for golang-github-coreos-go-systemd package
golang-github-coreos-go-etcd-devel.i686 : A golang library for logging to systemd
golang-github-coreos-go-etcd-devel.x86_64 : A golang library for logging to systemd
golang-github-coreos-go-log-devel.noarch : A golang library for logging to systemd
golang-github-mitchellh-goamz-devel.i686 : A golang library for logging to systemd
golang-github-mitchellh-goamz-devel.x86_64 : A golang library for logging to systemd

  Name and summary matches only, use "search all" for everything.
pillarsdotnet commented 7 years ago

As requested:

[root@ip-10-254-250-45 ~]#  yum info clamav-scanner-sysvinit
Loaded plugins: priorities, update-motd, upgrade-helper
2012 packages excluded due to repository priority protections
Available Packages
Name        : clamav-scanner-sysvinit
Arch        : noarch
Version     : 0.99.2
Release     : 1.27.amzn1
Size        : 23 k
Repo        : amzn-main/latest
Summary     : SysV initscripts for clamav scanner daemon
URL         : http://www.clamav.net
License     : GPLv2
Description : The SysV initscripts for clamav-scanner.
pillarsdotnet commented 7 years ago

Looks like the "meta" package is "clamd".

===============================================================================================================================================================
 Package                                        Arch                          Version                                   Repository                        Size
===============================================================================================================================================================
Installing:
 clamd                                          x86_64                        0.99.2-1.27.amzn1                         amzn-main                         21 k
Installing for dependencies:
 clamav                                         x86_64                        0.99.2-1.27.amzn1                         amzn-main                        1.0 M
 clamav-data                                    noarch                        0.99.2-1.27.amzn1                         amzn-main                        111 M
 clamav-filesystem                              noarch                        0.99.2-1.27.amzn1                         amzn-main                         22 k
 clamav-lib                                     x86_64                        0.99.2-1.27.amzn1                         amzn-main                        4.3 M
 clamav-scanner                                 noarch                        0.99.2-1.27.amzn1                         amzn-main                         29 k
 clamav-scanner-sysvinit                        noarch                        0.99.2-1.27.amzn1                         amzn-main                         23 k
 clamav-server                                  x86_64                        0.99.2-1.27.amzn1                         amzn-main                        112 k
 clamav-server-sysvinit                         noarch                        0.99.2-1.27.amzn1                         amzn-main                         23 k

Transaction Summary
===============================================================================================================================================================
Install  1 Package (+8 Dependent packages)
edestecd commented 7 years ago

SO the code snippet I posted above should work for you...

class { 'clamav':
  manage_clamd   => true,
  clamav_package => 'clamav-scanner-sysvinit',
}
pillarsdotnet commented 7 years ago

Opened #38

edestecd commented 7 years ago

Debian issue for systemd pid file: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=804132