| Net::MQTT::Simple::SSL(3pm) | User Contributed Perl Documentation | Net::MQTT::Simple::SSL(3pm) |
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¶
Pick your favourite OSI approved license :)
AUTHOR¶
Juerd Waalboer <juerd@tnx.nl>
SEE ALSO¶
Net::MQTT::Simple
| 2023-10-30 | perl v5.36.0 |