Skip to content

Commit 6449d62

Browse files
committed
[Fix] Docs: sync README and man page with CLI; fix section structure
README: - --report: add 'active' argument - --format: add 'tsv' value - Add --all flag to usage block - Add lifecycle config vars (scan_progress_log_interval, scan_meta_cleanup_age, maint_compress_age, maint_archive_age) to Section 3.3 - Fix default_monitor_mode default: "users" → "" (matches conf.maldet) Man page: - Add --verbose to OPTIONS - --report: add 'active' argument - --format: add 'tsv', update scope to include -L - Move SCAN MANAGEMENT before EXAMPLES (was after SEE ALSO) - Merge duplicate CONFIGURATION and FILES sections into canonical locations - Add lifecycle config vars and files to canonical sections - Remove duplicate scan_progress_log_interval description
1 parent dae7704 commit 6449d62

2 files changed

Lines changed: 119 additions & 110 deletions

File tree

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,10 @@ maldet -co quarantine_hits=1,email_addr=you@domain.com -a /home
280280
| `scan_tmpdir_paths` | World-writable temp paths included in -a/-r scans | `/tmp /var/tmp /dev/shm /var/fcgi_ipc` |
281281
| `string_length_scan` | Enable statistical string-length analysis | `0` |
282282
| `string_length` | Minimum suspicious string length | `150000` |
283+
| `scan_progress_log_interval` | Seconds between progress log checkpoints during background scans (0=disabled) | `60` |
284+
| `scan_meta_cleanup_age` | Hours to retain completed/killed scan meta files (0=disabled) | `48` |
285+
| `maint_compress_age` | Days before completed session files are gzipped (0=disabled) | `30` |
286+
| `maint_archive_age` | Days before compressed sessions are bundled into monthly archives (0=disabled) | `90` |
283287

284288
### 3.4 YARA Scanning
285289

@@ -320,7 +324,7 @@ maldet -co scan_yara=1 -a /home/?/public_html
320324

321325
| Variable | Purpose | Default |
322326
|----------|---------|---------|
323-
| `default_monitor_mode` | Startup mode for monitor (`users` or path to file) | `users` |
327+
| `default_monitor_mode` | Startup mode for monitor (`users` or path to file); empty = disabled | `""` |
324328
| `inotify_base_watches` | Base number of file watches per user path | `16384` |
325329
| `inotify_minuid` | Minimum UID for user home monitoring | `500` |
326330
| `inotify_docroot` | Subdirectories to monitor in user homes | `public_html,public_ftp` |
@@ -437,8 +441,9 @@ QUARANTINE & RESTORE:
437441
-qd PATH override quarantine directory for this run
438442
439443
REPORTING:
440-
-e, --report [SCANID|list|latest|hooks] view scan report
441-
--format text|json|html set report output format (default: text)
444+
-e, --report [SCANID|list|latest|hooks|active] view scan report
445+
--all show full history with -e list (default: recent)
446+
--format text|json|html|tsv set report output format (default: text)
442447
--mailto ADDRESS email report to address
443448
--json-report [SCANID|list] shorthand: --report --format json
444449
--alert-daily generate inotify monitor digest alert

files/maldet.1

