<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
    <channel>
      <title>~&#x2F;magostinelli - vpn</title>
      <link>https://www.agostinelli.eu</link>
      <description>La casa delle mie passioni</description>
      <generator>Zola</generator>
      <language>it</language>
      <atom:link href="https://www.agostinelli.eu/tags/vpn/rss.xml" rel="self" type="application/rss+xml"/>
      <lastBuildDate>Wed, 14 Feb 2024 00:00:00 +0000</lastBuildDate>
      <item>
          <title>Come bloccare la pubblicità sullo smartphone </title>
          <pubDate>Sat, 10 Feb 2024 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://www.agostinelli.eu/blog/come-bloccare-la-pubblicita-sullo-smartphone/</link>
          <guid>https://www.agostinelli.eu/blog/come-bloccare-la-pubblicita-sullo-smartphone/</guid>
          <description xml:base="https://www.agostinelli.eu/blog/come-bloccare-la-pubblicita-sullo-smartphone/">&lt;p&gt;&lt;strong&gt;Aggiornamento 14&#x2F;02&#x2F;2024&lt;&#x2F;strong&gt;: aggiungo in fondo all&#x27;articolo le modifiche necessarie per la parte server.&lt;&#x2F;p&gt;
&lt;p&gt;Questo metodo lo utilizzo ormai da svariati mesi e &lt;strong&gt;funziona benissimo&lt;&#x2F;strong&gt;!&lt;&#x2F;p&gt;
&lt;p&gt;Premetto subito che non è una semplice soluzione adatta per tutti, poiché richiede un server #wireguard e un&#x27;installazione di #pihole.
Però se avete un amico che ha già configurato tutto per se, sarà molto semplice farlo usare anche a voi! E&#x27; complessa la configurazione server, mentre la &lt;strong&gt;parte client è semplicissima&lt;&#x2F;strong&gt;: scaricare un&#x27;app e scansionare un qr code.&lt;&#x2F;p&gt;
&lt;p&gt;Abbiamo visto la configurazione di entrambi su questo blog (cliccate sui due hashtag per le leggere le guide).&lt;&#x2F;p&gt;
&lt;p&gt;Con questo metodo non solo bloccherete le pubblicità invasive sul browser, ma &lt;strong&gt;su tutte le app&lt;&#x2F;strong&gt;!
Inoltre oltre al blocco pubblicità avrete anche il &lt;strong&gt;blocco dei siti malevoli&lt;&#x2F;strong&gt; (in base alle liste che avete deciso di aggiungere a pihole).&lt;&#x2F;p&gt;
&lt;p&gt;Il trucco è usare la vpn per fare in modo che lo smartphone navighi nello stessa modalità che avviene da casa, cioè protetto da pihole!&lt;&#x2F;p&gt;
&lt;p&gt;Abbiamo due diverse modalità di uso per la vpn:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;usarla solo per la risoluzione dns&lt;&#x2F;li&gt;
&lt;li&gt;usarla per tutto il traffico&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;L&#x27;una non esclude l&#x27;altra, cioè possiamo fare due profili diversi e passare da uno all&#x27;altro in base alle necessità (ad esempio se ci connettiamo un WiFi pubblico non protetto, conviene usare la seconda opzione).
La prima soluzione ha il vantaggio di consumare pochissima banda per il server, solo lo stretto necessario per le risoluzioni dns.&lt;&#x2F;p&gt;
&lt;p&gt;Esempio di configurazione solo dns:&lt;&#x2F;p&gt;
&lt;pre class=&quot;z-code&quot;&gt;&lt;code&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;[Interface]
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;PrivateKey = chiave_priv_client1
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;Address = 192.168.20.2&#x2F;24
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;Dns = ip_vpn_privato_server
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;[Peer]
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;PublicKey = chiave_pub_server
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;PresharedKey = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;AllowedIPs = ip_vpn_privato_server&#x2F;32
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;Endpoint = hostname_pubblico_server:porta
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Esempio di configurazione traffico completo:&lt;&#x2F;p&gt;
&lt;pre class=&quot;z-code&quot;&gt;&lt;code&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;[Interface]
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;PrivateKey = chiave_priv_client1
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;Address = 192.168.20.2&#x2F;24
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;Dns = ip_vpn_privato_server
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;[Peer]
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;PublicKey = chiave_pub_server
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;PresharedKey = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;AllowedIPs  = 0.0.0.0&#x2F;0, ::&#x2F;0
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;Endpoint = hostname_pubblico_server:porta
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Vi consiglio di usare questo client per wireguard &lt;strong&gt;wg-tunnel&lt;&#x2F;strong&gt;, perché ha una funzionalità fondamentale per il nostro scopo: è in grado di &lt;strong&gt;attivare automaticamente la vpn&lt;&#x2F;strong&gt; quando ci disconnettiamo dalla nostra wifi (è possibile scegliere più reti fidate).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;img.agostinelli.eu&#x2F;2024&#x2F;wg-tunnel_logo.png&quot; alt=&quot;Wg tunnel Logo&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;img.agostinelli.eu&#x2F;2024&#x2F;wg-tunnel_screen1.png&quot; alt=&quot;Wg tunnel Screen 1&quot; &#x2F;&gt;
&lt;img src=&quot;https:&#x2F;&#x2F;img.agostinelli.eu&#x2F;2024&#x2F;wg-tunnel_screen2.png&quot; alt=&quot;Wg tunnel Screen 2&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Non ho provato questa soluzione su iPhone, ma presumo che possa funzionare anche lì.&lt;&#x2F;p&gt;
&lt;p&gt;Infine vi consiglio anche un&#x27;ottimo client #android per gestire pihole: Pi-hole Droid.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;aggiornamento-14-12-2024&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#aggiornamento-14-12-2024&quot; aria-label=&quot;Anchor link for: aggiornamento-14-12-2024&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
Aggiornamento 14&#x2F;12&#x2F;2024&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;modifiche-configurazione-server&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#modifiche-configurazione-server&quot; aria-label=&quot;Anchor link for: modifiche-configurazione-server&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
Modifiche configurazione server&lt;&#x2F;h3&gt;
&lt;p&gt;Affinchè il server sia in grado di ruotare i pacchetti ricevuti dalla VPN è necessaria qualche configurazione in più, dei comandi &lt;em&gt;&quot;standard&quot;&lt;&#x2F;em&gt; #iptables per gli addetti ai lavori.
(su iptables trovate  ampia documentazione on line)
Ma veniamo al dunque&lt;&#x2F;p&gt;
&lt;p&gt;Esempio di righe in aggiunta alla parte server:&lt;&#x2F;p&gt;
&lt;pre class=&quot;z-code&quot;&gt;&lt;code&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;...
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;PostUp = iptables -A FORWARD -i %i -j ACCEPT
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;PostUp = iptables -A FORWARD -o %i -j ACCEPT
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;PostUp = iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;# DNS - sostituire 192.168.1.x con ip del proprio pihole
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;PostUp = iptables -I FORWARD -i %i -p udp -m udp -d 192.168.1.x&#x2F;32 --dport 53 -j ACCEPT
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;PostUp = iptables -I FORWARD -i %i -p tcp -m tcp -d 192.168.1.x&#x2F;32 --dport 53 -j ACCEPT
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;# Blocco rete locale per tutti (nell&amp;#39;esempio è con subnet 192.168.1.0)
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;PostUp = iptables -I FORWARD -i %i -d 192.168.1.0&#x2F;24 -j REJECT
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;# Apertura rete locale ad un singolo ip
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;PostUp = iptables -I FORWARD -i %i -s 172.16.2.2&#x2F;32 -d 192.168.1.0&#x2F;24 -j ACCEPT
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;PostDown = iptables -D FORWARD -i %i -j ACCEPT
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;PostDown = iptables -D FORWARD -o %i -j ACCEPT
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;PostDown = iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;...
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
</description>
      </item>
      <item>
          <title>Wireguard - VPN per tutti</title>
          <pubDate>Sun, 28 Jan 2024 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://www.agostinelli.eu/blog/wireguard-vpn-per-tutti/</link>
          <guid>https://www.agostinelli.eu/blog/wireguard-vpn-per-tutti/</guid>
          <description xml:base="https://www.agostinelli.eu/blog/wireguard-vpn-per-tutti/">&lt;h2 id=&quot;definizione&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#definizione&quot; aria-label=&quot;Anchor link for: definizione&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
