Pyng: SWAKS check
Description
SWAKS check provides access
to Swaks
– Swiss Army Knife for SMTP. Swaks is a featureful,
flexible, scriptable, transaction-oriented SMTP test tool.
SWAKS requires swaks command to be
present in $PATH.
Options
SWAKS supports following options, which may be used upon creation
of a new check object:
- host
-
Target server (required)
- port
-
Target port (required)
- ipv
-
IP version to use when resolving addresses (IPv6 or IPv4)
- ehlo
-
EHLO argument
- pipeline
-
Set to True to attempt SMTP PIPELINING (RFC 2920)
- starttls
-
Set to True to require connection to use STARTTLS
- try_starttls
-
Set to True to attempt connection to use STARTTLS, if available
- connect_tls
-
Set to True to use TLS immediately on connection
- tls_sni
-
Server Name Indication field to send when the TLS connection is initiated
- tls_protocols
-
Allowed TLS protocols
- tls_ciphers
-
Allowed TLS ciphers
- tls_verify
-
Set to True to verify the server's TLS certificate
- tls_verify_cert
-
Set to True to verify that the server's TLS
certificate is signed by a known certificate authority and is not
expired
- tls_verify_host
-
Set to True to verify that the server's TLS
certificate includes the name used to connect to the target
server
- tls_match_name
-
Name to match in the server's TLS certificate
- auth
-
Set to True to require SMTP authentication
- try_auth
-
Set to True to attempt SMTP authentication
- auth_username
-
Username to be used for authentication
- auth_password
-
Password to be used for authentication
- auth_extra
-
Extra information to be included in the authentication process
- quit_after
-
Point at which the SMTP transaction should be stopped
- mail_from
-
Envelope sender for the message
- rcpt_to
- rcpt_cc
- rcpt_bcc
-
Envelope recipients for the message
- subject
-
Message subject
- headers
-
List of header: value message header pairs
- body
-
Message body
- data
-
DATA argument
In addition, SWAKS supports following generic check settings:
- desc
-
Check description
- silent
-
Information about check runs is not output by certain runners
- interval
-
Number of seconds between check runs
- result
-
Require that check output matches result in order to
consider check successful. During the matching, check output is
evaluated as a list of lines of output without
newlines. result may be provided in multiple
ways:
-
None: always succeeds
-
string: succeeds if any line in the check's output
is equal to, or contains, result
-
list or a tuple: succeeds if all
elements of result are present in the check's
output (i.e. set of result items is a subset of
check output items)
-
set: succeeds if all lines in the check's
output are present in result (i.e. check output
is a subset of the set of result items)
-
Compiled regular expression object: succeeds if any
line in the check's output matches result
- alert
-
Callable (or a list of callables) to run in order to alert of
check status changes
- notify
-
Callable (or a list of callables) to run in order to notify of
changes in check's output
- run_condition
-
Callable to run to decide if check run should be skipped
- run_threshold
-
Threshold for mean run time in order to consider check to be
degraded
- result_filter
-
Callable to run to filter check command output lines prior to
matching check results
- on_result
- on_first
- on_up
- on_down
- on_degrade
- on_restore
- on_change
-
Callable to run with the result of the check on the specified
events
Example
SWAKS(
'smtp.fastmail.com', 587,
starttls=True,
ehlo='there',
quit_after='EHLO',
)
Return to Pyng