Skip to content

Instantly share code, notes, and snippets.

@mohavirta
Last active January 22, 2021 08:29
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Teltonika RUT24x MQTT broker bridge, make client certificate and key optional
diff -Nausr a/package/mosquitto/files/mosquitto.init b/package/mosquitto/files/mosquitto.init
--- a/package/mosquitto/files/mosquitto.init 2021-01-21 19:12:55.101811434 +0200
+++ b/package/mosquitto/files/mosquitto.init 2021-01-21 19:49:43.649268961 +0200
@@ -111,8 +111,14 @@
# Use TLS/SSL for bridge connection
if [ "$use_remote_tls" == "1" ]; then
echo "bridge_cafile $bridge_ca_file" >> $CONFIG
- echo "bridge_certfile $bridge_cert_file" >> $CONFIG
- echo "bridge_keyfile $bridge_key_file" >> $CONFIG
+ if [ -n "$bridge_cert_file" ]
+ then
+ echo "bridge_certfile $bridge_cert_file" >> $CONFIG
+ fi
+ if [ -n "$bridge_key_file" ]
+ then
+ echo "bridge_keyfile $bridge_key_file" >> $CONFIG
+ fi
echo "bridge_tls_version $bridge_tls_version" >> $CONFIG
if [ "$bridge_insecure" = "1" ]
then
diff -Nausr a/package/mosquitto/files/mosquitto_old.init b/package/mosquitto/files/mosquitto_old.init
--- a/package/mosquitto/files/mosquitto_old.init 2021-01-21 19:12:55.105811512 +0200
+++ b/package/mosquitto/files/mosquitto_old.init 2021-01-21 19:50:56.072097759 +0200
@@ -67,8 +67,14 @@
# Use TLS/SSL for bridge connection
if [ "$use_remote_tls" == "1" ]; then
echo "bridge_cafile $bridge_ca_file" >> $CONFIG
- echo "bridge_certfile $bridge_cert_file" >> $CONFIG
- echo "bridge_keyfile $bridge_key_file" >> $CONFIG
+ if [ -n "$bridge_cert_file" ]
+ then
+ echo "bridge_certfile $bridge_cert_file" >> $CONFIG
+ fi
+ if [ -n "$bridge_key_file" ]
+ then
+ echo "bridge_keyfile $bridge_key_file" >> $CONFIG
+ fi
fi
# Use remote login
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment