Command Line Interface

Description

aiospamc is the command line interface for the SpamAssassin client.

It provides common actions to interact with the SpamAssassin server.

Global Options

--version

Print the version of aiospamc to the console.

--debug

Enable debug logging.

Commands

check [MESSAGE]

Sends message to SpamAssassin and prints the score if there is any.

If no message is given then it will read from stdin.

The exit code will be 0 if the message is ham and 1 if it’s spam.

-h, --host HOSTNAME

Hostname or IP address of the server.

-p, --port PORT

Port number of the server.

--socket-path PATH

Path to UNIX domain socket.

--ssl

Enables or disables SSL when using a TCP connection. Will use the system’s root certificates by default.

--ca-cert PATH

Path to certificate authority file or path. Overrides the default path.

--client-cert PATH

Filename for the client certificate.

--client-key PATH

Filename for the client certificate key. Specify this if this isn’t included in the client certificate.

--key-password

Password for the client certificate key if encrypted.

--user USERNAME

User to send the request as.

--timeout SECONDS

Set the connection timeout. Default is 10 seconds.

--out [json|text]

Choose the output format to the console. text will print human friendly output. json will display JSON formatted output with keys for request, response, and exit_code. Default is text.

forget [MESSAGE]

Forgets the classification of a message.

-h, --host HOSTNAME

Hostname or IP address of the server.

-p, --port PORT

Port number of the server.

--socket-path PATH

Path to UNIX domain socket.

--ssl

Enables or disables SSL when using a TCP connection. Will use the system’s root certificates by default.

--ca-cert PATH

Path to certificate authority file or path. Overrides the default path.

--client-cert PATH

Filename for the client certificate.

--client-key PATH

Filename for the client certificate key. Specify this if this isn’t included in the client certificate.

--key-password

Password for the client certificate key if encrypted.

--user USERNAME

User to send the request as.

--timeout SECONDS

Set the connection timeout. Default is 10 seconds.

--out [json|text]

Choose the output format to the console. text will print human friendly output. json will display JSON formatted output with keys for request, response, and exit_code. Default is text.

learn [MESSAGE]

Ask SpamAssassin to learn the message as spam or ham.

-h, --host HOSTNAME

Hostname or IP address of the server.

-p, --port PORT

Port number of the server.

--socket-path PATH

Path to UNIX domain socket.

--ssl

Enables or disables SSL when using a TCP connection. Will use the system’s root certificates by default.

--ca-cert PATH

Path to certificate authority file or path. Overrides the default path.

--client-cert PATH

Filename for the client certificate.

--client-key PATH

Filename for the client certificate key. Specify this if this isn’t included in the client certificate.

--key-password

Password for the client certificate key if encrypted.

--user USERNAME

User to send the request as.

--timeout SECONDS

Set the connection timeout. Default is 10 seconds.

--out [json|text]

Choose the output format to the console. text will print human friendly output. json will display JSON formatted output with keys for request, response, and exit_code. Default is text.

ping

Pings SpamAssassin and prints the response.

An exit code of 0 is successful, 1 is not successful.

-h, --host HOSTNAME

Hostname or IP address of the server.

-p, --port PORT

Port number of the server.

--socket-path PATH

Path to UNIX domain socket.

--ssl

Enables or disables SSL when using a TCP connection. Will use the system’s root certificates by default.

--ca-cert PATH

Path to certificate authority file or path. Overrides the default path.

--client-cert PATH

Filename for the client certificate.

--client-key PATH

Filename for the client certificate key. Specify this if this isn’t included in the client certificate.

--key-password

Password for the client certificate key if encrypted.

--user USERNAME

User to send the request as.

--timeout SECONDS

Set the connection timeout. Default is 10 seconds.

--out [json|text]

Choose the output format to the console. text will print human friendly output. json will display JSON formatted output with keys for request, response, and exit_code. Default is text.

report [MESSAGE]

Report a message to collaborative filtering databases as spam.

If reporting fails will exit with a code of 1.

-h, --host HOSTNAME

Hostname or IP address of the server.

-p, --port PORT

Port number of the server.

--socket-path PATH

Path to UNIX domain socket.

--ssl

Enables or disables SSL when using a TCP connection. Will use the system’s root certificates by default.

--ca-cert PATH

Path to certificate authority file or path. Overrides the default path.

--client-cert PATH

Filename for the client certificate.

--client-key PATH

Filename for the client certificate key. Specify this if this isn’t included in the client certificate.

--key-password

Password for the client certificate key if encrypted.

--user USERNAME

User to send the request as.

--timeout SECONDS

Set the connection timeout. Default is 10 seconds.

--out [json|text]

Choose the output format to the console. text will print human friendly output. json will display JSON formatted output with keys for request, response, and exit_code. Default is text.

revoke [MESSAGE]

Revoke a message to collaborative filtering databases.

If revoking fails will exit with a code of 1.

-h, --host HOSTNAME

Hostname or IP address of the server.

-p, --port PORT

Port number of the server.

--socket-path PATH

Path to UNIX domain socket.

--ssl

Enables or disables SSL when using a TCP connection. Will use the system’s root certificates by default.

--ca-cert PATH

Path to certificate authority file or path. Overrides the default path.

--client-cert PATH

Filename for the client certificate.

--client-key PATH

Filename for the client certificate key. Specify this if this isn’t included in the client certificate.

--key-password

Password for the client certificate key if encrypted.

--user USERNAME

User to send the request as.

--timeout SECONDS

Set the connection timeout. Default is 10 seconds.

--out [json|text]

Choose the output format to the console. text will print human friendly output. json will display JSON formatted output with keys for request, response, and exit_code. Default is text.

Environment Variables

AIOSPAMC_CERT_FILE

Path to the file containing trusted certificates. These will be used in place of the default root certificates when using the --ssl option.

Exit Codes

3 - Error occurred when parsing response. 4 - Network timeout. 5 - Connection error. Check the host, port, or socket path. 6 - Unexpected error. 7 - Could not open the message.