Command line tools

j-ndc

j-ndc allows you to interact directly with the filter - consult it's internal state or send commands to it without having to stop and restart it. j-ndc use network access to communicate with the filter. Then we need to activate it. Default options are good enough to communicate with localhost.

To show the current connexion within the filter:

Terminal

j-ndc stats connopen

/etc/mail/jchkmail/jchkmail.cf

CTRL_CHANNEL_ENABLE            YES
CTRL_SOCKET                    inet:2010@localhost
CTRL_ACCESS                    NONE
If you configure the control channel to listen only on IP address 127.0.0.1, you can disable access control. If this isn't the case, you shall list which hosts can connect into the control channel (j-policy database).

/etc/mail/jchkmail/jpolicy.txt

CtrlChan:DEFAULT               REJECT
CtrlChan:127.0.0.1             OK
CtrlChan:194.214.168.176       OK

j-ndc help

Usage:
   j-ndc [-h] [-s server] [-p port] command

   Use the j-ndc script to send a command to the filter.

   Options :

   -h    : This message
   -s    : Server name/address
   -p    : Server port
   -d    : debug

   Commands : With j-ndc, you can send the following commands:
     RECONFIG               # reload j-chkmail.cf
     RELOAD DATABASES       # reload j-urlbl.db (and future db files)
     RELOAD TABLES          # reload configuration tables :
                              j-access, j-regex, j-xfiles j-tables j-oradata
     REOPEN LOGFILES        # reopen log files
                              j-regex j-files j-virus j-xreport j-stats

     RESTART                # stop and restart j-chkmail (soft restart)

     RESET STATS

     STATS CONNOPEN         # show open connections
     STATS CONNRATE         # show connection rate data for each client
     STATS COUNTERS         # show internal counters
     STATS THROTTLE         # show server connection rate
     STATS LIVEHISTORY      # show short history blacklist
     STATS ORACLE           # show oracle counters for this process
     STATS SCORES           #
     STATS REGSCORE         #
     STATS ORASCORES        #

     SETCF variable value   # Set configuration values (override values found
                              at j-chkmail.cf file)
     SET   variable value   # activate some internal configuration values

j-makemap

Usage : j-makemap options
  Joe's j-chkmail v1.12.0-070729
  Compiled on Jul 29 2007 22:44:49
        -b table : specifies table name
        -d       : dump instead of update
        -c       : count records on database
        -k key   : matching key
        -w NN    : column width when dumping database
        -t       : database type
                   currently, only btree type is supported
        -m       : how to insert records
                   e - clear database before update
                   s - skip existent records
                   u - new records update existent records
        -r       : reverse key/value order (value/key)
        -1       : single column (key only)
        -2       : two columns (key / value) - default
        -h       : help (print this and exits)
        -v       : verbose

j-makemap -d -b /var/jchkmail/wdb/j-greywhitelist.db

j-printstats

sh-3.1$ j-printstats -h
Usage : j-printstats options
    j-printstats -c conf_file
    j-printstats -a | -p | -g
        -p   : print running process j-chkmail counters
        -g   : print j-chkmail counters from last reset
        -a   : print both counters
    j-printstats -t[td]
        -t   : throttle data (summary)
        -tt  : throttle data (detail)
        -d   : resolve IP addresses
        -m x1,x2,...
               all,conn,rcpt,bounce,msgs,vol,svc
        -l   : period of interest - default value : 10m
               period shall be smaller than 20m - default unit : s
        -n N : max number of records to print
    j-printstats -q [-l dt [s|m|h|d]] [[-v | ip | hostname] | [-m x]]
        -q   : query gateway activity
        -l   : period of interest - default unit : secs
        -v   : verbose - meaninful only if gateway not specified
               prints summary for each client gateway
        -m x : select type of summary
               x = s  : Connection summary
               x = e  : Client doing empty connections
               x = re : Client doing empty connections - reject
               x = ro : Too much open connections - reject
               x = rt : Connection rate too high - reject
               x = rb : Too many bad recipients - reject
               x = rg : Clients with messages rejected by greylisting
               x = r  : Clients with bad DNS resolution
               x = rr : Clients with bad DNS resolution - reject
               x = c  : Clients being rejected by content checking
               x = x  : Clients sending X-Files or Virus
               x = rm : Messages with BAD MX for sender domain
               x = st : Clients sending messages to SpamTraps
        -n N : max number of records to print

j-scanfile

Usage : j-scanfile [-h] [-c] [-v] file file file...
  Joe's j-chkmail v1.12.0-070729
  Compiled on Jul 29 2007 22:44:51
        -h : help
        -c : configuration file
        -v : verbose

j-message-tbx

Usage : j-check-message options
        -c file
           configuration file (default : /etc/mail/jchkmail/j-chkmail.cf)
        -m checks
           where checks is a list of comma separated checks :
               oracle, regex, urlbl, bayes or all
        -l log_level
        -t file type
           where file type tells how messages are arranged inside args
           mbox - each argument is a mailbox file with many messages
           file - each argument is a file with one message
           maildir - each argument is a directory with files inside

j-bayes-tbx

Usage : j-bayes-tbx [ -h | -c options | -l options]
  -h   : help message (you're reading it...)
  -c   : check message/mailbox spamicity
         Check options
         -b file       : tokens database
         -t N          : number of tokens
         -u prob       : probability associated to unknown tokens
         -x            : show histogram of scores
  -l   : learn message/mailbox
         Learn options
         -s            : message/mbox is spam
         General options
         -f flag,flag  : tokenizer flags
         -p            : don't show progress
         -v            : verbose
         -M size       : max single message size

j-logserver

Usage : j-logserver options
    -h       : This screen
    -i       : IP address to bind (default is all addresses)
    -p       : port to listen

Other utilities

Not installed but available in the source directory:

j-grey-testtest greylisting
j-policy-testtest policy file
j-rcpt-testtest recipient checking
mx0:~/jchkmail/jchkmail-1.12.0-080204/src# ./j-rcpt-test -t fred@univmed.fr -i 1.2.3.4 -h toto
Client IP address : 1.2.3.4
Client hostname   : toto
Recipient         : fred@univmed.fr
Client NET class  : 00 UNKNOWN
RESULT            =  5 User Unknown
mx0:~/jchkmail/jchkmail-1.12.0-080204/src# ./j-policy-test NetClass 194.214.99.4 toto.fr spam@spam.com fre@univ.fr
Checking = NetClass 194.214.99.4
RESULT = domain - YES
doc/reference/command_line_tools.txt · Last modified: 2008/04/11 21:52 by martins
chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0