Keep Crashing Daemons Running on FreeBSD reddit / BSD ---------------------------------------------------------------------- E39M5S62 · 2019-05-11 05:40 I like FreeBSD, I use it in quite a few places. It's just a damn shame that people are resorting to cron'd scripts to keep daemons running. There a a number of different service managers out there - I wish we could get past the politics of it and get one in FreeBSD. Edit: just realized this is /r/BSD, but the sentiment still stands. ---------------------------------------------------------------------- johnklos · 2019-05-11 07:12 Sounds like you're advocating for systemd, which is a horrible, horrible thing, politics aside. It creates so many edge cases, many new security surfaces, and it defies documentation. It's probably a way to introduce plausible deniability in to the security of any GNU/Linux system, like we have with Windows. There are simple and well known ways of doing this that we've been doing for decades. The simplest is write a script that starts the daemon in the foreground, then just waits for the process. When the daemon dies, the script cleans up, perhaps logs and alerts, then restarts. Sigh. ---------------------------------------------------------------------- hipsterfont · 2019-05-11 08:08 Not necessarily, there's also OpenRC which was intended to be ran on *BSDs (and originally came from a NetBSD dev). ---------------------------------------------------------------------- qci · 2019-05-11 09:23 You should *never* restart a daemon without thinking about the consequences. If something is buggy, fix the bug and don't introduce workarounds. Edit: Btw, clamav is altogether a terrible piece of software full of bugs. ---------------------------------------------------------------------- m15f1t · 2019-05-11 09:54 20 year BSD user here. I kinda like systemd.. Not saying it should come to FreeBSD. But I like it in Ubuntu ---------------------------------------------------------------------- Vichill94 · 2019-05-11 10:29 systemd is the best thing that ever happened to Linux. Love it. So user friendly and intuitive. Fuck the init bash scripts. One of the reasons I always stick to Linux. ---------------------------------------------------------------------- NuLL3rr0r · 2019-05-11 10:33 Thanks for the feedback. I did not know about service managers, so I came up with a poor man's solution. What's your service manager of choice? ---------------------------------------------------------------------- NuLL3rr0r · 2019-05-11 10:35 Thanks for the feedback. I agree with you on this. It's just a temporary workaround to keep the mail server running, until I find an alternative. Unfortunately, I do not possess the enough knowledge (FreeBSD codebase or ClamAV) in order to fix such a bug. ​ BTW, are there any alternatives to ClamAV on \*nix systems? ---------------------------------------------------------------------- qci · 2019-05-11 11:27 You should ask yourself if you really need a virus scanner. Clamav is a resource hog and slows down servers. Furthermore, it finds too many false positives and causes panic for nothing. All I rely on for my home server are hourly ZFS snapshots and monitoring, so I can roll back stuff quickly. ---------------------------------------------------------------------- dlangille · 2019-05-11 11:38 Tools exist already for this. https://www.freshports.org/sysutils/daemontools/ ---------------------------------------------------------------------- NuLL3rr0r · 2019-05-11 12:17 Thank you so much, u/mirrorbox [mentioned it too](https://www.reddit.c om/r/freebsd/comments/bn4js6/keep_crashing_daemons_running_on_freebsd/ ). I will look into it. ---------------------------------------------------------------------- NuLL3rr0r · 2019-05-11 12:24 Well, I prefer to have a mail server due to the amount of spam with dangerous attachments. I looked this matter up and found [this question on stackexchange](https://softwarerecs.stackexchange.com/ques tions/40480/alternative-to-clamav-that-works-with-amavisd-new-no- architecture-restrictions) with free but non-FOSS options. Not sure, if we can run them on FreeBSD. UPDATE: it seems [Sophos supports FreeBSD](https://www.sophos.com/en-u s/medialibrary/PDFs/factsheets/sophosendpointprotectionfornonwindowsds na.pdf) but is not free (a 30 days trial). ---------------------------------------------------------------------- qci · 2019-05-11 12:28 I have a mail server, too, but simple spam filters are enough to get rid of most spam. ---------------------------------------------------------------------- E39M5S62 · 2019-05-11 13:41 ... The whole world doesn't revolve around systemd. I was talking about tools like Runit, S6 and OpenRC. Runit, for example, can be used as a service manager on top of an existing init system. http://smarden.org/runit/useinit.html ---------------------------------------------------------------------- dlangille · 2019-05-11 15:17 See also https://www.freshports.org/sysutils/py-supervisor/ ---------------------------------------------------------------------- NuLL3rr0r · 2019-05-11 15:43 Well, I see you have a point. Never considered that. After all based on ClamAV cons I may consider removing it from my setup due to not much added value. ---------------------------------------------------------------------- NuLL3rr0r · 2019-05-11 15:51 Thank you, I added another update mentioning sysuils/py-supervisor. Will look into it. ---------------------------------------------------------------------- qci · 2019-05-11 16:05 I have also greylisting for incoming mail on my postfix server. It delays receiving mails on first hit, but it's very effective against spammers. Most spam, probably over 99%, is already filtered there. ---------------------------------------------------------------------- joed_ · 2019-05-12 15:12 I like [runit](http://smarden.org/runit/). Very similar to daemontools. It's used as PID1 in Void Linux, so it's well tested. Service scripts are usually one liners (not including the shebang). AFAIK it works as an init replacement on most \*NIX systems. ---------------------------------------------------------------------- NuLL3rr0r · 2019-05-12 15:37 I also liked runit since I had a limited experience with Void. It's really fast and runs everything in parallel. ---------------------------------------------------------------------- olevole · 2019-05-13 07:50 Don't forget fsc (https://www.freshports.org/sysutils/fsc/) -- minimalistic, dependency free and designed for FreeBSD services. ---------------------------------------------------------------------- jcigar · 2019-05-13 12:11 you can also use **daemon(8)** ---------------------------------------------------------------------- NuLL3rr0r · 2019-05-13 16:36 >daemon Thanks, I'll add it to list of options. ---------------------------------------------------------------------- NuLL3rr0r · 2019-05-13 16:37 Thanks. Checked the man page and it seems perfectly suitable for my usage.