Trick #3: HTTPS with OSPI and Raspberry Pi
- This topic has 3 replies, 2 voices, and was last updated 5 years, 1 month ago by
Admin.
-
AuthorPosts
-
10. February 2021 at 23:38 #23346
Admin
KeymasterUm HTTPS verschlüsselt auf den OSPi zugreifen zu können, benötigt man einen HTTPS Proxy, der die Verbindung verschlüsselt.
Eine Möglichkeit ist dies mit Nginx zu machen.
1. Nginx installieren:
sudo apt-get update
sudo apt-get install nginx2. SSL Zertifikat erstellen:
cd /etc/nginx
sudo openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout /etc/nginx/cert.key -out /etc/nginx/cert.crt3. Konfiguration bearbeiten:
sudo nano /etc/nginx/sites-enabled/default
Löschen Sie alle Zeilen und verwenden Sie diese Konfiguration. Eventuell müssen sie die beiden stellen mit “RASPI” mit dem Namen ihres Raspberry Pi anpassen.
server {
listen 80;
return 301 https://$host$request_uri;
}server {
listen 443;
server_name raspi;ssl_certificate /etc/nginx/cert.crt;
ssl_certificate_key /etc/nginx/cert.key;ssl on;
ssl_session_cache builtin:1000 shared:SSL:10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
ssl_prefer_server_ciphers on;# access_log /var/log/nginx/access.log;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;# Fix the “It appears that your reverse proxy set up is broken” error.
proxy_pass http://localhost:8080;
proxy_read_timeout 90;proxy_redirect http://localhost:8080 https://raspi;
}
}4. Nginx aktivieren und neu starten:
sudo systemctl enable nginx
sudo service nginx restart
5. Fertig.
Sie können nun per Browser zugreifen. Er leitet http auf https anfragen um oder Sie greifen direkt per http darauf zu
Das Original der Anleitung stammt von hier und wurde angepasst:
Vergessen Sie nicht, die Portfreigabe ihres Routers auf den Raspi-Port 443 zu ändern (also z.b. vorher 3000 nach raspi/80 ändern in 3000 nach raspi/443). In der OpenSprinkler-App verbinden Sie sich dann mit der Option “SSL”
10. February 2021 at 23:43 #23347Admin
KeymasterMit dem OpenSprinkler 3 geht das leider nicht, da für das System kein SSL Client verfügbar ist. Allerdings können Sie einen (Zusätzlichen) Linux- oder Raspberry PI verwenden, um auf den OpenSprinkler 3 die Verschlüsselung umzuleiten. Ersetzen Sie einfach in den beiden “http://localhost:8080” – Angaben das “localhost” durch die Ip-adresse des OpenSprinklers und “8080” mit “80”.
April 14, 2021 at 5:33 p.m #23933nightingale
ParticipantGreat tip, that's what I was looking for anyway. Thanks. I also wanted DynDNS and letsencrypt, but I'll figure out whether and how that works. Ultimately, this has more to do with Raspberry than with OpenSprinkler...
April 30, 2021 at 8:27 p.m #24088Admin
KeymasterYes, the SSL certificate is such a thing. The application doesn't work without a valid certificate; it only works in the web browser and then only if you confirm the certificate warning.
However, there is still the option of exporting the certificate and installing it on the smartphone. The domain name must match the Common Name certificate.
So if you e.g. For example, if you named your dyndns domain sprinkler.dyndns.bla, then the common name must be exactly that. And that's exactly how you have to use it in the app.
-
AuthorPosts
- You must be logged in to reply to this topic.
