EdgeVPN – Overview https://mudler.github.io/edgevpn/docs/concepts/overview/ Recent content in Overview on EdgeVPN Hugo -- gohugo.io Docs: Tunnel connections https://mudler.github.io/edgevpn/docs/concepts/overview/services/ Mon, 01 Jan 0001 00:00:00 +0000 https://mudler.github.io/edgevpn/docs/concepts/overview/services/ <h2 id="forwarding-a-local-connection">Forwarding a local connection</h2> <p>EdgeVPN can also be used to expose local(or remote) services without establishing a VPN and allocating a local tun/tap device, similarly to <code>ngrok</code>.</p> <h3 id="exposing-a-service">Exposing a service</h3> <p>If you are used to how Local SSH forwarding works (e.g. <code>ssh -L 9090:something:remote &lt;my_node&gt;</code>), EdgeVPN takes a similar approach.</p> <p>A Service is a generalized TCP service running in a host (also outside the network). For example, let&rsquo;s say that we want to expose a SSH server inside a LAN.</p> <p>To expose a service to your EdgeVPN network then:</p> <div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">$ edgevpn service-add <span style="color:#4e9a06">&#34;MyCoolService&#34;</span> <span style="color:#4e9a06">&#34;127.0.0.1:22&#34;</span> </code></pre></div><p>To reach the service, EdgeVPN will setup a local port and bind to it, it will tunnel the traffic to the service over the VPN, for e.g. to bind locally to <code>9090</code>:</p> <div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">$ edgevpn service-connect <span style="color:#4e9a06">&#34;MyCoolService&#34;</span> <span style="color:#4e9a06">&#34;127.0.0.1:9090&#34;</span> </code></pre></div><p>with the example above, &lsquo;sshing into <code>9090</code> locally would forward to <code>22</code>.</p> Docs: DNS https://mudler.github.io/edgevpn/docs/concepts/overview/dns/ Thu, 05 Jan 2017 00:00:00 +0000 https://mudler.github.io/edgevpn/docs/concepts/overview/dns/ <div class="pageinfo pageinfo-warning"> <p>Experimental feature!</p> </div> <h2 id="dns-server">DNS Server</h2> <p>A DNS Server is available but disabled by default.</p> <p>The DNS server will resolve DNS queries using the blockchain as a record and will forward unknown domains by default.</p> <p>It can be enabled by specifying a listening address with <code>--dns</code>. For example, to bind to default <code>53</code> port locally, run in the console:</p> <div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">edgevpn --dns <span style="color:#4e9a06">&#34;127.0.0.1:53&#34;</span> </code></pre></div><p>To turn off dns forwarding, specify <code>--dns-forwarder=false</code>. Optionally a list of DNS servers can be specified multiple times with <code>--dns-forward-server</code>.</p> <p>The dns subcommand has several options:</p> <pre tabindex="0"><code> --dns value DNS listening address. Empty to disable dns server [$DNSADDRESS] --dns-forwarder Enables dns forwarding [$DNSFORWARD] --dns-cache-size value DNS LRU cache size (default: 200) [$DNSCACHESIZE] --dns-forward-server value List of DNS forward server (default: &quot;8.8.8.8:53&quot;, &quot;1.1.1.1:53&quot;) [$DNSFORWARDSERVER] </code></pre><p>Nodes of the VPN can start a local DNS server which will resolve the routes stored in the chain.</p> <p>For example, to add DNS records, use the API as such:</p> <div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">$ curl -X POST http://localhost:8080/api/dns --header <span style="color:#4e9a06">&#34;Content-Type: application/json&#34;</span> -d <span style="color:#4e9a06">&#39;{ &#34;Regex&#34;: &#34;foo.bar&#34;, &#34;Records&#34;: { &#34;A&#34;: &#34;2.2.2.2&#34; } }&#39;</span> </code></pre></div><p>The <code>/api/dns</code> routes accepts <code>POST</code> requests as <code>JSON</code> of the following form:</p> <div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-json" data-lang="json"><span style="color:#000;font-weight:bold">{</span> <span style="color:#204a87;font-weight:bold">&#34;Regex&#34;</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">&#34;&lt;regex&gt;&#34;</span><span style="color:#000;font-weight:bold">,</span> <span style="color:#204a87;font-weight:bold">&#34;Records&#34;</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#000;font-weight:bold">{</span> <span style="color:#204a87;font-weight:bold">&#34;A&#34;</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">&#34;2.2.2.2&#34;</span><span style="color:#000;font-weight:bold">,</span> <span style="color:#204a87;font-weight:bold">&#34;AAAA&#34;</span><span style="color:#000;font-weight:bold">:</span> <span style="color:#4e9a06">&#34;...&#34;</span><span style="color:#000;font-weight:bold">,</span> <span style="color:#000;font-weight:bold">},</span> <span style="color:#000;font-weight:bold">}</span> </code></pre></div><p>Note, <code>Regex</code> accepts regexes which will match the DNS requests received and resolved to the specified entries.</p> Docs: Sending and receiving files https://mudler.github.io/edgevpn/docs/concepts/overview/files/ Thu, 05 Jan 2017 00:00:00 +0000 https://mudler.github.io/edgevpn/docs/concepts/overview/files/ <h2 id="sending-and-receiving-files">Sending and receiving files</h2> <p>EdgeVPN can be used to send and receive files between hosts via p2p with the <code>file-send</code> and <code>file-receive</code> subcommand.</p> <p>Sending and receiving files, as services, don&rsquo;t establish a VPN connection.</p> <h3 id="sending">Sending</h3> <div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">$ edgevpn file-send --name unique-id --path /src/path </code></pre></div><h3 id="receiving">Receiving</h3> <div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">$ edgevpn file-receive --name unique-id --path /dst/path </code></pre></div> Docs: Peerguardian https://mudler.github.io/edgevpn/docs/concepts/overview/peerguardian/ Wed, 05 Jan 2022 00:00:00 +0000 https://mudler.github.io/edgevpn/docs/concepts/overview/peerguardian/ <div class="pageinfo pageinfo-warning"> <p>Experimental feature!</p> </div> <h2 id="peerguardian">Peerguardian</h2> <p>PeerGuardian is a mechanism to prevent unauthorized access to the network if tokens are leaked or either revoke network access.</p> <p>In order to enable it, start edgevpn nodes adding the <code>--peerguradian</code> flag.</p> <div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">edgevpn --peerguardian </code></pre></div><p>To turn on peer gating, specify also <code>--peergate</code>.</p> <p>Peerguardian and peergating has several options:</p> <pre tabindex="0"><code> --peerguard Enable peerguard. (Experimental) [$PEERGUARD] --peergate Enable peergating. (Experimental) [$PEERGATE] --peergate-autoclean Enable peergating autoclean. (Experimental) [$PEERGATE_AUTOCLEAN] --peergate-relaxed Enable peergating relaxation. (Experimental) [$PEERGATE_RELAXED] --peergate-auth value Peergate auth [$PEERGATE_AUTH] --peergate-interval value Peergater interval time (default: 120) [$EDGEVPNPEERGATEINTERVAL] </code></pre><p>When the PeerGuardian and Peergater are enabled, a VPN node will only accepts blocks from authorized nodes.</p> <p>Peerguardian is extensible to support different mechanisms of authentication, we will see below specific implementations.</p> <h2 id="ecdsa-auth">ECDSA auth</h2> <p>The ECDSA authentication mechanism is used to verify peers in the blockchain using ECDSA keys.</p> <p>To generate a new ECDSA keypair use <code>edgevpn peergater ecdsa-genkey</code>:</p> <div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">$ edgevpn peergater ecdsa-genkey Private key: <span style="color:#000">LS0tLS1CRUdJTiBFQyBQUklWQVRFIEtFWS0tLS0tCk1JSGNBZ0VCQkVJQkhUZnRSTVZSRmlvaWZrdllhZEE2NXVRQXlSZTJSZHM0MW1UTGZlNlRIT3FBTTdkZW9sak0KZXVPbTk2V0hacEpzNlJiVU1tL3BCWnZZcElSZ0UwZDJjdUdnQndZRks0RUVBQ09oZ1lrRGdZWUFCQUdVWStMNQptUzcvVWVoSjg0b3JieGo3ZmZUMHBYZ09MSzNZWEZLMWVrSTlEWnR6YnZWOUdwMHl6OTB3aVZxajdpMDFVRnhVCnRKbU1lWURIRzBTQkNuVWpDZ0FGT3ByUURpTXBFR2xYTmZ4LzIvdEVySDIzZDNwSytraFdJbUIza01QL2tRNEIKZzJmYnk2cXJpY1dHd3B4TXBXNWxKZVZXUGlkeWJmMSs0cVhPTWdQbmRnPT0KLS0tLS1FTkQgRUMgUFJJVkFURSBLRVktLS0tLQo</span><span style="color:#ce5c00;font-weight:bold">=</span> Public key: <span style="color:#000">LS0tLS1CRUdJTiBFQyBQVUJMSUMgS0VZLS0tLS0KTUlHYk1CQUdCeXFHU000OUFnRUdCU3VCQkFBakE0R0dBQVFCbEdQaStaa3UvMUhvU2ZPS0syOFkrMzMwOUtWNApEaXl0MkZ4U3RYcENQUTJiYzI3MWZScWRNcy9kTUlsYW8rNHROVkJjVkxTWmpIbUF4eHRFZ1FwMUl3b0FCVHFhCjBBNGpLUkJwVnpYOGY5djdSS3g5dDNkNlN2cElWaUpnZDVERC81RU9BWU5uMjh1cXE0bkZoc0tjVEtWdVpTWGwKVmo0bmNtMzlmdUtsempJRDUzWT0KLS0tLS1FTkQgRUMgUFVCTElDIEtFWS0tLS0tCg</span><span style="color:#ce5c00;font-weight:bold">==</span> </code></pre></div><p>For example, to add a ECDSA public key, use the API as such from a node which is already trusted by PeerGuardian:</p> <div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">$ curl -X PUT <span style="color:#4e9a06">&#39;http://localhost:8080/api/ledger/trustzoneAuth/ecdsa_1/LS0tLS1CRUdJTiBFQyBQVUJMSUMgS0VZLS0tLS0KTUlHYk1CQUdCeXFHU000OUFnRUdCU3VCQkFBakE0R0dBQVFBL09TTjhsUU9Wa3FHOHNHbGJiellWamZkdVVvUAplMEpsWUVzOFAyU3o1TDlzVUtDYi9kQWkrVFVONXU0ZVk2REpGeU50dWZjK2p0THNVTTlPb0xXVnBXb0E0eEVDCk9VdDFmRVNaRzUxckc4MEdFVjBuQTlBRGFvOW1XK3p4dmkvQnd0ZFVvSTNjTDB0VTdlUGEvSGM4Z1FLMmVOdE0KeDdBSmNYcWpPNXZXWGxZZ2NkOD0KLS0tLS1FTkQgRUMgUFVCTElDIEtFWS0tLS0tCg==&#39;</span> </code></pre></div><p>Now the private key can be used while starting new nodes:</p> <div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash"><span style="color:#000">PEERGATE_AUTH</span><span style="color:#ce5c00;font-weight:bold">=</span><span style="color:#4e9a06">&#34;{ &#39;ecdsa&#39; : { &#39;private_key&#39;: &#39;LS0tLS1CRUdJTiBFQyBQUklWQVRFIEtFWS0tLS0tCk1JSGNBZ0VCQkVJQkhUZnRSTVZSRmlvaWZrdllhZEE2NXVRQXlSZTJSZHM0MW1UTGZlNlRIT3FBTTdkZW9sak0KZXVPbTk2V0hacEpzNlJiVU1tL3BCWnZZcElSZ0UwZDJjdUdnQndZRks0RUVBQ09oZ1lrRGdZWUFCQUdVWStMNQptUzcvVWVoSjg0b3JieGo3ZmZUMHBYZ09MSzNZWEZLMWVrSTlEWnR6YnZWOUdwMHl6OTB3aVZxajdpMDFVRnhVCnRKbU1lWURIRzBTQkNuVWpDZ0FGT3ByUURpTXBFR2xYTmZ4LzIvdEVySDIzZDNwSytraFdJbUIza01QL2tRNEIKZzJmYnk2cXJpY1dHd3B4TXBXNWxKZVZXUGlkeWJmMSs0cVhPTWdQbmRnPT0KLS0tLS1FTkQgRUMgUFJJVkFURSBLRVktLS0tLQo=&#39; } }&#34;</span> $ edgevpn --peerguardian --peergate </code></pre></div><h2 id="enablingdisabling-peergating-in-runtime">Enabling/Disabling peergating in runtime</h2> <p>Peergating can be disabled in runtime by leveraging the api:</p> <h3 id="query-status">Query status</h3> <div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">$ curl -X GET <span style="color:#4e9a06">&#39;http://localhost:8080/api/peergate&#39;</span> </code></pre></div><h3 id="enable-peergating">Enable peergating</h3> <div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">$ curl -X PUT <span style="color:#4e9a06">&#39;http://localhost:8080/api/peergate/enable&#39;</span> </code></pre></div><h3 id="disable-peergating">Disable peergating</h3> <div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">$ curl -X PUT <span style="color:#4e9a06">&#39;http://localhost:8080/api/peergate/disable&#39;</span> </code></pre></div><h2 id="starting-a-new-network">Starting a new network</h2> <p>To init a new Trusted network, start nodes with <code>--peergate-relaxed</code> and add the neccessary auth keys:</p> <div class="highlight"><pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">$ edgevpn --peerguardian --peergate --peergate-relaxed $ curl -X PUT <span style="color:#4e9a06">&#39;http://localhost:8080/api/ledger/trustzoneAuth/keytype_1/XXX&#39;</span> </code></pre></div> <div class="alert alert-primary" role="alert"> <h4 class="alert-heading">Note</h4> It is strongly suggested to use a local store for the blockchain with PeerGuardian. In this way nodes persist locally auth keys and you can avoid starting nodes with `&ndash;peergate-relaxed' </div>