projects:internetofthings:iotaiuto

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
projects:internetofthings:iotaiuto [2019/07/03 10:52] – [CONFIGURAZIONE BROADLINK RM Mini3 /RM2] denfraprojects:internetofthings:iotaiuto [2020/08/21 10:31] (current) – [CREAZIONE + INSTALLAZIONE + ATTIVAZIONE servizio "OPENVPN" linux client + relativo CERTIFICATO] roberto
Line 117: Line 117:
  
 ==== CREAZIONE + INSTALLAZIONE + ATTIVAZIONE servizio "OPENVPN" linux client + relativo CERTIFICATO ==== ==== CREAZIONE + INSTALLAZIONE + ATTIVAZIONE servizio "OPENVPN" linux client + relativo CERTIFICATO ====
 +
 +<code bash>
 +# 1. ricordarsi di aggiornare il file users.yaml sul server di iotaiuto.it con il nuovo utente e relativo ipaddr
 +# 2. eseguire poi i comandi "sctl restart cloud" + "sctl status cloud" per recepire il nuovo utente
 +# 3. chiedere a Igor di inserire il nuovo utente ed il suo nuovo ipaddr nel file dove sono censiti i DNS operanti 
 +#    in iotaiuto.it
  
  
Line 214: Line 220:
 #    nella modalità TERMINALE di RASPBIAN e svolgendo i seguenti passi: #    nella modalità TERMINALE di RASPBIAN e svolgendo i seguenti passi:
  
-#    2.1 installazione applicazione BROADLINK con versione di crittografia 0.10 (obbligatoria altrimenti non funziona)+#    2.1 installazione applicazione BROADLINK con versione di crittografia 0.10 (obbligatoria altrimenti 
 + 
 +#        non funziona)
  
 #    2.2 configurazione dispositivo BROADLINK perchè acceda alla rete WIFI domestica #    2.2 configurazione dispositivo BROADLINK perchè acceda alla rete WIFI domestica
Line 307: Line 315:
  
 # sul BROADLINK) e così di seguito per VOLUME+ VOLUME- CANALE+ CANALE-  e da CANALE-1 a CANALE-NNN # sul BROADLINK) e così di seguito per VOLUME+ VOLUME- CANALE+ CANALE-  e da CANALE-1 a CANALE-NNN
 +
 +
 +
 +# il file che occorre aggiornare si trova in:  /homeassistant/switch.yaml
  
  
 </code> </code>
  
-**# il file switch.yaml da aggiornare con le stringhe di cui sopra si trova al link: [[projects:internetofthings:clients|Clienti HA]] +==== Creazione Virtualhost ====
-**+
  
 +Esempio pratico: __voglio creare un punto di ingresso per ''http://roby.iotaiuto.it''__
  
 +In ''/etc/nginx/vpn-enabled'' relativamente a questo esempio, creare un file: ''roby.conf''
  
 +<code>
 +# Questo è l'insieme di regole che gestiscono http://roby.iotaiuto.it
 +server {
 +    # PUNTO 1
 +    server_name roby.iotaiuto.it;
 +    listen 80;
 +    return 301 https://$host$request_uri;
 +}
 +
 +# Questo è l'insieme di regole che gestiscono https://roby.iotaiuto.it
 +server {
 +    listen 443 ssl http2;
 +    # PUNTO 2 
 +    server_name roby.iotaiuto.it;
 +
 +    ssl_certificate /etc/letsencrypt/live/iotaiuto.it.wildcard/fullchain.pem;
 +    ssl_certificate_key /etc/letsencrypt/live/iotaiuto.it.wildcard/privkey.pem;
 +    ssl_dhparam /etc/nginx/ssl/dhparams.pem;
 +
 +    add_header Strict-Transport-Security "max-age=31536000; includeSubdomains";
 +    ssl on;
 +    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
 +    ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
 +    ssl_prefer_server_ciphers on;
 +    ssl_session_cache shared:SSL:10m;
 +
 +    proxy_buffering off;
 +
 +    location / {
 +        # PUNTO 3
 +        proxy_pass http://10.44.98.13:8123;
 +        proxy_set_header Host $host;
 +        proxy_redirect http:// https://;
 +        proxy_http_version 1.1;
 +        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 +        proxy_set_header Upgrade $http_upgrade;
 +        proxy_set_header Connection $connection_upgrade;
 +    }
 +}
 +</code>
 +
 +Dopo di che eseguire un check della configurazione
 +
 +<code bash>
 +root@homeassistant:/etc/nginx/vpn-enabled# nginx -t
 +nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
 +nginx: configuration file /etc/nginx/nginx.conf test is successful
 +</code>
 +
 + e in caso di **ok** riavviare nginx, perché acquisisca il nuovo endpoint.
 +
 +<code bash>
 +root@homeassistant:/etc/nginx/vpn-enabled# systemctl restart nginx
 +root@homeassistant:/etc/nginx/vpn-enabled# systemctl status nginx
 +● nginx.service - A high performance web server and a reverse proxy server
 +   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
 +   Active: active (running) since mar 2020-08-18 13:50:00 CEST; 59min ago
 +           ^^^^^^^^^^^^^^^^
 +</code>
  
 +Nel ''PUNTO 1'' e ''PUNTO 2'' va la parte dell'url che segue i due slash nell'indirizzo, in questo esempio da ''http://roby.iotaiuto.it'' resta solo ''roby.iotaiuto.it''
  
 +Nel ''PUNTO 3'' va l'IP con cui il raspberry si collega alla VPN
  • projects/internetofthings/iotaiuto.1562143935.txt.gz
  • Last modified: 2019/07/03 10:52
  • by denfra