Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Support On Write Close for ClamAV
  • Loading branch information
David Collins committed Jan 24, 2019
1 parent 2b4d381 commit 432e63d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions clamd/onaccess_fan.c
Expand Up @@ -154,6 +154,9 @@ void *onas_fan_th(void *arg)
if (optget(tharg->opts, "OnAccessPrevention")->enabled && !optget(tharg->opts, "OnAccessMountPath")->enabled) {
logg("ScanOnAccess: preventing access attempts on malicious files.\n");
fan_mask |= FAN_ACCESS_PERM | FAN_OPEN_PERM;
} else if ( optget(tharg->opts, "OnWriteClose")->enabled ) {
logg("OnWriteClose: notifying only upon close of a writable file\n");
fan_mask = FAN_CLOSE_WRITE;
} else {
logg("ScanOnAccess: notifying only for access attempts.\n");
fan_mask |= FAN_ACCESS | FAN_OPEN;
Expand Down
2 changes: 2 additions & 0 deletions shared/optparser.c
Expand Up @@ -420,6 +420,8 @@ const struct clam_option __clam_options[] = {

{"OnAccessExtraScanning", NULL, 0, CLOPT_TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_CLAMD, "Enables extra scanning and notification after catching certain inotify events. Only works with the DDD system enabled.", "yes"},

{"OnWriteClose", NULL, 0, CLOPT_TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_CLAMD, "This option changes the behavior of fanotify ScanOnAccess to only scan when a file opened for writing is closed. Good for environments with a very large read/write ratio.", "yes" },

/* FIXME: mark these as private and don't output into clamd.conf/man */
{"DevACOnly", "dev-ac-only", 0, CLOPT_TYPE_BOOL, MATCH_BOOL, -1, NULL, FLAG_HIDDEN, OPT_CLAMD | OPT_CLAMSCAN, "", ""},

Expand Down

0 comments on commit 432e63d

Please sign in to comment.