[issue-4] [add] parameter:port
This commit is contained in:
parent
3e0721820c
commit
88d12eb88f
|
|
@ -17,7 +17,7 @@
|
||||||
"checks.file_state.timestamp_implausible": "Datei ist scheinbar aus der Zukunft",
|
"checks.file_state.timestamp_implausible": "Datei ist scheinbar aus der Zukunft",
|
||||||
"checks.file_state.too_old": "Datei ist zu alt",
|
"checks.file_state.too_old": "Datei ist zu alt",
|
||||||
"checks.file_state.too_big": "Datei ist zu groß",
|
"checks.file_state.too_big": "Datei ist zu groß",
|
||||||
"checks.tls_certificate.not_obtainable": "TLS-Zertifikat nicht abrufbar; evtl. bereits augelaufen",
|
"checks.tls_certificate.not_obtainable": "TLS-Zertifikat nicht abrufbar; evtl. bereits ausgelaufen",
|
||||||
"checks.tls_certificate.expires_soon": "TLS-Zertifikat läuft bald aus",
|
"checks.tls_certificate.expires_soon": "TLS-Zertifikat läuft bald aus",
|
||||||
"checks.generic_remote.overflow": "Laufwerk fast voll",
|
"checks.generic_remote.overflow": "Laufwerk fast voll",
|
||||||
"checks.http_request.request_failed": "HTTP-Abfrage fehlgeschlagen",
|
"checks.http_request.request_failed": "HTTP-Abfrage fehlgeschlagen",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
'''
|
'''
|
||||||
todo: allow_self_signed
|
todo: allow_self_signed
|
||||||
todo: allow_bad_domain
|
todo: allow_bad_domain
|
||||||
|
todo:
|
||||||
'''
|
'''
|
||||||
class implementation_check_kind_tls_certificate(interface_check_kind):
|
class implementation_check_kind_tls_certificate(interface_check_kind):
|
||||||
|
|
||||||
|
|
@ -15,6 +16,10 @@ class implementation_check_kind_tls_certificate(interface_check_kind):
|
||||||
"host": {
|
"host": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"port": {
|
||||||
|
"type": "integer",
|
||||||
|
"default": 443
|
||||||
|
},
|
||||||
"strict": {
|
"strict": {
|
||||||
"description": "whether a violation of this check shall be leveled as critical instead of concerning",
|
"description": "whether a violation of this check shall be leveled as critical instead of concerning",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
|
|
@ -43,6 +48,7 @@ class implementation_check_kind_tls_certificate(interface_check_kind):
|
||||||
return dict_merge(
|
return dict_merge(
|
||||||
{
|
{
|
||||||
"strict": True,
|
"strict": True,
|
||||||
|
"port": 443,
|
||||||
"expiry_threshold": 7,
|
"expiry_threshold": 7,
|
||||||
# "allow_self_signed": False,
|
# "allow_self_signed": False,
|
||||||
# "allow_bad_domain": False,
|
# "allow_bad_domain": False,
|
||||||
|
|
@ -58,7 +64,7 @@ class implementation_check_kind_tls_certificate(interface_check_kind):
|
||||||
def run(self, parameters):
|
def run(self, parameters):
|
||||||
context = _ssl.create_default_context()
|
context = _ssl.create_default_context()
|
||||||
try:
|
try:
|
||||||
socket = _socket.create_connection((parameters["host"], 443, ))
|
socket = _socket.create_connection((parameters["host"], parameters["port"], ))
|
||||||
socket_wrapped = context.wrap_socket(socket, server_hostname = parameters["host"])
|
socket_wrapped = context.wrap_socket(socket, server_hostname = parameters["host"])
|
||||||
version = socket_wrapped.version()
|
version = socket_wrapped.version()
|
||||||
data = socket_wrapped.getpeercert(False)
|
data = socket_wrapped.getpeercert(False)
|
||||||
|
|
@ -74,6 +80,7 @@ class implementation_check_kind_tls_certificate(interface_check_kind):
|
||||||
),
|
),
|
||||||
"info": {
|
"info": {
|
||||||
"host": parameters["host"],
|
"host": parameters["host"],
|
||||||
|
"port": parameters["port"],
|
||||||
"faults": [
|
"faults": [
|
||||||
translation_get("checks.tls_certificate.not_obtainable"),
|
translation_get("checks.tls_certificate.not_obtainable"),
|
||||||
],
|
],
|
||||||
|
|
@ -95,6 +102,7 @@ class implementation_check_kind_tls_certificate(interface_check_kind):
|
||||||
),
|
),
|
||||||
"info": {
|
"info": {
|
||||||
"host": parameters["host"],
|
"host": parameters["host"],
|
||||||
|
"port": parameters["port"],
|
||||||
"faults": [
|
"faults": [
|
||||||
translation_get("checks.tls_certificate.expires_soon"),
|
translation_get("checks.tls_certificate.expires_soon"),
|
||||||
],
|
],
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue