トップ 最新 追記

Masa's blog

検索キーワード:

2021年09月05日 Building ClamAV-0.104.0 on Slackware-14.2 [長年日記]

_ Slackware-14.2でClamAV-0.104.0をビルドする

Slackware-14.2でClamAV-0.103.3からClamAV-0.104.0にバージョンアップしたのだけれど、新しめなcmakeやら新たなライブラリやらが必要になっていた。

cmake-3.19.6を/optにインストール

オリジナルのcmake-3.5.2では古すぎて、ClamAV-0.104.0はビルド出来ない。

これで、/opt/cmake-202x/以下にインストールされる。

check-0.15.2のインストール

ClamAV-0.104.0のビルドには、libcheckとやらが必要とのこと...

python-3.7.2のインストール

Python3も必要...

ようやくClamAV-0.104.0のビルド

  • tar xvf clamav-0.104.0.tar.gz
  • cd clamav-0.104.0
  • mkdir build
  • cd build
  • PATH=/opt/cmake-202x/bin:${PATH} cmake ..
  • make
  • sudo make install

定義ファイル格納ディレクトリ(/usr/local/share/clamav/)の準備

  • sudo mkdir /usr/local/share/clamav
  • sudo chown clamav.clamav /usr/local/share/clamav

スキャンデーモンの設定ファイル(/usr/local/etc/clamd.conf)

*** clamd.conf.sample	2021-08-28 07:41:31.000000000 +0900
--- clamd.conf	2021-09-05 15:22:48.245019780 +0900
***************
*** 5,17 ****


  # Comment or remove the line below.
! Example

  # Uncomment this option to enable logging.
  # LogFile must be writable for the user running daemon.
  # A full path is required.
  # Default: disabled
! #LogFile /tmp/clamd.log

  # By default the log file is locked for writing - the lock protects against
  # running clamd multiple times (if want to run another clamd, please
--- 5,17 ----


  # Comment or remove the line below.
! #Example

  # Uncomment this option to enable logging.
  # LogFile must be writable for the user running daemon.
  # A full path is required.
  # Default: disabled
! LogFile /var/log/clamav/clamd.log

  # By default the log file is locked for writing - the lock protects against
  # running clamd multiple times (if want to run another clamd, please
***************
*** 41,52 ****

  # Use system logger (can work together with LogFile).
  # Default: no
! #LogSyslog yes

  # Specify the type of syslog messages - please refer to 'man syslog'
  # for facility names.
  # Default: LOG_LOCAL6
! #LogFacility LOG_MAIL

  # Enable verbose logging.
  # Default: no
--- 41,52 ----

  # Use system logger (can work together with LogFile).
  # Default: no
! LogSyslog yes

  # Specify the type of syslog messages - please refer to 'man syslog'
  # for facility names.
  # Default: LOG_LOCAL6
! LogFacility LOG_MAIL

  # Enable verbose logging.
  # Default: no
***************
*** 74,80 ****
  # It is recommended that the directory where this file is stored is
  # also owned by root to keep other users from tampering with it.
  # Default: disabled
! #PidFile /var/run/clamd.pid

  # Optional path to the global temporary directory.
  # Default: system specific (usually /tmp or /var/tmp).
--- 74,80 ----
  # It is recommended that the directory where this file is stored is
  # also owned by root to keep other users from tampering with it.
  # Default: disabled
! PidFile /var/run/clamav/clamd.pid

  # Optional path to the global temporary directory.
  # Default: system specific (usually /tmp or /var/tmp).
***************
*** 93,111 ****

  # Path to a local socket file the daemon will listen on.
  # Default: disabled (must be specified by a user)
! #LocalSocket /tmp/clamd.socket

  # Sets the group ownership on the unix socket.
  # Default: disabled (the primary group of the user running clamd)
! #LocalSocketGroup virusgroup

  # Sets the permissions on the unix socket to the specified mode.
  # Default: disabled (socket is world accessible)
! #LocalSocketMode 660

  # Remove stale socket after unclean shutdown.
  # Default: yes
! #FixStaleSocket yes

  # TCP port address.
  # Default: no
--- 93,111 ----

  # Path to a local socket file the daemon will listen on.
  # Default: disabled (must be specified by a user)
! LocalSocket /var/run/clamav/clamd.socket

  # Sets the group ownership on the unix socket.
  # Default: disabled (the primary group of the user running clamd)
! LocalSocketGroup clamav

  # Sets the permissions on the unix socket to the specified mode.
  # Default: disabled (socket is world accessible)
! #DEL_LocalSocketMode 660

  # Remove stale socket after unclean shutdown.
  # Default: yes
! FixStaleSocket yes

  # TCP port address.
  # Default: no
***************
*** 117,123 ****
  # from the outside world. This option can be specified multiple
  # times if you want to listen on multiple IPs. IPv6 is now supported.
  # Default: no
! #TCPAddr localhost

  # Maximum length the queue of pending connections may grow to.
  # Default: 200
--- 117,123 ----
  # from the outside world. This option can be specified multiple
  # times if you want to listen on multiple IPs. IPv6 is now supported.
  # Default: no
