Rozdíly
Zde můžete vidět rozdíly mezi vybranou verzí a aktuální verzí dané stránky.
Obě strany předchozí revize Předchozí verze Následující verze | Předchozí verze | ||
it:iot:mosquitto [2023/01/04 20:42] – Petr Nosek | it:iot:mosquitto [2023/02/12 08:49] (aktuální) – [Zapnutí autentizace] Petr Nosek | ||
---|---|---|---|
Řádek 5: | Řádek 5: | ||
V [[https:// | V [[https:// | ||
+ | |||
+ | |||
+ | |||
+ | ===== Podrobnější logování v Mosquitto | ||
+ | Do konfiguračního souboru lze [[https:// | ||
+ | |||
+ | <code bash> | ||
+ | # Types of messages to log. Use multiple log_type lines for logging | ||
+ | # multiple types of messages. | ||
+ | # Possible types are: debug, error, warning, notice, information, | ||
+ | # none, subscribe, unsubscribe, | ||
+ | # Note that debug type messages are for decoding the incoming/ | ||
+ | # network packets. They are not logged in " | ||
+ | log_type error | ||
+ | log_type warning | ||
+ | log_type notice | ||
+ | log_type information | ||
+ | </ | ||
+ | |||
Řádek 23: | Řádek 42: | ||
<code bash> | <code bash> | ||
- | docker exec -it mosqutto | + | docker exec -it mosquitto |
mosquitto_passwd -c / | mosquitto_passwd -c / | ||
</ | </ | ||
Řádek 79: | Řádek 98: | ||
function generate_der () { | function generate_der () { | ||
echo " | echo " | ||
- | | + | |
- | | + | |
} | } | ||
+ | |||
+ | function generate_server_pem () { | ||
+ | echo " | ||
+ | | ||
+ | | ||
+ | } | ||
+ | |||
generate_CA | generate_CA | ||
Řádek 87: | Řádek 113: | ||
generate_client | generate_client | ||
generate_der | generate_der | ||
+ | generate_server_pem | ||
</ | </ | ||
Řádek 139: | Řádek 166: | ||
+ | === ESP8266, microPython a Mosquito přes SSL === | ||
- | + | Po dlouhém bádání jsem se dopracoval k tomu, že je potřeba certifikát | |
- | ==== Podrobnější logování | + | |
- | Do konfiguračního souboru lze [[https:// | + | |
<code bash> | <code bash> | ||
- | # Types of messages to log. Use multiple log_type lines for logging | + | sudo pip3 install mpfshell |
- | # multiple types of messages. | + | mpfshell -c "open ttyUSB0" |
- | # Possible types are: debug, error, warning, notice, information, | + | ls |
- | # none, subscribe, unsubscribe, | + | put cert.der |
- | # Note that debug type messages are for decoding the incoming/ | + | put key.der |
- | # network packets. They are not logged in " | + | ls |
- | log_type error | + | |
- | log_type warning | + | |
- | log_type notice | + | |
- | log_type information | + | |
</ | </ | ||
+ | |||
+ | |||
+ | Pak jsem musel upravid kód v microPythonu, | ||
+ | |||
+ | <code python> | ||
+ | with open(" | ||
+ | key = f.read() | ||
+ | | ||
+ | with open(" | ||
+ | cert = f.read() | ||
+ | |||
+ | |||
+ | ssl_params = dict() | ||
+ | ssl_params[" | ||
+ | ssl_params[" | ||
+ | |||
+ | |||
+ | mqttc = MQTTClient(CLIENT_NAME, | ||
+ | | ||
+ | </ | ||
+ | |||
+ | zdroje, ze kterých jsem čerpal: | ||
+ | |||
+ | * https:// | ||
+ | * https:// | ||
+ | * https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | |||
+ | |||
+ |