-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Suppress InsecureRequestWarning when verify_ssl is False for camera.synology #9777
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -44,6 +44,11 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None): | |||
verify_ssl = config.get(CONF_VERIFY_SSL) | |||
timeout = config.get(CONF_TIMEOUT) | |||
|
|||
if not verify_ssl: | |||
from requests.packages import urllib3 | |||
_LOGGER.warning('InsecureRequestWarning is disabled for camera.synology platform') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (90 > 79 characters)
Also updated CODEOWNERS file as suggested by @andrey-git in #9754 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is dangerous and something that you really want to avoid as it has global implications.
if not verify_ssl: | ||
from requests.packages import urllib3 | ||
_LOGGER.warning('InsecureRequestWarning is disabled for camera.synology platform') | ||
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem with this is you are disabling ALL warnings for urllib3 across the system. That means things like connections to other web services apis also get disabled. This is really not the right way to do that.
I close this while we want do that. Please change your synology settup to work with correct certificate or life with that warnings. |
Description:
camera.synology is spewing logs like this:
I'm guessing most users are running synology surveillance camera without valid SSL certificate, so this is annoying. The change made is that if user specifically turned off ssl_verify, then we should suppress InsecureRequestWarning as well
Checklist:
tox
run successfully. Your PR cannot be merged unless tests pass