mail-in-a-box / mailinabox

Mail-in-a-Box helps individuals take back control of their email by defining a one-click, easy-to-deploy SMTP+everything else server: a mail server in a box.
https://mailinabox.email/
Creative Commons Zero v1.0 Universal
14.06k stars 1.44k forks source link

NSD daemon fails to log into /var/log/ directory #2313

Open skoszewski opened 1 year ago

skoszewski commented 1 year ago

Hi there!

I have upgraded my box to the v64 after updating the VPS to the 22.04 LTS. Immediately I have noticed that the NSD daemon fails to write to /var/log directory.

It seams the issue is related to two missing configuration actions:

I have added the nsd to the syslog group and modified the /lib/systemd/system/nsd.service file. I have also added package divertion for that file, so it will not be overwritten by the future updates.

Is it worth creating a patch and a pull request (I can do that)? Or am I missing something and it was by design not a bug?

Kind regards, Slawomir

downtownallday commented 1 year ago

What I did was set log-only-syslog: yes in nsd.conf and ensure that nsd.log exists before starting nsd. You might be able to get away with just the latter, but am not sure off hand.

So, two changes in setup/nsd.sh.

Somewhere in the cat > /etc/nsd/nsd.conf section, add log-only-syslog: yes.

And, after the terminal EOF add:

# nsd.log must exist or rsyslog won't write to it
if [ ! -e /var/log/nsd.log ]; then
    touch /var/log/nsd.log
    chown syslog:adm /var/log/nsd.log
fi
JJJ commented 9 months ago

Confirmed behavior, and it seems unintended.

Also confirming that the above code change resolved the immediate issue, however... I haven't had enough time to determine if log rotation will work too.