Skip to content
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

Configure the MQTT fingerprint from the web configuration #970

Closed
liorsu opened this issue Oct 5, 2017 · 11 comments
Closed

Configure the MQTT fingerprint from the web configuration #970

liorsu opened this issue Oct 5, 2017 · 11 comments
Labels
stale Action - Issue left behind - Used by the BOT to call for attention

Comments

@liorsu
Copy link

liorsu commented Oct 5, 2017

I am running tasmota with the Web and encrypted MQTT options (removed the assert, and it is still working fine).
I am using letsencrypt certificates, but it is valid only for three months every time.
So I need to recompile and flash my ESP8266 with a new version of tasmota with the updated fingerprint whenever I have a new certificate.
I would be really helpful to me if it will be possible to change to certificate fingerprint from the web interface. Then I will also be able to create an automation for that and won't need to flash my esp again for that reason.
Thanks a lot Theo for all the great work.
Lior.

@arendst
Copy link
Owner

arendst commented Oct 5, 2017

Try to use the web console and command MqttFingerprint which should do what you want.

@liorsu
Copy link
Author

liorsu commented Oct 5, 2017

That is awesome Theo, didn't know that it already exist, thank you so much!
Will it be possible to also include it in the MQTT configuration page of the Web interface?
That way all of the MQTT setup options will be shown there easily, and I think it will even increase the awesomeness level of it!
If you can also look at Issue #808, as me and someone else believe that there might be a potential bug in there, I will also appreciate it a lot!
Thank you so much again for your work and effort invested, I truly appreciate it a lot.
Lior.

@stefanbode
Copy link
Contributor

stefanbode commented Oct 7, 2017

@liorsu this is also already implemented :-). You just send to the /cmd/sonoff/MqttFingerprint an EMPTY payload "" and you will get the current Fingerprint. If you send a value, this will change the fingerprint. You are one of the rare users that use the fingerprint like I do. Please add espClient.stop() in the sonoff.ino near line 616ff.

Should look after modification like this:

#ifdef USE_MQTT_TLS
    addLog_P(LOG_LEVEL_INFO, S_LOG_MQTT, PSTR(D_FINGERPRINT));
    if (!espClient.connect(sysCfg.mqtt_host, sysCfg.mqtt_port)) {
      snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_MQTT D_TLS_CONNECT_FAILED_TO " %s:%d. " D_RETRY_IN " %d " D_UNIT_SECOND),
        sysCfg.mqtt_host, sysCfg.mqtt_port, mqttcounter);
      addLog(LOG_LEVEL_DEBUG);
      return;
    }
    if (espClient.verify(sysCfg.mqtt_fingerprint, sysCfg.mqtt_host)) {
      addLog_P(LOG_LEVEL_INFO, S_LOG_MQTT, PSTR(D_VERIFIED));
    } else {
      addLog_P(LOG_LEVEL_DEBUG, S_LOG_MQTT, PSTR(D_INSECURE));
    }
    espClient.stop();
    yield();

@liorsu
Copy link
Author

liorsu commented Oct 9, 2017

Thank you @stefanbode, found out about it from your previous issue.
Also interested in the other applications and implementations that you made with it :)
Great minds think alike..

arendst added a commit that referenced this issue Oct 10, 2017
5.8.0j
 * Set default altitude to 0 to be used with pressure sensors
 *
Document flash settings area for future use
 * Prepare for 32-bit power
