| | 52 | <parameter name="starttls" required="optional" default="false" |
|---|
| | 53 | allowed="(?:true|false)">Specified if the client should attempt a STARTTLS upgrade</parameter> |
|---|
| | 54 | <parameter name="ca_chain" |
|---|
| | 55 | required="optional" |
|---|
| | 56 | allowed=".+">A path to a file containing all the certificate authorities that should be loaded to validate the remote certificate (for SSL checks).</parameter> |
|---|
| | 57 | <parameter name="certificate_file" |
|---|
| | 58 | required="optional" |
|---|
| | 59 | allowed=".+">A path to a file containing the client certificate that will be presented to the remote server (for SSL checks).</parameter> |
|---|
| | 60 | <parameter name="key_file" |
|---|
| | 61 | required="optional" |
|---|
| | 62 | allowed=".+">A path to a file containing key to be used in conjunction with the cilent certificate (for SSL checks).</parameter> |
|---|
| | 63 | <parameter name="ciphers" |
|---|
| | 64 | required="optional" |
|---|
| | 65 | allowed=".+">A list of ciphers to be used in the SSL protocol (for SSL checks).</parameter> |
|---|
| 153 | | if action("banner", nil, 220) |
|---|
| 154 | | and action("ehlo", ehlo, 250) |
|---|
| 155 | | and action("mailfrom", mailfrom, 250) |
|---|
| | 171 | |
|---|
| | 172 | if not action("banner", nil, 220) |
|---|
| | 173 | or not action("ehlo", ehlo, 250) then return end |
|---|
| | 174 | |
|---|
| | 175 | if try_starttls then |
|---|
| | 176 | local starttls = action("starttls", "STARTTLS", 220) |
|---|
| | 177 | e:ssl_upgrade_socket(check.config.certificate_file, check.config.key_file, |
|---|
| | 178 | check.config.ca_chain, check.config.ciphers) |
|---|
| | 179 | |
|---|
| | 180 | local ssl_ctx = e:ssl_ctx() |
|---|
| | 181 | if ssl_ctx ~= nil then |
|---|
| | 182 | if ssl_ctx.error ~= nil then status = status .. ',sslerror' end |
|---|
| | 183 | check.metric_string("cert_error", ssl_ctx.error) |
|---|
| | 184 | check.metric_string("cert_issuer", ssl_ctx.issuer) |
|---|
| | 185 | check.metric_string("cert_subject", ssl_ctx.subject) |
|---|
| | 186 | check.metric_uint32("cert_start", ssl_ctx.start_time) |
|---|
| | 187 | check.metric_uint32("cert_end", ssl_ctx.end_time) |
|---|
| | 188 | check.metric_uint32("cert_end_in", ssl_ctx.end_time - os.time()) |
|---|
| | 189 | if noit.timeval.seconds(starttime) > ssl_ctx.end_time then |
|---|
| | 190 | good = false |
|---|
| | 191 | status = status .. ',ssl=expired' |
|---|
| | 192 | end |
|---|
| | 193 | end |
|---|
| | 194 | |
|---|
| | 195 | if not action("ehlo", ehlo, 250) then return end |
|---|
| | 196 | end |
|---|
| | 197 | |
|---|
| | 198 | if action("mailfrom", mailfrom, 250) |
|---|