Re: security/clamav: /ar/run on TMPFS renders the port broken by design

From: Cy Schubert <Cy.Schubert_at_cschubert.com>
Date: Sun, 28 Aug 2022 10:05:01 UTC
In message <202208280842.27S8gDXn055868@nuc.oldach.net>, Helge Oldach 
writes:
> Cy Schubert wrote on Sat, 27 Aug 2022 17:26:38 +0200 (CEST):
> > As stated before in this thread, replacing /var/run with tmpfs is not a
> > supported configuration.
>
> Not supported? What is the purpose of /etc/rc.d/var then? That creates a tmpf
> s backed /var, populates it through mtree, and makes a proper /var/run availa
> ble.
>
> However it doesn't (yet) create /var/run/clamav of course.
>
> It would be fairly easy to extend /etc/rc.d/var by a logic that walks through
>  /usr/local/etc/mtree/* and runs mtree on each of the files found as needed. 
> All that the security/clamav port would need to do then is to drop an appropr
> iate small mtree file as /usr/local/etc/mtree/clamav. From a port's perspecti
> ve that is the same logic as dropping service scripts as /usr/local/etc/rc.d/
> clamav-*.
>
> Kind regards
> Helge

This is because you don't already have a /var/run/clamav yet. Unfortunately 
this dies not retroactively create /var/run/clamav.

My new copy of the script, attached, also does not retroactively create the 
directory. Create the directory by hand. Use your server. Reboot and the 
directories will be recreated.

If converting from UFS or ZFS /var/run, simply add the tmpfs mountpoint 
after adding and enabling the script and reboot. (I prefix all locally 
written scripts with kq-).

Remember, this does not retroactively create /var/run/clamav if it doesn't 
already exist. This only makes mounting of tmpfs /var/run an option 
possible.