-
Notifications
You must be signed in to change notification settings - Fork 26
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
Fixes #34667 - Add SSL support when connecting to mqtt broker #75
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,11 +82,20 @@ def mqtt_start(otp_password) | |
end | ||
|
||
def mqtt_notify(payload) | ||
MQTT::Client.connect(settings.mqtt_broker, settings.mqtt_port) do |c| | ||
with_mqtt_client do |c| | ||
c.publish(mqtt_topic, JSON.dump(payload), false, 1) | ||
end | ||
end | ||
|
||
def with_mqtt_client(&block) | ||
MQTT::Client.connect(settings.mqtt_broker, settings.mqtt_port, | ||
:ssl => settings.mqtt_tls, | ||
:cert_file => ::Proxy::SETTINGS.ssl_certificate, | ||
:key_file => ::Proxy::SETTINGS.ssl_private_key, | ||
:ca_file => ::Proxy::SETTINGS.ssl_ca_file, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have been thinking about certificates and this raises a good question: should we use the smart-proxy server certificates or the foreman client certificates ( A few things to consider with this.
And then there is the dragon scenarios:
That leads in to what certificates should we configure mosquitto with: ones derived only from the default CA or the same server certificates running the smart-proxy? Foreman has a similar scenario if the user is using Puppet certificates but has opted to provide the smart-proxy with server certificates from a different CA. @ekohl @evgeni your thoughts are appreciated, apologies for any headaches this may cause There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is one of the headaches I already had (thanks to a very special tree). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Switched to client certs |
||
&block) | ||
end | ||
|
||
def host_name | ||
alternative_names = input.fetch(:alternative_names, {}) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,8 @@ | |
# MQTT configuration, need to be set if mode is set to pull-mqtt | ||
# :mqtt_broker: localhost | ||
# :mqtt_port: 1883 | ||
|
||
# Use of SSL can be forced either way by explicitly setting mqtt_tls setting. If | ||
# unset, SSL gets used if smart-proxy's ssl_certificate, ssl_private_key and | ||
# ssl_ca_file settings are set available. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this also need updating if using client certificates? |
||
# :mqtt_tls: |
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.
I think this line needs updating with change to client certificates.