From 90a9fbd369dcf58d7d35c5fc7cabb6e972048ec7 Mon Sep 17 00:00:00 2001 From: ChrisWi Date: Mon, 29 May 2023 23:10:38 +0200 Subject: [PATCH] harmonize socket/pid file path to those used in Docker --- clamdtop/clamdtop.c | 4 ++-- common/optparser.c | 8 ++++---- docs/man/clamav-milter.conf.5.in | 2 +- etc/clamav-milter.conf.sample | 8 +++++--- etc/clamd.conf.sample | 5 +++-- etc/freshclam.conf.sample | 2 +- 6 files changed, 16 insertions(+), 13 deletions(-) diff --git a/clamdtop/clamdtop.c b/clamdtop/clamdtop.c index 83b094d359..c979c45b76 100644 --- a/clamdtop/clamdtop.c +++ b/clamdtop/clamdtop.c @@ -1341,14 +1341,14 @@ static void help(void) printf(" By The ClamAV Team: https://www.clamav.net/about.html#credits\n"); printf(" (C) 2023 Cisco Systems, Inc.\n"); printf("\n"); - printf(" clamdtop [-hVc] [host[:port] /path/to/clamd.socket ...]\n"); + printf(" clamdtop [-hVc] [host[:port] /path/to/clamd.sock ...]\n"); printf("\n"); printf(" --help -h Show this help\n"); printf(" --version -V Show version\n"); printf(" --config-file=FILE -c FILE Read clamd's configuration files from FILE\n"); printf(" --defaultcolors -d Use default terminal colors\n"); printf(" host[:port] Connect to clamd on host at port (default 3310)\n"); - printf(" /path/to/clamd.socket Connect to clamd over a local socket\n"); + printf(" /path/to/clamd.sock Connect to clamd over a local socket\n"); printf("\n"); return; } diff --git a/common/optparser.c b/common/optparser.c index 33ba0d45db..219134946e 100644 --- a/common/optparser.c +++ b/common/optparser.c @@ -274,7 +274,7 @@ const struct clam_option __clam_options[] = { {"ExtendedDetectionInfo", NULL, 0, CLOPT_TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_CLAMD, "Log additional information about the infected file, such as its\nsize and hash, together with the virus name.", "yes"}, - {"PidFile", "pid", 'p', CLOPT_TYPE_STRING, NULL, -1, NULL, 0, OPT_CLAMD | OPT_FRESHCLAM | OPT_MILTER, "Save the process ID to a file.", "/var/run/clam.pid"}, + {"PidFile", "pid", 'p', CLOPT_TYPE_STRING, NULL, -1, NULL, 0, OPT_CLAMD | OPT_FRESHCLAM | OPT_MILTER, "Save the process ID to a file.", "/run/clamav/clam.pid"}, {"TemporaryDirectory", "tempdir", 0, CLOPT_TYPE_STRING, NULL, -1, NULL, 0, OPT_CLAMD | OPT_MILTER | OPT_CLAMSCAN | OPT_SIGTOOL, "This option allows you to change the default temporary directory.", "/tmp"}, @@ -286,7 +286,7 @@ const struct clam_option __clam_options[] = { {"YaraRules", "yara-rules", 0, CLOPT_TYPE_STRING, NULL, 0, NULL, 0, OPT_CLAMSCAN, "By default, yara rules will be loaded. This option allows you to exclude yara rules when scanning and also to scan only using yara rules. Valid options are yes|no|only", "yes"}, - {"LocalSocket", NULL, 0, CLOPT_TYPE_STRING, NULL, -1, NULL, 0, OPT_CLAMD, "Path to a local socket file the daemon will listen on.", "/tmp/clamd.socket"}, + {"LocalSocket", NULL, 0, CLOPT_TYPE_STRING, NULL, -1, NULL, 0, OPT_CLAMD, "Path to a local socket file the daemon will listen on.", "/run/clamav/clamd.sock"}, {"LocalSocketGroup", NULL, 0, CLOPT_TYPE_STRING, NULL, -1, NULL, 0, OPT_CLAMD, "Sets the group ownership on the unix socket.", "virusgroup"}, @@ -599,9 +599,9 @@ const struct clam_option __clam_options[] = { /* Milter specific options */ - {"ClamdSocket", NULL, 0, CLOPT_TYPE_STRING, NULL, -1, NULL, FLAG_MULTIPLE, OPT_MILTER, "Define the clamd socket to connect to for scanning.\nThis option is mandatory! Syntax:\n ClamdSocket unix:path\n ClamdSocket tcp:host:port\nThe first syntax specifies a local unix socket (needs an absolute path) e.g.:\n ClamdSocket unix:/var/run/clamd/clamd.socket\nThe second syntax specifies a tcp local or remote tcp socket: the\nhost can be a hostname or an ip address; the \":port\" field is only required\nfor IPv6 addresses, otherwise it defaults to 3310\n ClamdSocket tcp:192.168.0.1\nThis option can be repeated several times with different sockets or even\nwith the same socket: clamd servers will be selected in a round-robin fashion.", "tcp:scanner.mydomain:7357"}, + {"ClamdSocket", NULL, 0, CLOPT_TYPE_STRING, NULL, -1, NULL, FLAG_MULTIPLE, OPT_MILTER, "Define the clamd socket to connect to for scanning.\nThis option is mandatory! Syntax:\n ClamdSocket unix:path\n ClamdSocket tcp:host:port\nThe first syntax specifies a local unix socket (needs an absolute path) e.g.:\n ClamdSocket unix:/run/clamav/clamd.sock\nThe second syntax specifies a tcp local or remote tcp socket: the\nhost can be a hostname or an ip address; the \":port\" field is only required\nfor IPv6 addresses, otherwise it defaults to 3310\n ClamdSocket tcp:192.168.0.1\nThis option can be repeated several times with different sockets or even\nwith the same socket: clamd servers will be selected in a round-robin fashion.", "tcp:scanner.mydomain:7357"}, - {"MilterSocket", NULL, 0, CLOPT_TYPE_STRING, NULL, -1, NULL, 0, OPT_MILTER, "Define the interface through which we communicate with sendmail.\nThis option is mandatory! Possible formats are:\n[[unix|local]:]/path/to/file - to specify a unix domain socket;\ninet:port@[hostname|ip-address] - to specify an ipv4 socket;\ninet6:port@[hostname|ip-address] - to specify an ipv6 socket.", "/tmp/clamav-milter.socket\ninet:7357"}, + {"MilterSocket", NULL, 0, CLOPT_TYPE_STRING, NULL, -1, NULL, 0, OPT_MILTER, "Define the interface through which we communicate with sendmail.\nThis option is mandatory! Possible formats are:\n[[unix|local]:]/path/to/file - to specify a unix domain socket;\ninet:port@[hostname|ip-address] - to specify an ipv4 socket;\ninet6:port@[hostname|ip-address] - to specify an ipv6 socket.", "/tmp/clamav-milter.sock\ninet:7357"}, {"MilterSocketGroup", NULL, 0, CLOPT_TYPE_STRING, NULL, -1, NULL, 0, OPT_MILTER, "Define the group ownership for the (unix) milter socket.", "virusgroup"}, diff --git a/docs/man/clamav-milter.conf.5.in b/docs/man/clamav-milter.conf.5.in index 7f42cfcbcf..6ba0e9200e 100644 --- a/docs/man/clamav-milter.conf.5.in +++ b/docs/man/clamav-milter.conf.5.in @@ -92,7 +92,7 @@ ClamdSocket tcp:host:port .br The first syntax specifies a local unix socket (needs an absolute path) e.g.: .br -ClamdSocket unix:/var/run/clamd/clamd.socket +ClamdSocket unix:/run/clamav/clamd.sock .br The second syntax specifies a tcp local or remote tcp socket: the host can be a hostname or an ip address; the ":port" field is only required for IPv6 addresses, otherwise it defaults to 3310 e.g.: .br diff --git a/etc/clamav-milter.conf.sample b/etc/clamav-milter.conf.sample index 30a14bd7ea..d0737821d7 100644 --- a/etc/clamav-milter.conf.sample +++ b/etc/clamav-milter.conf.sample @@ -17,7 +17,8 @@ Example # inet6:port@[hostname|ip-address] - to specify an ipv6 socket # # Default: no default -#MilterSocket /tmp/clamav-milter.socket +#MilterSocket /run/clamav/clamav-milter.sock +#MilterSocket /tmp/clamav-milter.sock #MilterSocket inet:7357 # Define the group ownership for the (unix) milter socket. @@ -64,7 +65,7 @@ Example # also owned by root to keep other users from tampering with it. # # Default: disabled -#PidFile /var/run/clamav-milter.pid +#PidFile /run/clamav/clamav-milter.pid # Optional path to the global temporary directory. # Default: system specific (usually /tmp or /var/tmp). @@ -80,7 +81,7 @@ Example # ClamdSocket unix:path # ClamdSocket tcp:host:port # The first syntax specifies a local unix socket (needs an absolute path) e.g.: -# ClamdSocket unix:/var/run/clamd/clamd.socket +# ClamdSocket unix:/run/clamav/clamd.sock # The second syntax specifies a tcp local or remote tcp socket: the # host can be a hostname or an ip address; the ":port" field is only required # for IPv6 addresses, otherwise it defaults to 3310, e.g.: @@ -92,6 +93,7 @@ Example # # Default: no default #ClamdSocket tcp:scanner.mydomain:7357 +#ClamdSocket unix:/run/clamav/clamd.sock ## diff --git a/etc/clamd.conf.sample b/etc/clamd.conf.sample index 76adb12c9b..b9f282824a 100644 --- a/etc/clamd.conf.sample +++ b/etc/clamd.conf.sample @@ -74,7 +74,7 @@ Example # 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 +#PidFile /run/clamav/clamd.pid # Optional path to the global temporary directory. # Default: system specific (usually /tmp or /var/tmp). @@ -98,7 +98,8 @@ Example # Path to a local socket file the daemon will listen on. # Default: disabled (must be specified by a user) -#LocalSocket /tmp/clamd.socket +#LocalSocket /run/clamav/clamd.sock +#LocalSocket /tmp/clamd.sock # Sets the group ownership on the unix socket. # Default: disabled (the primary group of the user running clamd) diff --git a/etc/freshclam.conf.sample b/etc/freshclam.conf.sample index da299ef6eb..14a87217a9 100644 --- a/etc/freshclam.conf.sample +++ b/etc/freshclam.conf.sample @@ -52,7 +52,7 @@ Example # 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 +#PidFile /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.