NAME

Net::MQTT::Simple::SSL - Minimal MQTT version 3 interface with SSL support

SYNOPSIS

# Specifying SSL parameters in environment variables

export MQTT_SIMPLE_SSL_CA=/etc/ssl/ca.crt
export MQTT_SIMPLE_SSL_CERT=/etc/ssl/mqtt.crt
export MQTT_SIMPLE_SSL_KEY=/etc/ssl/mqtt.key

perl -MNet::MQTT::Simple::SSL=mosquitto.example.org \
     -nle'retain "topic/here" => $_'


# Specifying explicit SSL parameters

use Net::MQTT::Simple::SSL;

my $mqtt = Net::MQTT::Simple::SSL->new("mosquitto.example.org", {
    SSL_ca_file   => '/etc/ssl/ca.crt',
    SSL_cert_file => '/etc/ssl/mqtt.crt',
    SSL_key_file  => '/etc/ssl/mqtt.key',
});

$mqtt->publish("topic/here" => "Message here");
$mqtt->retain( "topic/here" => "Message here");

DESCRIPTION

A subclass of Net::MQTT::Simple that adds SSL/TLS.

Like its base class, a server can be given on the use line, in which case publish and retain are exported so that they can be used as simple functions. This interface supports configuration via environment variables, but not via explicit options in code.

The object oriented interface does support explicit SSL configuration. See IO::Socket::SSL for a comprehensive overview of all the options that can be supplied to the constructor, new.

Environment variables

Instead of explicitly specifying the SSL options in the constructor, they can be set with environment variables. These are overridden by options given to new.

MQTT_SIMPLE_SSL_INSECURE

Set to something other than 0 to disable SSL validation.

MQTT_SIMPLE_SSL_CA

Path to the CA certificate or a directory of certificates. IO::Socket::SSL can find the CA path automatically on some systems.

MQTT_SIMPLE_SSL_CERT
MQTT_SIMPLE_SSL_KEY

Path to the client certificate file and its key file.

LICENSE

This software may be redistributed under the terms of the GPL, LGPL, modified BSD, or Artistic license, or any of the other OSI approved licenses listed at http://www.opensource.org/licenses/alphabetical. Distribution is allowed under all of these licenses, or any smaller subset of multiple or just one of these licenses.

When using a packaged version, please refer to the package metadata to see under which license terms it was distributed. Alternatively, a distributor may choose to replace the LICENSE section of the documentation and/or include a LICENSE file to reflect the license(s) they chose to redistribute under.

AUTHOR

Juerd Waalboer <juerd@tnx.nl>

SEE ALSO

Net::MQTT::Simple