andrewshilliday / garage-door-controller

Software to monitor and control garage doors via a raspberry pi
MIT License
327 stars 132 forks source link

Serve Over HTTPS With SSL #88

Closed CrackerStealth closed 6 years ago

CrackerStealth commented 6 years ago

I have been using this software for a number of years but with customization's for my own setup and have decided to contribute some back. This pull request will add the ability for the garage controller software to serve the web application with SSL for secure communication using HTTPS.

To maintain simplicity, this provides the option to switch HTTPS on. It does not handle communication on both HTTP and HTTPS ports at the same time. The end user must choose HTTP or HTTPS.

andrewshilliday commented 6 years ago

This looks good. Thanks. Could I as you to alter line 267 of controller.py so that instead of calling: if not self.config['config']['use_https']: It will first check to make sure that 'use_https' is defined in the config? That will give us a little backwards compatibility. Something like if not 'use_https' in self.config['config'] or not self.config['config']['use_https']:

CrackerStealth commented 6 years ago

Thanks for the feedback. I have added compatibility checking for the config option as requested and tested.

gseguin commented 6 years ago

The way I've achieved HTTPS access was by fronting the python HTTP server with nginx in HTTPS only. This also allows you to use an oauth proxy for authentication via Google or other authentication provider.