| 1 |
% RSPAMC(1) Rspamd User Manual |
| 2 |
|
| 3 |
# NAME |
| 4 |
|
| 5 |
`rspamc` - rspamd command line client |
| 6 |
|
| 7 |
# SYNOPSIS |
| 8 |
|
| 9 |
rspamc [*options*] [*command*] [*input-file*]... |
| 10 |
|
| 11 |
rspamc --help |
| 12 |
|
| 13 |
# DESCRIPTION |
| 14 |
|
| 15 |
`rspamc` is a simple rspamd client, primarily for classifying or learning messages. |
| 16 |
`rspamc` supports the following commands: |
| 17 |
|
| 18 |
* Scan commands: |
| 19 |
* `symbols`: scan message and show symbols (default command) |
| 20 |
* Control commands |
| 21 |
* `learn_spam`: learn message as spam |
| 22 |
* `learn_ham`: learn message as ham |
| 23 |
* `fuzzy_add`: add message to fuzzy storage (check `-f` and `-w` options for this command) |
| 24 |
* `fuzzy_del`: delete message from fuzzy storage (check `-f` option for this command) |
| 25 |
* `stat`: show rspamd statistics |
| 26 |
* `stat_reset`: show and reset rspamd statistics (useful for graphs) |
| 27 |
* `counters`: display rspamd symbols statistics |
| 28 |
* `uptime`: show rspamd uptime |
| 29 |
* `add_symbol`: add or modify symbol settings in rspamd |
| 30 |
* `add_action`: add or modify action settings |
| 31 |
|
| 32 |
Control commands that modify rspamd state are considered privileged and require a password to be specified with the `-P` option (see **OPTIONS**, below, for details). |
| 33 |
This depends on a controller's settings and is discussed in the `rspamd-workers` page (see **SEE ALSO**, below, for details). |
| 34 |
|
| 35 |
`Input files` may be either regular file(s) or a directory to scan. If no files are specified `rspamc` reads |
| 36 |
from the standard input. Controller commands usually do not accept any input, however learn* and fuzzy* commands |
| 37 |
requires input. |
| 38 |
|
| 39 |
# OPTIONS |
| 40 |
|
| 41 |
-h *host[:port]*, \--connect=*host[:port]* |
| 42 |
: Specify host and port |
| 43 |
|
| 44 |
-P *password*, \--password=*password* |
| 45 |
: Specify control password. Can be an absolute or relative path, in which case the password will be read from that file. |
| 46 |
|
| 47 |
-c *name*, \--classifier=*name* |
| 48 |
: Classifier to learn spam or ham (bayes is used by default) |
| 49 |
|
| 50 |
-w *weight*, \--weight=*weight* |
| 51 |
: Weight for fuzzy operations |
| 52 |
|
| 53 |
-f *number*, \--flag=*number* |
| 54 |
: Flag for fuzzy operations |
| 55 |
|
| 56 |
-p, \--pass |
| 57 |
: Pass all filters |
| 58 |
|
| 59 |
-v, \--verbose |
| 60 |
: More verbose output |
| 61 |
|
| 62 |
-i *ip address*, \--ip=*ip address* |
| 63 |
: Emulate that message was received from specified ip address |
| 64 |
|
| 65 |
-u *username*, \--user=*username* |
| 66 |
: Emulate that message was received from specified authenticated user |
| 67 |
|
| 68 |
-d *user@domain*, \--deliver=*user@domain* |
| 69 |
: Emulate that message was delivered to specified user (for LDA/statistics) |
| 70 |
|
| 71 |
-F *user@domain*, \--from=*user@domain* |
| 72 |
: Emulate that message has specified SMTP FROM address |
| 73 |
|
| 74 |
-r *user@domain*, \--rcpt=*user@domain* |
| 75 |
: Emulate that message has specified SMTP RCPT address |
| 76 |
|
| 77 |
\--helo=*helo_string* |
| 78 |
: Imitate SMTP HELO passing from MTA |
| 79 |
|
| 80 |
\--hostname=*hostname* |
| 81 |
: Imitate hostname passing from MTA (rspamd assumes that it is verified by MTA) |
| 82 |
|
| 83 |
-t *seconds*, \--timeout=*seconds* |
| 84 |
: Timeout for waiting for a reply (can be floating point number, e.g. 0.1) |
| 85 |
|
| 86 |
-b *host:port*, \--bind=*host:port* |
| 87 |
: Bind to specified ip address |
| 88 |
|
| 89 |
-R, \--human |
| 90 |
: Output human readable report. The first line of the output contains the message score and three threshold scores, in this format: |
| 91 |
: score/greylist/addheader/reject,action=N:ACTION,spam=0|1,skipped=0|1 |
| 92 |
|
| 93 |
-j, \--json |
| 94 |
: Output formatted JSON |
| 95 |
|
| 96 |
\--ucl |
| 97 |
: Output UCL |
| 98 |
|
| 99 |
\--raw |
| 100 |
: Output raw data received from rspamd (compacted JSON) |
| 101 |
|
| 102 |
\--headers |
| 103 |
: Output HTTP headers from a reply |
| 104 |
|
| 105 |
\--extended-urls |
| 106 |
: Output URLs in an extended format, showing full URL, host and the part of host that was used by surbl module (if enabled). |
| 107 |
|
| 108 |
-n *parallel_count*, \--max-requests=*parallel_count* |
| 109 |
: Maximum number of requests to rspamd executed in parallel (8 by default) |
| 110 |
|
| 111 |
-e *command*, \--execute=*command* |
| 112 |
: Execute the specified command with either mime output (if `mime` option is also specified) or formatted rspamd output |
| 113 |
|
| 114 |
\--mime |
| 115 |
: Output the full mime message instead of scanning results only |
| 116 |
|
| 117 |
\--header=*header* |
| 118 |
: Add custom HTTP header for a request. You may specify header in format `name=value` or just `name` for an empty header. This option can be repeated multiple times. |
| 119 |
|
| 120 |
\--sort=*type* |
| 121 |
: Sort output according to a specific field. For `counters` command the allowed values for this key are `name`, `weight`, `frequency` and `hits`. Appending `:asc` to any of these types inverts sorting order. |
| 122 |
|
| 123 |
\--commands |
| 124 |
: List available commands |
| 125 |
|
| 126 |
# RETURN VALUE |
| 127 |
|
| 128 |
On exit `rspamc` returns `0` if operation was successful and an error code otherwise. |
| 129 |
|
| 130 |
# EXAMPLES |
| 131 |
|
| 132 |
Check stdin: |
| 133 |
|
| 134 |
rspamc < some_file |
| 135 |
|
| 136 |
Check files: |
| 137 |
|
| 138 |
rspamc symbols file1 file2 file3 |
| 139 |
|
| 140 |
Learn files: |
| 141 |
|
| 142 |
rspamc -P pass learn_spam file1 file2 file3 |
| 143 |
|
| 144 |
Add fuzzy hash to set 2: |
| 145 |
|
| 146 |
rspamc -P pass -f 2 -w 10 fuzzy_add file1 file2 |
| 147 |
|
| 148 |
Delete fuzzy hash from other server: |
| 149 |
|
| 150 |
rspamc -P pass -h hostname:11334 -f 2 fuzzy_del file1 file2 |
| 151 |
|
| 152 |
Get statistics: |
| 153 |
|
| 154 |
rspamc stat |
| 155 |
|
| 156 |
Get uptime: |
| 157 |
|
| 158 |
rspamc uptime |
| 159 |
|
| 160 |
Add custom rule's weight: |
| 161 |
|
| 162 |
rspamc add_symbol test 1.5 |
| 163 |
|
| 164 |
Add custom action's weight: |
| 165 |
|
| 166 |
rspamc add_action reject 7.1 |
| 167 |
|
| 168 |
# SEE ALSO |
| 169 |
|
| 170 |
Rspamd documentation and source code may be downloaded from |
| 171 |
<https://rspamd.com/>. |
| 172 |
|
| 173 |
[rspamd-workers]: https://rspamd.com/doc/workers/ |