Lines changed: 111 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,24 @@ Override the quarantine directory for this run.
6868
May appear anywhere in the command line.
6969
.SS Reporting
7070
.TP
71-
\fB\-e\fR, \fB\-\-report\fR [\fISCANID\fR|\fBlist\fR|\fBlatest\fR|\fBhooks\fR]
71+
\fB\-e\fR, \fB\-\-report\fR [\fISCANID\fR|\fBlist\fR|\fBlatest\fR|\fBhooks\fR|\fBactive\fR]
7272
View a scan report.
7373
Use \fBlatest\fR for the most recent scan, \fBlist\fR for all reports,
74-
\fBhooks\fR for hook scan activity (see HOOK SCANNING).
74+
\fBhooks\fR for hook scan activity (see HOOK SCANNING),
75+
\fBactive\fR for running scans (equivalent to \fB\-L\fR).
7576
Combine with \fB\-\-format\fR and \fB\-\-mailto\fR for output control.
7677
.TP
7778
\fB\-\-all\fR
7879
Show full scan history when used with \fB\-e list\fR.
7980
Without \fB\-\-all\fR, \fB\-e list\fR shows only recent sessions.
8081
May appear anywhere in the command line.
8182
.TP
82-
\fB\-\-format\fR \fBtext\fR|\fBjson\fR|\fBhtml\fR
83-
Set report output format for \fB\-e\fR/\fB\-\-report\fR (default: text).
83+
\fB\-\-verbose\fR
84+
Show additional detail with \fB\-L\fR (workers, signature version, progress).
85+
May appear anywhere in the command line.
86+
.TP
87+
\fB\-\-format\fR \fBtext\fR|\fBjson\fR|\fBhtml\fR|\fBtsv\fR
88+
Set report output format for \fB\-e\fR/\fB\-\-report\fR and \fB\-L\fR (default: text).
8489
May appear anywhere in the command line.
8590
.TP
8691
\fB\-\-mailto\fR \fIADDRESS\fR
@@ -287,6 +292,40 @@ Managed independently of
287292
See
288293
.B monitor_paths_extra
289294
in the CONFIGURATION section.
295+
.TP
296+
.I $sessdir/scan.meta.$scanid
297+
Scan lifecycle metadata. Contains process info, state, engine type,
298+
scan options, and timestamps. Updated throughout the scan lifecycle
299+
as state transitions occur.
300+
.TP
301+
.I $sessdir/session.index
302+
Append\-only session index for O(1) scan listing. Each line records
303+
the scan ID, start time, path, and completion status. Used by
304+
\fB\-\-report list\fR and \fB\-L\fR for fast enumeration without
305+
scanning the session directory.
306+
.TP
307+
.I $sessdir/scan.checkpoint.$scanid
308+
Stage checkpoint file for \fB\-\-continue\fR. Written by \fB\-\-stop\fR
309+
with the \fB#LMD_CHECKPOINT:v1\fR format. Contains the last completed
310+
stage, accumulated hits, config options, and signature version at the
311+
time of stop.
312+
.TP
313+
.I $tmpdir/.abort.$scanid
314+
Abort sentinel. Created by \fB\-\-kill\fR or \fB\-\-stop\fR. Workers
315+
check for this file at stage boundaries and during scan loops for
316+
cooperative shutdown.
317+
.TP
318+
.I $tmpdir/.pause.$scanid
319+
Pause sentinel with epoch timestamp and optional duration. Created by
320+
\fB\-\-pause\fR. Workers enter a sleep loop while this file exists.
321+
Removed by \fB\-\-unpause\fR or when the duration expires.
322+
.TP
323+
.I $sessdir/session.archive.YYMM.tsv.gz
324+
Monthly session archive created by \fB\-\-maintenance\fR. Consolidates
325+
all session TSV files from the given month (YYMM) into a single
326+
gzip\-compressed archive. The \fB\-\-report\fR command transparently
327+
resolves sessions from archives when the original session file has
328+
been archived.
290329
.SH CONFIGURATION
291330
Configuration is loaded from
292331
.I conf.maldet
@@ -703,6 +742,29 @@ sets the minimum malware hit count to trigger the hook.
703742
Set to 0 to fire on every scan including clean ones.
704743
Default: 1.
705744
.PP
745+
.B Scan Lifecycle:
746+
.BR scan_progress_log_interval ,
747+
.BR scan_meta_cleanup_age ,
748+
.BR maint_compress_age ,
749+
.BR maint_archive_age .
750+
.PP
751+
.B scan_meta_cleanup_age
752+
sets the number of hours to retain completed/killed/stale scan.meta files
753+
before cleanup.
754+
Meta files for active/paused/stopped scans are never cleaned.
755+
Set 0 to disable automatic cleanup. Default: 48.
756+
.PP
757+
.B maint_compress_age
758+
sets the number of days before completed session files are compressed (gzipped).
759+
Sessions younger than this age are never compressed.
760+
Set 0 to disable automatic compression. Default: 30.
761+
.PP
762+
.B maint_archive_age
763+
sets the number of days before compressed session files are bundled into
764+
monthly archives.
765+
Sessions younger than this age are never archived.
766+
Set 0 to disable automatic archival. Default: 90.
767+
.PP
706768
See
707769
.I conf.maldet
708770
for the full list with descriptions.
@@ -907,60 +969,6 @@ Filter by time: \fBNh\fR (hours), \fBNd\fR (days), \fBNm\fR (minutes).
907969
\fBmaldet \-\-report hooks \-\-mode\fR \fIMODE\fR
908970
Filter by hook mode: \fBmodsec\fR, \fBftp\fR, \fBproftpd\fR, \fBexim\fR,
909971
or \fBgeneric\fR.
910-
.SH EXAMPLES
911-
.TP
912-
Scan all files under user web roots:
913-
.B maldet \-a /home/?/public_html
914-
.TP
915-
Scan recent files with auto\-quarantine and YARA:
916-
.B maldet \-co quarantine_hits=1,scan_yara=1 \-r /home/?/public_html 2
917-
.TP
918-
View the most recent scan report:
919-
.B maldet \-e
920-
.TP
921-
List all scan reports:
922-
.B maldet \-e list
923-
.TP
924-
Output a scan report as JSON:
925-
.B maldet \-\-json\-report SCANID
926-
.TP
927-
List all reports as JSON:
928-
.B maldet \-\-json\-report list
929-
.TP
930-
Quarantine all hits from a scan:
931-
.B maldet \-q SCANID
932-
.TP
933-
Start real\-time inotify monitoring (foreground):
934-
.B maldet \-m users
935-
.TP
936-
Start real\-time inotify monitoring (background daemon):
937-
.B maldet \-b \-m users
938-
.TP
939-
Scan a file via the generic hook API:
940-
.B hookscan.sh generic /path/to/file
941-
.TP
942-
Batch scan files from a list:
943-
.B hookscan.sh generic \-\-list /tmp/filelist.txt
944-
.TP
945-
View hook scan activity (last 24 hours):
946-
.B maldet \-\-report hooks
947-
.TP
948-
View hook scan activity filtered by mode:
949-
.B maldet \-\-report hooks \-\-mode modsec
950-
.TP
951-
Fire an on\-demand digest alert:
952-
.B maldet \-\-digest
953-
.TP
954-
Test email alerting with a synthetic scan report:
955-
.B maldet \-\-test\-alert scan email
956-
.TP
957-
Test Slack digest delivery:
958-
.B maldet \-\-test\-alert digest slack
959-
.SH SEE ALSO
960-
.BR clamdscan (1),
961-
.BR clamscan (1),
962-
.BR yara (1),
963-
.BR inotifywait (1)
964972
.SH SCAN MANAGEMENT
965973
Scan lifecycle commands allow controlling running scans without terminating
966974
the maldet process. Scans transition through a state machine:
@@ -1064,64 +1072,60 @@ The checkpoint file uses a simple key=value format with a
10641072
\fBsig_version\fR, \fBworkers\fR, \fBtotal_files\fR, \fBhits_so_far\fR,
10651073
and \fBoptions\fR (original \fB\-co\fR values). The session hits file is
10661074
preserved across stop/continue so that accumulated detections are retained.
1067-
.SH CONFIGURATION
1068-
The configuration of LMD is handled through \fI$inspath/conf.maldet\fR
1069-
and all options are well commented for ease of configuration. System\-level
1070-
overrides can be placed in \fI/etc/sysconfig/maldet\fR or
1071-
\fI/etc/default/maldet\fR. Runtime overrides via \fB\-co\fR take
1072-
highest precedence.
1073-
.PP
1074-
The following configuration options relate to scan lifecycle management:
1075+
.SH EXAMPLES
10751076
.TP
1076-
.B scan_meta_cleanup_age
1077-
Hours to retain completed/killed/stale scan.meta files before cleanup.
1078-
Meta files for active/paused/stopped scans are never cleaned.
1079-
Set 0 to disable automatic cleanup. Default: 48.
1077+
Scan all files under user web roots:
1078+
.B maldet \-a /home/?/public_html
10801079
.TP
1081-
.B maint_compress_age
1082-
Days before completed session files are compressed (gzipped).
1083-
Sessions younger than this age are never compressed.
1084-
Set 0 to disable automatic compression. Default: 30.
1080+
Scan recent files with auto\-quarantine and YARA:
1081+
.B maldet \-co quarantine_hits=1,scan_yara=1 \-r /home/?/public_html 2
10851082
.TP
1086-
.B maint_archive_age
1087-
Days before compressed session files are bundled into monthly archives.
1088-
Sessions younger than this age are never archived.
1089-
Set 0 to disable automatic archival. Default: 90.
1090-
.SH FILES
1083+
View the most recent scan report:
1084+
.B maldet \-e
10911085
.TP
1092-
.I $sessdir/scan.meta.$scanid
1093-
Scan lifecycle metadata. Contains process info, state, engine type,
1094-
scan options, and timestamps. Updated throughout the scan lifecycle
1095-
as state transitions occur.
1086+
List all scan reports:
1087+
.B maldet \-e list
10961088
.TP
1097-
.I $sessdir/session.index
1098-
Append\-only session index for O(1) scan listing. Each line records
1099-
the scan ID, start time, path, and completion status. Used by
1100-
\fB\-\-report list\fR and \fB\-L\fR for fast enumeration without
1101-
scanning the session directory.
1089+
Output a scan report as JSON:
1090+
.B maldet \-\-json\-report SCANID
11021091
.TP
1103-
.I $sessdir/scan.checkpoint.$scanid
1104-
Stage checkpoint file for \fB\-\-continue\fR. Written by \fB\-\-stop\fR
1105-
with the \fB#LMD_CHECKPOINT:v1\fR format. Contains the last completed
1106-
stage, accumulated hits, config options, and signature version at the
1107-
time of stop.
1092+
List all reports as JSON:
1093+
.B maldet \-\-json\-report list
11081094
.TP
1109-
.I $tmpdir/.abort.$scanid
1110-
Abort sentinel. Created by \fB\-\-kill\fR or \fB\-\-stop\fR. Workers
1111-
check for this file at stage boundaries and during scan loops for
1112-
cooperative shutdown.
1095+
Quarantine all hits from a scan:
1096+
.B maldet \-q SCANID
11131097
.TP
1114-
.I $tmpdir/.pause.$scanid
1115-
Pause sentinel with epoch timestamp and optional duration. Created by
1116-
\fB\-\-pause\fR. Workers enter a sleep loop while this file exists.
1117-
Removed by \fB\-\-unpause\fR or when the duration expires.
1098+
Start real\-time inotify monitoring (foreground):
1099+
.B maldet \-m users
11181100
.TP
1119-
.I $sessdir/session.archive.YYMM.tsv.gz
1120-
Monthly session archive created by \fB\-\-maintenance\fR. Consolidates
1121-
all session TSV files from the given month (YYMM) into a single
1122-
gzip\-compressed archive. The \fB\-\-report\fR command transparently
1123-
resolves sessions from archives when the original session file has
1124-
been archived.
1101+
Start real\-time inotify monitoring (background daemon):
1102+
.B maldet \-b \-m users
1103+
.TP
1104+
Scan a file via the generic hook API:
1105+
.B hookscan.sh generic /path/to/file
1106+
.TP
1107+
Batch scan files from a list:
1108+
.B hookscan.sh generic \-\-list /tmp/filelist.txt
1109+
.TP
1110+
View hook scan activity (last 24 hours):
1111+
.B maldet \-\-report hooks
1112+
.TP
1113+
View hook scan activity filtered by mode:
1114+
.B maldet \-\-report hooks \-\-mode modsec
1115+
.TP
1116+
Fire an on\-demand digest alert:
1117+
.B maldet \-\-digest
1118+
.TP
1119+
Test email alerting with a synthetic scan report:
1120+
.B maldet \-\-test\-alert scan email
1121+
.TP
1122+
Test Slack digest delivery:
1123+
.B maldet \-\-test\-alert digest slack
1124+
.SH SEE ALSO
1125+
.BR clamdscan (1),
1126+
.BR clamscan (1),
1127+
.BR yara (1),
1128+
.BR inotifywait (1)
11251129
.SH BUGS
11261130
Report bugs at \fIhttps://github.com/rfxn/linux\-malware\-detect/issues\fR.
11271131
.SH AUTHORS

0 commit comments

Comments
 (0)