rfxn / linux-malware-detect

Linux Malware Detection (LMD)
http://www.rfxn.com/projects/linux-malware-detect/
GNU General Public License v2.0
1.18k stars 228 forks source link

pre1-1.6.5 Failed to enable unit: Unit file maldet.service does not exist. #413

Closed Gazoo closed 1 year ago

Gazoo commented 1 year ago

Just a note that I went to test out the pre-release of 1.6.5 and it looks like the installer.sh script isn't installing the the maldet systemd service file properly:

 ./install.sh 
Failed to enable unit: Unit file maldet.service does not exist.
Linux Malware Detect v1.6.5
            (C) 2002-2019, R-fx Networks <proj@r-fx.org>
            (C) 2019, Ryan MacDonald <ryan@r-fx.org>
This program may be freely redistributed under the terms of the GNU GPL

installation completed to /usr/local/maldetect
config file: /usr/local/maldetect/conf.maldet
exec file: /usr/local/maldetect/maldet
exec link: /usr/local/sbin/maldet
exec link: /usr/local/sbin/lmd
cron.daily: /etc/cron.daily/maldet
imported config options from /usr/local/maldetect.last/conf.maldet
maldet(2109373): {sigup} performing signature update check...
maldet(2109373): {sigup} could not determine signature version
maldet(2109373): {sigup} signature files missing or corrupted, forcing update...
maldet(2109373): {sigup} new signature set 202303283084888 available
maldet(2109373): {sigup} downloading https://cdn.rfxn.com/downloads/maldet-sigpack.tgz
maldet(2109373): {sigup} downloading https://cdn.rfxn.com/downloads/maldet-cleanv2.tgz
maldet(2109373): {sigup} verified md5sum of maldet-sigpack.tgz
maldet(2109373): {sigup} unpacked and installed maldet-sigpack.tgz
maldet(2109373): {sigup} verified md5sum of maldet-clean.tgz
maldet(2109373): {sigup} unpacked and installed maldet-clean.tgz
maldet(2109373): {sigup} signature set update completed
maldet(2109373): {sigup} 17371 signatures (14534 MD5 | 2054 HEX | 783 YARA | 0 USER)
detected active monitoring mode, restarted inotify watch with '-m users'
# systemctl restart maldet
Failed to restart maldet.service: Unit maldet.service not found.
Gazoo commented 1 year ago

Sorry this is the same issue that I reported years ago: https://github.com/rfxn/linux-malware-detect/issues/371

From RHEL: https://bugzilla.redhat.com/show_bug.cgi?id=1972704

If you copy a file from another location, ensure plain cp command is used, not mv, nor "cp -a" and similar commands which preserve attributes; or restore the context according to the default settings using the restorecon command.

The installer script is using:

cp -af ./files/service/maldet.service /usr/lib/systemd/system/

This should fix it:

cp ./files/service/maldet.service /usr/lib/systemd/system/
rfxn commented 1 year ago

Thank you for flagging @Gazoo, apologies missed this one before cutting the release a few hours ago. I've updated the release and invalidated the hash / published updated binaries.

https://github.com/rfxn/linux-malware-detect/commit/b7db56f51f72d28d7f875d6f9de547d4768f0db0

This should be good to go!