Definizione&lt;&#x2F;h2&gt;
&lt;p&gt;WireGuard è un programma &lt;strong&gt;open source&lt;&#x2F;strong&gt; che implementa una connessione &lt;strong&gt;VPN&lt;&#x2F;strong&gt; per creare connessioni sicure punto-punto&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;img.agostinelli.eu&#x2F;2024&#x2F;Logo_of_WireGuard.svg&quot; alt=&quot;Wireguard Logo&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;a-cosa-serve&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#a-cosa-serve&quot; aria-label=&quot;Anchor link for: a-cosa-serve&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
A cosa serve?&lt;&#x2F;h2&gt;
&lt;p&gt;Sicuramente avrete già sentito parlare di vpn, qualora ne siate a digiuno provo a scriverlo brevemente. Attivando questa connessione tra due dispositivi, collegati entrambi alla rete internet, permette loro, in modo &lt;strong&gt;sixuro&lt;&#x2F;strong&gt;,  di comunicare tra di loro.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;vantaggi&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#vantaggi&quot; aria-label=&quot;Anchor link for: vantaggi&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
Vantaggi&lt;&#x2F;h2&gt;
&lt;p&gt;Wireguard si distingue da altri programmi simili per la sua leggerezza, occupa pochissime risorse, e per le prestazioni.
Se lo provate, con una buona connessione da ambo i lati, vi sembrerà davvero di essere in rete locale.
La connessione tra i due punti è cifrata e quindi sicura.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;perche-usarlo&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#perche-usarlo&quot; aria-label=&quot;Anchor link for: perche-usarlo&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
Perché usarlo&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Collegarsi alla propria rete domestica da fuori casa (senza esporre pubblicamente i servizi, ma solo la porta della vpn)&lt;&#x2F;li&gt;
&lt;li&gt;Amministrare &#x2F; gestire dispositivi di: amici &#x2F; parenti &#x2F; clienti&lt;&#x2F;li&gt;
&lt;li&gt;Condividere risorse locali solo con chi si vuole&lt;&#x2F;li&gt;
&lt;li&gt;Anonimato (navigare sul web come se fisicamente si ci trovasse nella rete del server vpn)&lt;&#x2F;li&gt;
&lt;li&gt;Sicurezza: se si è connessi ad una rete pubblica il nostro traffico sarà comunque cifrato&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;blocco pubblicità su smartphone&lt;&#x2F;strong&gt; se usato in accoppiata a #pihole (seguirà articolo dedicato)&lt;&#x2F;li&gt;
&lt;li&gt;Supporto dello &lt;strong&gt;split tunnel&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;caratteristiche&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#caratteristiche&quot; aria-label=&quot;Anchor link for: caratteristiche&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
Caratteristiche&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Si basa su protocollo udp, e non tcp per avere prestazioni migliori&lt;&#x2F;li&gt;
&lt;li&gt;Disponibile per svariati sistemi operativi&lt;&#x2F;li&gt;
&lt;li&gt;Funziona su tutti i dispositivi mobili&lt;&#x2F;li&gt;
&lt;li&gt;Risorse richieste quasi nulle, funziona benissimo su vecchi pc o su #raspberrypi&lt;&#x2F;li&gt;
&lt;li&gt;Configurazione facile con un &lt;strong&gt;file unico&lt;&#x2F;strong&gt; (portatile)&lt;&#x2F;li&gt;
&lt;li&gt;Configurazione tramite &lt;strong&gt;qr code&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Possibilità di avere più &lt;strong&gt;vpn attive contemporaneamente&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;img.agostinelli.eu&#x2F;2024&#x2F;wireguard-roadwarrior-splittunnel.png&quot; alt=&quot;Wireguard Connections&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;creare-una-nuova-connessione&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#creare-una-nuova-connessione&quot; aria-label=&quot;Anchor link for: creare-una-nuova-connessione&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
Creare una nuova connessione&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;Installare il software&lt;&#x2F;li&gt;
&lt;li&gt;Scgliere una porta udp dedicata&lt;&#x2F;li&gt;
&lt;li&gt;Abllitare il forwarding della porta sul nostro router&lt;&#x2F;li&gt;
&lt;li&gt;Scelta di una subnet (dedicata)&lt;&#x2F;li&gt;
&lt;li&gt;Abilitare il forwarding dei pacchetti ip&lt;&#x2F;li&gt;
&lt;li&gt;Creare la configurazione&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;configurazione-manuale-da-riga-di-comando&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#configurazione-manuale-da-riga-di-comando&quot; aria-label=&quot;Anchor link for: configurazione-manuale-da-riga-di-comando&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
Configurazione manuale (da riga di comando)&lt;&#x2F;h3&gt;
&lt;p&gt;Di seguito vari comandi, divisi per argomento, che permettono di attivare la nostra prima vpn.
La preshared key &lt;strong&gt;non è obbligatoria&lt;&#x2F;strong&gt; ma se la si usa si renderà la connessione ancora piuù sicura.
Negli esempi sottostanti abbiamo scelto 92.168.20.0&#x2F;24 come subnet per la nostra vpn.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;installazione-debian&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#installazione-debian&quot; aria-label=&quot;Anchor link for: installazione-debian&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
Installazione (debian)&lt;&#x2F;h4&gt;
&lt;pre class=&quot;z-code&quot;&gt;&lt;code&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;sudo apt update
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;sudo apt install wireguard
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;sudo vi &#x2F;etc&#x2F;sysctl.conf
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;	net.ipv4.ip_forward=1
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;sudo sysctl -p
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h3 id=&quot;generazione-chiavi&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#generazione-chiavi&quot; aria-label=&quot;Anchor link for: generazione-chiavi&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
Generazione chiavi&lt;&#x2F;h3&gt;
&lt;p&gt;Le chiavi generate vanno sia per una configurazione come server che come client&lt;&#x2F;p&gt;
&lt;pre class=&quot;z-code&quot;&gt;&lt;code&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;umask 077
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;wg genkey &amp;gt; privatekey
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;wg pubkey &amp;lt; privatekey &amp;gt; publickey
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;wg genpsk &amp;gt; preshared.keys
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h4 id=&quot;esempio-di-file-conf-del-server&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#esempio-di-file-conf-del-server&quot; aria-label=&quot;Anchor link for: esempio-di-file-conf-del-server&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
Esempio di file conf del server&lt;&#x2F;h4&gt;
&lt;pre class=&quot;z-code&quot;&gt;&lt;code&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;&#x2F;etc&#x2F;wireguard&#x2F;wg0.conf
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;[Interface]
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;PrivateKey = chiave_privata_server
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;Address = 192.168.20.1&#x2F;24
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;ListenPort = 52001
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;SaveConfig = true
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;PostUp = iptables -t nat -I POSTROUTING -o eth0 -j MASQUERADE
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;PreDown = iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;[Peer]
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;PublicKey = chiave_pub_client_1
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;PresharedKey = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;AllowedIPs = 192.168.20.2&#x2F;32
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h4 id=&quot;esempio-di-file-conf-del-client&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#esempio-di-file-conf-del-client&quot; aria-label=&quot;Anchor link for: esempio-di-file-conf-del-client&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
Esempio di file conf del client&lt;&#x2F;h4&gt;
&lt;pre class=&quot;z-code&quot;&gt;&lt;code&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;[Interface]
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;PrivateKey = chiave_priv_client1
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;Address = 192.168.20.2&#x2F;24
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;[Peer]
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;PublicKey = chiave_pub_server
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;PresharedKey = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;AllowedIPs = 0.0.0.0&#x2F;0, ::&#x2F;0
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;Endpoint = hostname_pubblico_server:52001
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h4 id=&quot;comandi-per-la-connessione&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#comandi-per-la-connessione&quot; aria-label=&quot;Anchor link for: comandi-per-la-connessione&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
Comandi per la connessione&lt;&#x2F;h4&gt;
&lt;pre class=&quot;z-code&quot;&gt;&lt;code&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;sudo wg-quick up wg1
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;sudo wg-quick down wg1
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;sudo wh show
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h4 id=&quot;avvio-automatico-con-systemd&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#avvio-automatico-con-systemd&quot; aria-label=&quot;Anchor link for: avvio-automatico-con-systemd&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
Avvio automatico con systemd&lt;&#x2F;h4&gt;
&lt;pre class=&quot;z-code&quot;&gt;&lt;code&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;sudo systemctl enable wg-quick@wg0.service
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;sudo systemctl start wg-quick@wg0.service
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;sudo systemctl status wg-quick@wg0.service
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h4 id=&quot;generare-qr-code&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#generare-qr-code&quot; aria-label=&quot;Anchor link for: generare-qr-code&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
Generare Qr code&lt;&#x2F;h4&gt;
&lt;p&gt;Installare il software qrencode&lt;&#x2F;p&gt;
&lt;pre class=&quot;z-code&quot;&gt;&lt;code&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;qrencode -t ansiutf8 &amp;lt; &#x2F;etc&#x2F;wireguard&#x2F;clients&#x2F;client1.conf
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;img.agostinelli.eu&#x2F;2024&#x2F;wireguard_show.jpg&quot; alt=&quot;Wireguard Command Line&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;aggiunta-nuovi-client&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#aggiunta-nuovi-client&quot; aria-label=&quot;Anchor link for: aggiunta-nuovi-client&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
Aggiunta nuovi client&lt;&#x2F;h2&gt;
&lt;p&gt;Per aggiungere un nuovo client, conviene spengere la vpn del server (wg down), aggiungere le nuove righe al file di configurazione, e riattivare la connessione (wg up)&lt;&#x2F;p&gt;
&lt;h3 id=&quot;configurazione-guidata&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#configurazione-guidata&quot; aria-label=&quot;Anchor link for: configurazione-guidata&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
Configurazione guidata&lt;&#x2F;h3&gt;
&lt;p&gt;Vedi i due frontend web  suggeriti sotto per la parte server.
Per la configurazione come client è sufficiente importare il file conf generato o in alternativa il qr code.
Per la connessione è sufficiente utilizzare un client;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Su linux è possibile usare li strumenti integrati nel desktop in uso attraverso NetworkManager (kde, gnome, ecc)&lt;&#x2F;li&gt;
&lt;li&gt;Su windows è sufficiente scaricare il client dal sito ufficiale (https:&#x2F;&#x2F;www.wireguard.com)&lt;&#x2F;li&gt;
&lt;li&gt;Android Play store: https:&#x2F;&#x2F;play.google.com&#x2F;store&#x2F;apps&#x2F;details?id=com.wireguard.android&lt;&#x2F;li&gt;
&lt;li&gt;Apple store: https:&#x2F;&#x2F;apps.apple.com&#x2F;it&#x2F;app&#x2F;wireguard&#x2F;id1441195209&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;programmi-accessori-frontend&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#programmi-accessori-frontend&quot; aria-label=&quot;Anchor link for: programmi-accessori-frontend&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
Programmi accessori (frontend)&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;https:&#x2F;&#x2F;github.com&#x2F;ngoduykhanh&#x2F;wireguard-ui&lt;&#x2F;li&gt;
&lt;li&gt;https:&#x2F;&#x2F;github.com&#x2F;wg-easy&#x2F;wg-easy&lt;&#x2F;li&gt;
&lt;li&gt;https:&#x2F;&#x2F;github.com&#x2F;subspacecloud&#x2F;subspace&lt;&#x2F;li&gt;
&lt;li&gt;https:&#x2F;&#x2F;www.wireguardconfig.com&#x2F;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;funzioni-avanzate&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#funzioni-avanzate&quot; aria-label=&quot;Anchor link for: funzioni-avanzate&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
Funzioni avanzate&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;dns&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#dns&quot; aria-label=&quot;Anchor link for: dns&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
Dns&lt;&#x2F;h3&gt;
&lt;p&gt;Nella configurazione del client è anche possibile indicare quale server dns utilizzare&lt;&#x2F;p&gt;
&lt;h3 id=&quot;firewall-per-i-client&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#firewall-per-i-client&quot; aria-label=&quot;Anchor link for: firewall-per-i-client&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
Firewall per i client&lt;&#x2F;h3&gt;
&lt;p&gt;Nalle configurazione server è possibile aggiungere più righe di PostUp con &lt;strong&gt;iptables&lt;&#x2F;strong&gt;, e quindi configurare il firewall con assoluta personalizzazione: è possibile, quindi, limitare la risorse da accedere a specifici indirizzi&lt;&#x2F;p&gt;
&lt;h3 id=&quot;limitare-la-banda&quot;&gt;&lt;a class=&quot;header-anchor no-hover-padding&quot; href=&quot;#limitare-la-banda&quot; aria-label=&quot;Anchor link for: limitare-la-banda&quot;&gt;&lt;span class=&quot;link-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;a&gt;
Limitare la banda&lt;&#x2F;h3&gt;
&lt;p&gt;Sempre grazie ai comandi postup è possibile anche limitare, qualora si voglia, la banda passante per i client (sia in upload che ion download), ad esempio:&lt;&#x2F;p&gt;
&lt;pre class=&quot;z-code&quot;&gt;&lt;code&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;PostUp = tc qdisc add dev wg0 ingress; tc filter add dev wg1 protocol ip ingress prio 2 u32 match ip dst 0.0.0.0&#x2F;0 action police
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;rate 10mbit burst 10mbit; tc filter add dev wg0 protocol ip ingress prio 2 u32 match ip src 0.0.0.0&#x2F;0 action police rate 10mbit burst 10mbit
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;PostUp = tc qdisc add dev wg0 parent root handle 1: hfsc default 1; tc class add dev wg0 parent 1: classid 1:1 hfsc sc rate 10mbit ul rate 10mbit
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;img.agostinelli.eu&#x2F;2024&#x2F;wireguard_network.png&quot; alt=&quot;Wireguard Network&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
</description>
      </item>
    </channel>
</rss>