! #TCPAddr 127.0.0.1

  # Maximum length the queue of pending connections may grow to.
  # Default: 200
***************
*** 210,227 ****
  #ConcurrentDatabaseReload no

  # Execute a command when virus is found. In the command string %v will
! # be replaced with the virus name and %f will be replaced with the file name.
! # Additionally, two environment variables will be defined: $CLAM_VIRUSEVENT_FILENAME
! # and $CLAM_VIRUSEVENT_VIRUSNAME.
  # Default: no
! #VirusEvent /usr/local/bin/send_sms 123456789 "VIRUS ALERT: %v in %f"

  # Run as another user (clamd must be started by root for this option to work)
  # Default: don't drop privileges
! #User clamav

  # Stop daemon when libclamav reports out of memory condition.
! #ExitOnOOM yes

  # Don't fork into background.
  # Default: no
--- 210,225 ----
  #ConcurrentDatabaseReload no

  # Execute a command when virus is found. In the command string %v will
! # be replaced with the virus name.
  # Default: no
! #VirusEvent /usr/local/bin/send_sms 123456789 "VIRUS ALERT: %v"

  # Run as another user (clamd must be started by root for this option to work)
  # Default: don't drop privileges
! #DEL_User clamav

  # Stop daemon when libclamav reports out of memory condition.
! ExitOnOOM yes

  # Don't fork into background.
  # Default: no

定義ファイル更新デーモンの定義ファイル(/usr/local/etc/freshclam.conf)

*** freshclam.conf.sample	2021-08-28 07:41:31.000000000 +0900
--- freshclam.conf	2021-09-05 15:25:26.379098762 +0900
***************
*** 5,11 ****


  # Comment or remove the line below.
! Example

  # Path to the database directory.
  # WARNING: It must match clamd.conf's directive!
--- 5,11 ----


  # Comment or remove the line below.
! #Example

  # Path to the database directory.
  # WARNING: It must match clamd.conf's directive!
***************
*** 14,20 ****

  # Path to the log file (make sure it has proper permissions)
  # Default: disabled
! #UpdateLogFile /var/log/freshclam.log

  # Maximum size of the log file.
  # Value of 0 disables the limit.
--- 14,20 ----

  # Path to the log file (make sure it has proper permissions)
  # Default: disabled
! UpdateLogFile /var/log/clamav/freshclam.log

  # Maximum size of the log file.
  # Value of 0 disables the limit.
***************
*** 35,46 ****

  # Use system logger (can work together with UpdateLogFile).
  # Default: no
! #LogSyslog yes

  # Specify the type of syslog messages - please refer to 'man syslog'
  # for facility names.
  # Default: LOG_LOCAL6
! #LogFacility LOG_MAIL

  # Enable log rotation. Always enabled when LogFileMaxSize is enabled.
  # Default: no
--- 35,46 ----

  # Use system logger (can work together with UpdateLogFile).
  # Default: no
! LogSyslog yes

  # Specify the type of syslog messages - please refer to 'man syslog'
  # for facility names.
  # Default: LOG_LOCAL6
! LogFacility LOG_MAIL

  # Enable log rotation. Always enabled when LogFileMaxSize is enabled.
  # Default: no
***************
*** 51,62 ****
  # It is recommended that the directory where this file is stored is
  # also owned by root to keep other users from tampering with it.
  # Default: disabled
! #PidFile /var/run/freshclam.pid

  # By default when started freshclam drops privileges and switches to the
  # "clamav" user. This directive allows you to change the database owner.
  # Default: clamav (may depend on installation options)
! #DatabaseOwner clamav

  # Use DNS to verify virus database version. FreshClam uses DNS TXT records
  # to verify database and software versions. With this directive you can change
--- 51,62 ----
  # It is recommended that the directory where this file is stored is
  # also owned by root to keep other users from tampering with it.
  # Default: disabled
! PidFile /var/run/clamav/freshclam.pid

  # By default when started freshclam drops privileges and switches to the
  # "clamav" user. This directive allows you to change the database owner.
  # Default: clamav (may depend on installation options)
! DatabaseOwner clamav

  # Use DNS to verify virus database version. FreshClam uses DNS TXT records
  # to verify database and software versions. With this directive you can change
***************
*** 147,153 ****

  # Send the RELOAD command to clamd.
  # Default: no
! #NotifyClamd /path/to/clamd.conf

  # Run command after successful database update.
  # Use EXIT_1 to return 1 after successful database update.
--- 147,153 ----

  # Send the RELOAD command to clamd.
  # Default: no
! NotifyClamd /usr/local/etc/clamd.conf

  # Run command after successful database update.
  # Use EXIT_1 to return 1 after successful database update.

スキャンデーモン(/usr/local/sbin/clamd)の起動

  • sudo mkdir -p /var/run/clamav/
  • sudo chown clamav:clamav /var/run/clamav/
  • sudo chmod 771 /var/run/clamav/
  • sudo /usr/local/sbin/clamd

定義ファイル更新デーモン(/usr/local/bin/freshclam)の起動

  • sudo /usr/local/bin/freshclam -d -l /var/log/clamav/freshclam.log