control (#995)
 * Introduce sonoff.h master header
 * Fix TLS MQTT SSL
fingerprint test (#808, #970)
 * Fix pressure calculation for some BMP
versions regression introduced with version 5.8.0i (#974)
 * Fix
Domoticz Dimmer set to same level not powering on (#945)
arendst added a commit that referenced this issue Oct 30, 2017
5.9.0 20171030
* Rewrite code (partly) using Google C++ Style Guide
(https://google.github.io/styleguide/cppguide.html)
* Rewrite code by using command lookup tables and javascript (client
side) web page expansions
* Change HTML/CSS to enable nicer form field entry
* Change default PWM assignments for H801 RGB(CW) led controller to
support optional Color/Dimmer control
*   GPIO04 (W2)    from GPIO_PWM2 to GPIO_USER to be user configurable
for GPIO_PWM5 (second White - Warm if W1 is Cold)
*   GPIO12 (Blue)  GPIO_PWM3 no change
*   GPIO13 (Green) from GPIO_PWM4 to GPIO_PWM2
*   GPIO14 (W1)    from GPIO_PWM1 to GPIO_USER to be user configurable
for GPIO_PWM4 (first White - Cold or Warm)
*   GPIO15 (Red)   from GPIO_PWM5 to GPIO_PWM1
* Change default PWM assignments for MagicHome RGB(W) led controller to
support optional Color/Dimmer control
*   GPIO05 (Green) from GPIO_PWM4 to GPIO_PWM2
*   GPIO12 (Blue)  from GPIO_PWM5 to GPIO_PWM3
*   GPIO13 (White) GPIO_USER to be user configurable for GPIO_PWM4
(White - Cold or Warm)
*   GPIO14 (Red)   from GPIO_PWM3 to GPIO_PWM1
* Change default PWM assignment for Witty Cloud to support optional
Color/Dimmer control (#976)
*   GPIO12 (Green) from GPIO_PWM4 to GPIO_PWM2
*   GPIO13 (Blue)  from GPIO_PWM5 to GPIO_PWM3
*   GPIO15 (Red)   from GPIO_PWM3 to GPIO_PWM1
* Change when another module is selected now all GPIO user configuration
is removed
* Change command name IRRemote to IRSend (#956)
* Remove Arduino IDE version too low warning as it interferes with
platformio.ini platform = espressif8266_stage
* Fix command FullTopic entry when using serial or console interface
* Fix possible UDP syslog blocking
* Fix minimum TelePeriod of 10 seconds set by web page
* Fix command GPIOx JSON response (#897)
* Fix inverted relay power on state (#909)
* Fix compile error when DOMOTICZ_UPDATE_TIMER is not defined (#930)
* Fix alignment of web page items in some browsers (#935)
* Fix setting all saved power settings to Off when SetOption0
(SaveState) = 0 (#955)
* Fix timezone range from -12/12 to -13/13 (#968)
* Fix Southern Hemisphere TIME_STD/TIME_DST (#968)
* Fix TLS MQTT SSL fingerprint test (#970, #808)
* Fix virtual relay status message used with Color/Dimmer control (#989)
* Fix command IRSend and IRHvac case sensitive parameter regression
introduced with version 5.8.0 (#993)
* Fix pressure calculation for some BMP versions regression introduced
with version 5.8.0i (#974)
* Fix Domoticz Dimmer set to same level not powering on (#945)
* Fix Blocked Loop when erasing large flash using command reset 2
(#1002)
* Fix relay power control when light power control is also configured as
regression from 5.8.0 (#1016)
* Fix Mqtt server mDNS lookup only when MqttHost name is empty (#1026)
* Add debug information to MQTT subscribe
* Add translations to I2Cscan
* Add translation to BH1750 unit lx
* Add light scheme options (Color cycle Up, Down, Random) and moving
WS2812 schemes up by 3
* Add Domoticz counter sensor to IrReceive representing Received IR
Protocol and Data
* Add option 0 to MqttHost to allow empty Mqtt host name
* Add support for Arilux AL-LC01 RGB Led controller (#370)
* Add esp8266 de-blocking to PubSubClient library (#790)
* Add Domoticz sensors for Voltage and Current (#903)
* Add platformio OTA upload support (#928, #934)
* Add warning to webpage when USE_MINIMAL is selected (#929)
* Add smoother movement of hour hand in WS2812 led clock (#936)
* Add support for Magic Home RGBW and some Arilux Led controllers (#940)
* Add command SetOption15 0 (default) for command PWM control or
SetOption15 1 for commands Color/Dimmer control to PWM RGB(CW) leds
(#941)
* Add Domoticz counter sensor to Sonoff Bridge representing Received RF
code (#943)
* Add support for Luani HVIO board
(https://luani.de/projekte/esp8266-hvio/) (#953)
* Add PWM initialization after restart (#955)
* Add IR Receiver support. Disable in user_config.h (#956)
* Add support for inverted PWM (#960)
* Add Sea level pressure calculation and Provide command Altitude (#974)
* Add support for up to 8 relays (#995)
* Add commands RfSync, RfLow, RfHigh, RfHost and RfCode to allow sending
custom RF codes (#1001)
* Add retain to ENERGY messages controlled by command SensorRetain
(#1013)
* Add commands Color2, Color3, Color4, Width2, Width3, Width4 and
SetOption16 to set Ws2812 Clock parameters (#1019)
* Add German language file (#1022)
* Add support for connecting to MQTT brokers without userid and/or
password (#1023)
* Add support for esp8266 core v2.4.0-rc2 (#1024)
* Add commands PwmRange 1,255..1023 and PwmFrequency 1,100..4000 (#1025)
* Add Polish language file (#1044, #1047)
* Add support for KMC 70011 Power Monitoring Smart Plug (#1045)
* Add support for VEML6070 I2C Ultra Violet level sensor (#1053)
* Add light turn Off Fade (#925)
* Add IrSend command option Panasonic as IrSend {"Protocol":"Panasonic",
"Bits":16388, "Data":<Panasonic data>}
*   where 16388 is 0x4004 hexadecimal (#1014)
* Add retry counter to DHT11/21/22 sensors (#1082)
@fragolinux
Copy link

fragolinux commented Nov 1, 2017

hi, i'm using v5.9.0, ota updated from http://sonoff.maddox.co.uk/tasmota/sonoff.bin
a few days ago i updated all my services to ssl, via letsencrypt, so i used the same certificate for apache, node-red and mosquitto, this last on port 8883... my basic sonoff refuses connection, and via console the mqttfingerprint is just unknown:
18:13:23 CMD: MqttFingerprint
18:13:23 RSL: stat/LampadaStudio/RESULT = {"Command":"Unknown"}

what to do? I see here that a special firmware is needed, but nothing on SonOta or Releases page...
https://github.com/arendst/Sonoff-Tasmota/wiki/MQTT-Overview
Thanks :)

@arendst
Copy link
Owner

arendst commented Nov 2, 2017

In the provided binaries TLS is disabled as it eats up too much code. Therefore the command Mqtt Fingerprint is disabled too.

To use TLS you will have to enable it in user_config.h (and disable webserver to make it work within the tight RAM space) and recompile the code.

@fragolinux
Copy link

the 2 functionalities cannot coexist on every board, or just the 1mb sonoffs? if i change the memory on sonoff with a 4mb model, can i have both or have to disable 1 of them anyway? thanks

@arendst
Copy link
Owner

arendst commented Nov 2, 2017

You still have to disable one of them as the amount of RAM does not change when replacing the flash.

@stefanbode
Copy link
Contributor

Yes and no. I run actually the configuration with the webserver and the TLS MQTT. It also run on the 512kb small sonoff devices. I just have to disable some stuff during compilation to make the code fit into the flash. There is ONE thing that you have to keep in mind. It the MQTT TLS is "ON" AND "CONNECTED", you cannot go to the webserver interface and reconfigure the MODULE. This needs to much RAM and crashes. But it is ok to temporary disable MQTT and restart. Then you can make through webserver your MODULE changes. If everything is ok, you just enable MQTT again. Additionally, also for security reasons, I disable in normal operation my webserver. This free up some RAM. If needed I can enable it again with "webserver 2" command through MQTT.

@stale
Copy link

stale bot commented Apr 23, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Action - Issue left behind - Used by the BOT to call for attention label Apr 23, 2018
@stale
Copy link

stale bot commented May 7, 2018

This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem.

@stale stale bot closed this as completed May 7, 2018
curzon01 pushed a commit to curzon01/Tasmota that referenced this issue Sep 6, 2018
5.8.0j
 * Set default altitude to 0 to be used with pressure sensors
 *
Document flash settings area for future use
 * Prepare for 32-bit power
control (arendst#995)
 * Introduce sonoff.h master header
 * Fix TLS MQTT SSL
fingerprint test (arendst#808, arendst#970)
 * Fix pressure calculation for some BMP
versions regression introduced with version 5.8.0i (arendst#974)
 * Fix
Domoticz Dimmer set to same level not powering on (arendst#945)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Action - Issue left behind - Used by the BOT to call for attention
Projects
None yet
Development

No branches or pull requests

4 participants