Python Plugin listening HTTPS

Python and python framework

Moderator: leecollings

Post Reply
pipiche
Posts: 2038
Joined: Monday 02 April 2018 20:33
Target OS: Linux
Domoticz version:
Contact:

Python Plugin listening HTTPS

Post by pipiche »

I'm trying to develop an HTTPS plugin listener. While the HTTP is working pretty well, the HTTPS seems to have some issues.

Maybe (or certainly) I'm doing something wrong, but while using HTTPS I'm getting something wrong with Error: 'Error: PluginSystem: Exception processing message.'

Here are the log with full debug

Code: Select all


May 16 10:37:50 rasp domoticz[31566]: Status: Domoticz V4.10717 (c)2012-2019 GizMoCuz
May 16 10:37:50 rasp domoticz[31566]: Status: Build Hash: b38b49e5, Date: 2019-05-09 13:04:08
May 16 10:37:50 rasp domoticz[31566]: Status: Startup Path: /usr/share/domoticz/beta-domoticz/
May 16 10:37:50 rasp domoticz[31566]: Sunrise: 06:06:00 SunSet: 21:00:00
May 16 10:37:50 rasp domoticz[31566]: Day length: 14:54:00 Sun at south: 13:33:00
May 16 10:37:50 rasp domoticz[31566]: Civil twilight start: 05:32:00 Civil twilight end: 21:35:00
May 16 10:37:50 rasp domoticz[31566]: Nautical twilight start: 04:48:00 Nautical twilight end: 22:19:00
May 16 10:37:50 rasp domoticz[31566]: Astronomical twilight start: 03:56:00 Astronomical twilight end: 23:11:00
May 16 10:37:50 rasp domoticz[31566]: Status: PluginSystem: Started, Python version '3.7.3'.
May 16 10:37:50 rasp domoticz[31566]: Active notification Subsystems: email, pushover, telegram (3/13)
May 16 10:37:50 rasp domoticz[31566]: Status: WebServer(HTTP) started on address: :: with port 8080
May 16 10:37:50 rasp domoticz[31566]: Status: WebServer(SSL) started on address: :: with port 8443
May 16 10:37:50 rasp domoticz[31566]: Status: Camera: settings (re)loaded
May 16 10:37:50 rasp domoticz[31566]: Starting shared server on: :::6144
May 16 10:37:50 rasp domoticz[31566]: Status: TCPServer: shared server started...
May 16 10:37:50 rasp domoticz[31566]: Status: RxQueue: queue worker started...
May 16 10:37:52 rasp domoticz[31566]: Status: (HTTPServer) Started.
May 16 10:37:52 rasp domoticz[31566]: Status: EventSystem: reset all events...
May 16 10:37:52 rasp domoticz[31566]: Status: EventSystem: reset all device statuses...
May 16 10:37:52 rasp domoticz[31566]: Status: Python EventSystem: Initalizing event module.
May 16 10:37:52 rasp domoticz[31566]: Status: EventSystem: Started
May 16 10:37:52 rasp domoticz[31566]: Status: EventSystem: Queue thread started...
May 16 10:37:52 rasp domoticz[31566]: Status: PluginSystem: Entering work loop.
May 16 10:37:53 rasp domoticz[31566]: Status: (HTTPServer) Entering work loop.
May 16 10:37:53 rasp domoticz[31566]: Status: (HTTPServer) Initialized version 1.0.0, author 'dnpwwo'
May 16 10:37:53 rasp domoticz[31566]: (HTTPServer) Debug logging mask set to: PYTHON PLUGIN QUEUE IMAGE DEVICE CONNECTION MESSAGE ALL
May 16 10:37:53 rasp domoticz[31566]: (HTTPServer) 'HardwareID':'41'
May 16 10:37:53 rasp domoticz[31566]: (HTTPServer) 'HomeFolder':'/var/lib/domoticz/plugins/HTTTPserver/'
May 16 10:37:53 rasp domoticz[31566]: (HTTPServer) 'StartupFolder':'/usr/share/domoticz/beta-domoticz/'
May 16 10:37:53 rasp domoticz[31566]: (HTTPServer) 'UserDataFolder':'/var/lib/domoticz/'
May 16 10:37:53 rasp domoticz[31566]: (HTTPServer) 'Database':'/var/lib/domoticz/domoticz.db'
May 16 10:37:53 rasp domoticz[31566]: (HTTPServer) 'Language':'en'
May 16 10:37:53 rasp domoticz[31566]: (HTTPServer) 'Version':'1.0.0'
May 16 10:37:53 rasp domoticz[31566]: (HTTPServer) 'Author':'dnpwwo'
May 16 10:37:53 rasp domoticz[31566]: (HTTPServer) 'Name':'HTTPServer'
May 16 10:37:53 rasp domoticz[31566]: (HTTPServer) 'Port':'9550'
May 16 10:37:53 rasp domoticz[31566]: (HTTPServer) 'Key':'HTTPListen'
May 16 10:37:53 rasp domoticz[31566]: (HTTPServer) 'Mode6':'File'
May 16 10:37:53 rasp domoticz[31566]: (HTTPServer) 'DomoticzVersion':'4.10717'
May 16 10:37:53 rasp domoticz[31566]: (HTTPServer) 'DomoticzHash':'b38b49e5'
May 16 10:37:53 rasp domoticz[31566]: (HTTPServer) 'DomoticzBuildTime':'2019-05-09 13:04:08'
May 16 10:37:53 rasp domoticz[31566]: (HTTPServer) Device count: 0
May 16 10:37:53 rasp domoticz[31566]: (HTTPServer) Pushing 'ProtocolDirective' on to queue
May 16 10:37:53 rasp domoticz[31566]: (HTTPServer) Pushing 'ListenDirective' on to queue
May 16 10:37:53 rasp domoticz[31566]: (HTTPServer) Leaving on start
May 16 10:37:53 rasp domoticz[31566]: (HTTPServer) Processing 'ProtocolDirective' message
May 16 10:37:53 rasp domoticz[31566]: (HTTPServer) Protocol set to: 'HTTPS'.
May 16 10:37:53 rasp domoticz[31566]: (HTTPServer) Processing 'ListenDirective' message
May 16 10:37:53 rasp domoticz[31566]: (HTTPServer) Transport set to: 'TCP/IP', :9550.
May 16 10:37:53 rasp domoticz[31566]: (HTTPServer) Listen directive received, action initiated successfully.
May 16 10:37:59 rasp domoticz[31566]: (HTTPServer) Pushing 'ProtocolDirective' on to queue
May 16 10:37:59 rasp domoticz[31566]: (HTTPServer) Pushing 'onConnectCallback' on to queue
May 16 10:37:59 rasp domoticz[31566]: (HTTPServer) Processing 'ProtocolDirective' message
May 16 10:37:59 rasp domoticz[31566]: (HTTPServer) Protocol set to: 'HTTPS'.
May 16 10:37:59 rasp domoticz[31566]: (HTTPServer) Processing 'onConnectCallback' message
May 16 10:37:59 rasp domoticz[31566]: (HTTPServer) Calling message handler 'onConnect'.
May 16 10:37:59 rasp domoticz[31566]: (HTTPServer) Connected successfully to: 127.0.0.1:59386
May 16 10:37:59 rasp domoticz[31566]: (HTTPServer) Name: '127.0.0.1:59386', Transport: 'TCP/IP', Protocol: 'HTTPS', Address: '127.0.0.1', Port: '59386', Baud: 0, Bytes: 0, Connected: True, Last Seen: 2019-05-16 10:37:59, Parent: 'Server Connection'
May 16 10:37:59 rasp domoticz[31566]: (HTTPServer) Pushing 'ReadEvent' on to queue
May 16 10:37:59 rasp domoticz[31566]: (HTTPServer) Processing 'ReadEvent' message
May 16 10:37:59 rasp domoticz[31566]: (HTTPServer) Received 517 bytes of data
May 16 10:37:59 rasp domoticz[31566]: [101B blob data]
May 16 10:37:59 rasp domoticz[31566]: [101B blob data]
May 16 10:37:59 rasp domoticz[31566]: [101B blob data]
May 16 10:37:59 rasp domoticz[31566]: [101B blob data]
May 16 10:37:59 rasp domoticz[31566]: [101B blob data]
May 16 10:37:59 rasp domoticz[31566]: [101B blob data]
May 16 10:37:59 rasp domoticz[31566]: [101B blob data]
May 16 10:37:59 rasp domoticz[31566]: (HTTPServer)     19 01 00 01 01 00 0b 00 02 01 00 00 23 00 00 00 10 00 0e 00     ............#.......
May 16 10:37:59 rasp domoticz[31566]: (HTTPServer)     0c 02 68 32 08 68 74 74 70 2f 31 2e 31 00 05 00 05 01 00 00     ..h2.http/1.1.......
May 16 10:37:59 rasp domoticz[31566]: [101B blob data]
May 16 10:37:59 rasp domoticz[31566]: [101B blob data]
May 16 10:37:59 rasp domoticz[31566]: [101B blob data]
May 16 10:37:59 rasp domoticz[31566]: [101B blob data]
May 16 10:37:59 rasp domoticz[31566]: [101B blob data]
May 16 10:37:59 rasp domoticz[31566]: [101B blob data]
May 16 10:37:59 rasp domoticz[31566]: (HTTPServer)     03 03 03 02 03 01 00 0d 00 18 00 16 04 03 05 03 06 03 08 04     ....................
May 16 10:37:59 rasp domoticz[31566]: (HTTPServer)     08 05 08 06 04 01 05 01 06 01 02 03 02 01 00 2d 00 02 01 01     ...............-....
May 16 10:37:59 rasp domoticz[31566]: [101B blob data]
May 16 10:37:59 rasp domoticz[31566]: (HTTPServer)     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00     ....................
May 16 10:37:59 rasp domoticz[31566]: (HTTPServer)     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 .. .. ..     .................
May 16 10:37:59 rasp domoticz[31566]: Error: PluginSystem: Exception processing message.



CC: @Dnpwwo
User avatar
Dnpwwo
Posts: 820
Joined: Sunday 23 March 2014 9:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Melbourne, Australia
Contact:

Re: Python Plugin listening HTTPS

Post by Dnpwwo »

Hmmm ... just had a look at the code and can see I never implemented that.

The secure transport inherits from the normal tcp transport which is why it actually makes the connection but it isn't trying to set up the server side TLS session.

I found a boost example of how to do the server side set up, I'll look into how hard it is to do
The reasonable man adapts himself to the world; the unreasonable one persists to adapt the world to himself. Therefore all progress depends on the unreasonable man. George Bernard Shaw
pipiche
Posts: 2038
Joined: Monday 02 April 2018 20:33
Target OS: Linux
Domoticz version:
Contact:

Re: Python Plugin listening HTTPS

Post by pipiche »

Dnpwwo wrote: Thursday 16 May 2019 16:27 Hmmm ... just had a look at the code and can see I never implemented that.

The secure transport inherits from the normal tcp transport which is why it actually makes the connection but it isn't trying to set up the server side TLS session.

I found a boost example of how to do the server side set up, I'll look into how hard it is to do
Ok, not a burning issue on my end for now. So takes your time. I have posted an other issue which is weird
Post Reply