diff --git a/README.md b/README.md index acbec62..30934ff 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,8 @@ If you're using SSL, set the paths to your SSL files here. This is similar to th The configurator fetches some data from your running HASS instance. If the API isn't available through the default URL, modify this variable to fix this. #### HASS_API_PASSWORD (string) If you plan on using the restart button, you have to set your API password. Calling the restart service of HASS is prohibited without authentication. +#### IGNORE_SSL (bool) +Set IGNORE_SSL to `True` to disable SSL verification when connecting to the Home Assistant API (while fetching entities etc., not in your browser). This is useful if Home Assistant is configured with SSL, but the configurator accesses it via IP, in which case SSL verification will fail. #### USERNAME (string) If you want to enable [HTTP basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) you can set the desired username here. The `:` character is not allowed. #### PASSWORD (string) diff --git a/changelog.txt b/changelog.txt index 5e25160..4944c45 100644 --- a/changelog.txt +++ b/changelog.txt @@ -12,6 +12,7 @@ Version 0.3.0 (2018-) - LISTENPORT has been renamed to PORT (LISTENPORT still works though) - Hiding git menu when git is disabled @danielperna84 - Removed right dragging area for editor settings (Issue #102) @danielperna84 +- Added IGNORE_SSL option to disables SSL verification when connecting to HASS API @danielperna84 Version 0.2.9 (2018-06-22) - Material Icons and HASS-help now open in new tab instead of modal (Issues #85 and #34) @danielperna84 diff --git a/configurator.py b/configurator.py index 383a8b8..4727d3e 100755 --- a/configurator.py +++ b/configurator.py @@ -25,7 +25,6 @@ from http.server import BaseHTTPRequestHandler import urllib.request from urllib.parse import urlparse, parse_qs, unquote - ### Some options for you to change LISTENIP = "0.0.0.0" PORT = 3218 @@ -78,6 +77,8 @@ SESAME_TOTP_SECRET = None VERIFY_HOSTNAME = None # Prefix for environment variables ENV_PREFIX = "HC_" +# Ignore SSL errors when connecting to the HASS API +IGNORE_SSL = False # Notification service like `notify.mytelegram`. Default is `persistent_notification.create` NOTIFY_SERVICE_DEFAULT = "persistent_notification.create" NOTIFY_SERVICE = NOTIFY_SERVICE_DEFAULT @@ -3429,7 +3430,7 @@ def load_settings(settingsfile): HASS_API_PASSWORD, CREDENTIALS, ALLOWED_NETWORKS, BANNED_IPS, BANLIMIT, \ DEV, IGNORE_PATTERN, DIRSFIRST, SESAME, VERIFY_HOSTNAME, ENFORCE_BASEPATH, \ ENV_PREFIX, NOTIFY_SERVICE, USERNAME, PASSWORD, SESAME_TOTP_SECRET, TOTP, \ - GIT, REPO, PORT + GIT, REPO, PORT, IGNORE_SSL settings = {} if settingsfile: try: @@ -3484,6 +3485,10 @@ def load_settings(settingsfile): SESAME_TOTP_SECRET = settings.get("SESAME_TOTP_SECRET", SESAME_TOTP_SECRET) VERIFY_HOSTNAME = settings.get("VERIFY_HOSTNAME", VERIFY_HOSTNAME) NOTIFY_SERVICE = settings.get("NOTIFY_SERVICE", NOTIFY_SERVICE_DEFAULT) + IGNORE_SSL = settings.get("IGNORE_SSL", IGNORE_SSL) + if IGNORE_SSL: + # pylint: disable=protected-access + ssl._create_default_https_context = ssl._create_unverified_context USERNAME = settings.get("USERNAME", USERNAME) PASSWORD = settings.get("PASSWORD", PASSWORD) if CREDENTIALS and (USERNAME is None or PASSWORD is None): diff --git a/settings.conf b/settings.conf index 59492e3..7b295ee 100644 --- a/settings.conf +++ b/settings.conf @@ -6,6 +6,7 @@ "ENFORCE_BASEPATH": false, "SSL_CERTIFICATE": null, "SSL_KEY": null, + "IGNORE_SSL": false, "HASS_API": "http://127.0.0.1:8123/api/", "HASS_API_PASSWORD": null, "USERNAME": null,