====== Trash Can (Filter File) Manager ======

The "Trashman" is utility program that maintains [[config:filter files]]((AKA trash can files)) that contain date/time stamps (''t='') and (optionally) expiration values (''e='') on filter lines separated by TAB characters:
  219.135.183.186^It=20250102T115506-0800^Ip=SMTP^Ir=3 FAILED LOGIN ATTEMPTS in 9.5h^Ie=20250402T125506-0800^Iu=jaguar@cvs.synchro.net^Ih=186.183.135.219.broad.gz.gd.dynamic.163data.com.cn

The date/time stamps and expiration date/times are automatically added to //some// filter files by Synchronet: ''[[config:ip.can]]'' and ''[[config:spamblock.cfg]]''.

The Trashman will remove old filter lines from these files if they are expired (the ''e='' date/time has been reached) or the age of the line exceeds a specified maximum age (with the ''-a'' option).

If just want to safely experiment with the utility, it does have a //test mode// option (''-t'').

===== Usage =====
<code>
usage: trashman [-opt][...] /path/to/file1.can [/path/to/file2.can][...]

options:
     -a<days> specify maximum age of filter items, in days
     -p<prot> only manage filters for specified protocol
     -t       run in test (read-only) mode
     -v       increase verbosity of output
</code>

===== Install =====
It's suggested to run this utility at least once a month via [[util:JSexec]] or the Synchronet [[server:Terminal]] Server Event Thread. This can be accomplished by adding it (if it doesn't already exist) to [[util:SCFG]]->External Programs->Fixed Events->Monthly:

| Native Executable/Script | Yes |
| Use Shell or New Context | Yes |
| Command Line             | ''%!trashman%. %z*.can %kspamblock.cfg'' |

===== See Also =====
  * [[:util:|util index]]

{{tag>security abuse spam can}}
