TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

How to Setup a Secure VPN Server on Raspberry Pi or DigitalOcean

154 pointsby spaceboyover 8 years ago

22 comments

lwfover 8 years ago
The recommendation to use a 1024-bit RSA key worries me. In an era of passive, bulk surveillance, that seems too weak if you&#x27;re not going to be using any additional transport-layer security.<p>The performance argument is only relevant for the establishment of the VPN connection and any periodic rekeying ­— it <i>shouldn&#x27;t</i> have any impact on the tunnel&#x27;s perf.<p>It&#x27;s a shame openvpn&#x27;s easy-rsa doesn&#x27;t provide a straightforward mechanism to generate ECDSA certificates, which would&#x27;ve removed any performance concerns.<p>--<p>edit: easy-rsa <i>does</i> support ECDSA[1]:<p><i>Support for generating an ECDSA certificate chain is available in EasyRSA (in spite of it&#x27;s name) since EasyRSA 3.0. The parameters you&#x27;re looking for are &#x27;--use-algo=ec&#x27; and &#x27;--curve=&lt;curve_name&gt;&#x27;. See the EasyRSA documentation for more details on generating ECDSA certificates.</i><p><a href="https:&#x2F;&#x2F;github.com&#x2F;OpenVPN&#x2F;openvpn&#x2F;blob&#x2F;master&#x2F;README.ec" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;OpenVPN&#x2F;openvpn&#x2F;blob&#x2F;master&#x2F;README.ec</a>
fauigerzigerkover 8 years ago
Using a socks 5 tunnel over ssh seems like an interesting ad hoc alternative for web browsing only: <a href="https:&#x2F;&#x2F;www.digitalocean.com&#x2F;community&#x2F;tutorials&#x2F;how-to-route-web-traffic-securely-without-a-vpn-using-a-socks-tunnel" rel="nofollow">https:&#x2F;&#x2F;www.digitalocean.com&#x2F;community&#x2F;tutorials&#x2F;how-to-rout...</a><p>But crucially you&#x27;d want to make your browser use the tunnel for DNS as well: <a href="http:&#x2F;&#x2F;superuser.com&#x2F;questions&#x2F;103593&#x2F;how-to-do-dns-through-a-proxy-in-firefox&#x2F;260658#260658" rel="nofollow">http:&#x2F;&#x2F;superuser.com&#x2F;questions&#x2F;103593&#x2F;how-to-do-dns-through-...</a><p>Careful if you&#x27;re using this for something dangerous. I&#x27;m not a computer security expert by any stretch and I don&#x27;t know whether the people who have written these articles are. Chances are that this is completely broken and will reveal your IP address and identity.
评论 #13623636 未加载
noarchyover 8 years ago
Regarding DigitalOcean VPNs, I think enough people have been doing this that it is starting to show in unpleasant ways. While using my DO VPN I&#x27;ve encountered captchas while using YouTube, of all sites, likely because of abuse they&#x27;ve seen at the hands of DO VPN users. I&#x27;ve also seen my DO IP range outright banned by other sites.
评论 #13623553 未加载
评论 #13623568 未加载
freestockoptionover 8 years ago
I prefer to use layer2 bridging in OpenVPN with a separate hardware device (openwrt on a wallwart router, rackmount atom board). This way my client machines have no idea they are on a VPN and everything gets tunneled though the VPN (no DNS leaks unless my router is misconfigured).<p>In OpenWRT, it&#x27;s basically:<p>-setup OpenVPN with a TAP device<p>-create a VLAN, assign some ports on the switch (optionally, a wifi SSID for VPNed wifi)<p>-bridge VLAN with TAP device
tribbyover 8 years ago
this is not secure; it will leak your ipv6 address by default. use openvpn&#x27;s ipv6 features to route ipv6 traffic as well[0]. using openvpn ipv6 is a PITA on digitalocean because they only provide a &#x2F;124, when openvpn requires at least a &#x2F;112. you can get around this using ip6tables to route a &#x2F;112 address range you don&#x27;t actually have access to, and the only consequence will be a loopback if you try to access one of the digitalocean IPs you are claiming to have in your available pool while connected to the VPN.<p>also, 1024 dh prime is unsafe depending on your threat model[1]. use 2048 if nation states bother you, or 4096 if truly paranoid or at high risk &#x2F; performance isn&#x27;t an issue. no reason not to bump up the RSA keys too.<p>0. <a href="https:&#x2F;&#x2F;community.openvpn.net&#x2F;openvpn&#x2F;wiki&#x2F;IPv6" rel="nofollow">https:&#x2F;&#x2F;community.openvpn.net&#x2F;openvpn&#x2F;wiki&#x2F;IPv6</a><p>1. <a href="https:&#x2F;&#x2F;weakdh.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;weakdh.org&#x2F;</a>
maulwuffover 8 years ago
Yet another setup which forgets that there is a world outside IPv4. Any IPv6 traffic will not pass through the VPN but instead bypass it.
Perceptesover 8 years ago
A good alternative is Algo: <a href="https:&#x2F;&#x2F;github.com&#x2F;trailofbits&#x2F;algo" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;trailofbits&#x2F;algo</a>
评论 #13623209 未加载
nodesocketover 8 years ago
Nice post. I actually just wrote a post myself on setting up a native Cisco IPsec VPN sever on a Raspberry Pi 3. Cisco IPsec works natively on macOS and iOS with no 3rd party software which was a requirement for me.<p><a href="https:&#x2F;&#x2F;blog.elasticbyte.net&#x2F;setting-up-a-native-cisco-ipsec-vpn-server-using-a-raspberry-pi&#x2F;" rel="nofollow">https:&#x2F;&#x2F;blog.elasticbyte.net&#x2F;setting-up-a-native-cisco-ipsec...</a>
akosterover 8 years ago
Another alternative (specific to the pi): <a href="http:&#x2F;&#x2F;www.pivpn.io" rel="nofollow">http:&#x2F;&#x2F;www.pivpn.io</a>
hedoraover 8 years ago
Is there an easy way to enable DNS over OpenVPN? That appears to be the biggest hole in this tutorial. Untrusted networks get to observe&#x2F;spoof DNS, and the clients can&#x27;t use the LAN DNS server to find stuff behind the firewall. (Or am I missing something?)
评论 #13624498 未加载
suprjamiover 8 years ago
This seems a bit pointless to me.<p>If your aim is to hide your traffic from third-party networks you might be on (free wifi, school, hotels, etc) then a yearly VPN subscription is almost certainly cheaper than the cheapest DigitalOcean droplet. If you get a good provider (I use PIA but am not affiliated with them) then you get unlimited traffic, multiple clients, endpoints all over the world, tech support, all without having to setup and administer the server yourself.<p>If your aim is to disassociate traffic with yourself, your DigitalOcean IP will be tied back to you anyway.<p>If your aim is to stop government snooping, DigitalOcean is hosted in the USA so you may as well just send the NSA your browsing history.
评论 #13626483 未加载
评论 #13625794 未加载
dborehamover 8 years ago
Interesting. I have set up a few VPN servers of various kinds (and other network trickery) in Virtual Machine hosting services, and ultimately gave up due to issues with TSO (TCP Segmentation Offload <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Large_receive_offload" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Large_receive_offload</a>) interacting badly with PMTUD (<a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Path_MTU_Discovery" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Path_MTU_Discovery</a>). The result was that TCP streams (often Downton Abbey, fwiw) inbound from a remote server, tunneled to me via the VPN, would stall and generally suffer from poor QoS.<p>I spent some time submitting support tickets to all the hosting providers I had tried (many). Every one of them told me that they had no way to disable TSO and the other common TCP offload features on their hosts.<p>So now I use Packet.net which gives me a honest to goodness actual bare metal machine (over which I have complete control), for much the same price.
no_wizardover 8 years ago
This reminded me of <a href="https:&#x2F;&#x2F;www.softether.org" rel="nofollow">https:&#x2F;&#x2F;www.softether.org</a> which is purported to be a faster and just as secure Alternative to openVPN and looks pretty straightforward to setup. I did post another thread in this but I&#x27;m not sure if it&#x27;s inappropriate to post here too....wondering if anyone has had experience with it<p>Also shoutout to Dr Duh who gave a nice run down of setting up vpn on a VPS<p><a href="https:&#x2F;&#x2F;github.com&#x2F;drduh&#x2F;Debian-Privacy-Server-Guide&#x2F;blob&#x2F;master&#x2F;README.md#openvpn" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;drduh&#x2F;Debian-Privacy-Server-Guide&#x2F;blob&#x2F;ma...</a><p>Edit: Just realized that others have already noted and commented about SoftEther. Sorry guys!
git-sgmooreover 8 years ago
These are the steps I take: <a href="https:&#x2F;&#x2F;github.com&#x2F;git-sgmoore&#x2F;OpenVPN_Ipsec_L2tp_server_on_Digital_Ocean" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;git-sgmoore&#x2F;OpenVPN_Ipsec_L2tp_server_on_...</a>
btgeekboyover 8 years ago
If it&#x27;s just for yourself, install the OpenVPN AS (Access Server), and call it a day. You get 2 free simultaneous users, and it deals with all of the certificates, etc for you.
leni536over 8 years ago
I use zerotier instead of openvpn, I really like the p2p aspect of it.
jonatbergnover 8 years ago
I use <a href="https:&#x2F;&#x2F;www.softether.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.softether.org&#x2F;</a>. Setup of a VPN server never was easier.
评论 #13625770 未加载
scandoxover 8 years ago
I did a reasonably detailed tutorial for setting up your own VPN with Softether<p><a href="http:&#x2F;&#x2F;www.selectedintelligence.com&#x2F;post&#x2F;128701492804&#x2F;softether" rel="nofollow">http:&#x2F;&#x2F;www.selectedintelligence.com&#x2F;post&#x2F;128701492804&#x2F;softet...</a>
caspereekoover 8 years ago
You can check oh-my-vpn to setup openvpn server in a oneliner command. <a href="https:&#x2F;&#x2F;github.com&#x2F;alaa&#x2F;oh-my-vpn" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;alaa&#x2F;oh-my-vpn</a>
rtnyftxxover 8 years ago
just in case <a href="https:&#x2F;&#x2F;bettercrypto.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;bettercrypto.org&#x2F;</a>
pyedover 8 years ago
... or just use a docker container.
118383over 8 years ago
Not really that knowledgeable about maintaining servers, but is it really enough, but is it really enough to just straight away &#x27;apt-get openvpn&#x27;.<p>Surely for it to be a &#x27;secure VPN server&#x27; there has got to be some stuff set up first, like setting up key only login, disabling root ssh login, disabling everything ssh, setting up firewall, disabling ipv6 entirely in the case of openvpn?<p>I run a vpn on digital ocean and its amazing looking at the logs and seeing how quickly, and how many attempts there are to break into the server straight after setting it up. As a person who isnt completely sure of what i am doing when it comes to firewalls and setting up &#x27;jails&#x27; or whatever, this kinda makes me uneasy. I wouldnt even be sure how to tell if anyone had broken in to my server...<p><a href="https:&#x2F;&#x2F;www.linode.com&#x2F;docs&#x2F;networking&#x2F;vpn&#x2F;set-up-a-hardened-openvpn-server" rel="nofollow">https:&#x2F;&#x2F;www.linode.com&#x2F;docs&#x2F;networking&#x2F;vpn&#x2F;set-up-a-hardened...</a><p>This has been the most useful guide that I have found on setting up an openvpn server. It has a bunch of steps to go through before you get to actually installing openvpn. But as I said, I am not that knowledgeable myself when it comes to running a server, so this may all just be unnecessary.
评论 #13628329 未加载