Skip to content

Optionally disable ssl certificate validity check.#9181

Merged
andrey-git merged 5 commits into
home-assistant:devfrom
ohmer1:xmpp_no_cert_verify
Sep 6, 2017
Merged

Optionally disable ssl certificate validity check.#9181
andrey-git merged 5 commits into
home-assistant:devfrom
ohmer1:xmpp_no_cert_verify

Conversation

@ohmer1
Copy link
Copy Markdown
Contributor

@ohmer1 ohmer1 commented Aug 28, 2017

Description:

Optionally disable SSL certificate validity check. Allow to connect to a TLS enabled server using a self signed certificate. By default, the verification is still done. The user need to add the parameter verify: false to disable the certificate validity check.

Example entry for configuration.yaml (if applicable):

notify:
  - name: xmpp
    platform: xmpp
    sender: hass@example.com
    password: pa$$w0rd
    recipient: user@example.com
    verify: false

Checklist:

If user exposed functionality or configuration variables are added/changed:

@mention-bot
Copy link
Copy Markdown

@ohmer1, thanks for your PR! By analyzing the history of the files in this pull request, we identified @fabaff, @balloob and @pvizeli to be potential reviewers.

@homeassistant
Copy link
Copy Markdown
Contributor

Hi @ohmer1,

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

Comment thread homeassistant/components/notify/xmpp.py Outdated
self.add_event_handler('failed_auth', self.check_credentials)
self.add_event_handler('session_start', self.start)
if not verify_certificate:
self.add_event_handler('ssl_invalid_cert', self.discard_ssl_invalid_cert)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (89 > 79 characters)

Comment thread homeassistant/components/notify/xmpp.py Outdated


def send_message(sender, password, recipient, use_tls, message):
def send_message(sender, password, recipient, use_tls, verify_certificate, message):
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (84 > 79 characters)

Comment thread homeassistant/components/notify/xmpp.py Outdated
self.add_event_handler('session_start', self.start)
if not verify_certificate:
self.add_event_handler('ssl_invalid_cert',
self.discard_ssl_invalid_cert)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

continuation line under-indented for visual indent

Comment thread homeassistant/components/notify/xmpp.py Outdated
self.add_event_handler('failed_auth', self.check_credentials)
self.add_event_handler('session_start', self.start)
if not verify_certificate:
self.add_event_handler('ssl_invalid_cert',
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trailing whitespace

Comment thread homeassistant/components/notify/xmpp.py Outdated

def send_message(sender, password, recipient, use_tls, message):
def send_message(sender, password, recipient, use_tls,
verify_certificate, message):
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

continuation line under-indented for visual indent

Comment thread homeassistant/components/notify/xmpp.py Outdated


def send_message(sender, password, recipient, use_tls, message):
def send_message(sender, password, recipient, use_tls,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trailing whitespace

@ohmer1
Copy link
Copy Markdown
Contributor Author

ohmer1 commented Sep 1, 2017

Well the CI is failing because of "R: 99, 8: Method could be a function (no-self-use)". But if I remove the unused parameters, the code throw an exception/error in the logs because the code is calling the function with two parameters but the function definition don't have any parameters. Even if an error is displaying in the logs, the code "work" in the sense that it allow to connect to a server using a self-signed certificate.

Probably a very simple issue, but my Python skills are not very high. I would appreciate some help! :)

Thanks!

@andrey-git
Copy link
Copy Markdown
Contributor

@ohmer1 Try to add @staticmethod decorator to the function

@andrey-git andrey-git merged commit 5971a7c into home-assistant:dev Sep 6, 2017
@balloob balloob mentioned this pull request Sep 7, 2017
@home-assistant home-assistant locked and limited conversation to collaborators Dec 11, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants