Hello. I’m pretty new here. I just managed to get my Raspberry Pi setup at home to selfhost a simple website that will act as my portfolio for some art I do.
I’m using WordPress to make the content of the website, meaning it runs on Apache, MariaDB and MySQL in the background. It’s connected via port 80 since I don’t want to pay for SSL certificates to setup https. There will be no accounts or transactions happening on my website. I don’t have anything to manage my dynamic IP but I’ll figure that out later. I’ve deleted the default Pi user on the RPi.
Are there security issues I should address preemptively? I’m worried for instance that I am exposing my home network, making it easier for someone to breach into whatever is connected there.
Any tips on making sure my setup is secure?
Let’s Encrypt is good practice, but IMO if you’re just serving the same static webpage to all users, it doesn’t really matter.
Given that it’s a tiny raspi, I’d recommend reducing the overhead that WordPress brings and just statically serve a directory with your site. Whether that means using wp static site options, or moving away from wp entirely is up to you.
The worst case scenario would be someone finding a vulnerability in the services that are publicly exposed (Apache), getting persistence on the device, and using that to pivot to other devices on your network. If possible, you may consider putting it in a routing DMZ. Make sure that the pi can only see the internet and whatever device you plan to maintain it with. That way even if someone somehow owns it completely, they won’t be able to find any other devices to hack.
Go https, today there is no real reason not to and tons of good reasons to do it.
Let’s encrypt is 100% free and using their certbot its also automated and easy to do.
Thanks, I’ll look into it. I didn’t know there were free SSL certs out there
Yeah, afaik, you just need to install
letsencrpyt
and then run the command with sudo. It’ll scan your apache conf and generate you an ssl version. Just make sure to include your domain name in the ServerName directive
It may or may not be a concern to you, but if you are hosting it from your home then people will be able to determine your IP and rough physical location.
If you’re on American cable internet and expecting a lot of traffic, your upload speed may become a problem.
since I don’t want to pay for SSL certificates to setup https.
You don’t need to pay for SSL certs anymore, most of the time. You can get them for free from a bunch of different places now. I use Let’s Encrypt. The web server/reverse proxy I use, Caddy is able to automatically get a cert for you, install it, and keep it renewed. The only time you need to pay for a cert is if you are handling financial transactions.
Are there security issues I should address preemptively?
WordPress itself has a generally good reputation for security, though depending on how the current drama goes, that may change. WordPress security problems have almost always stemmed from plugins or poor password hygiene. Remove any plugins you are not actively using, keep the ones you are using updated, and use a good password that you don’t use anywhere else. A password wallet like Bit Warden can generate and store such passwords for you.
Better on the security front would be to evaluate whether you actually need something like WordPress at all. A static site would likely be far more secure. There’s less moving parts that might be vulnerable.
While you could program a static site yourself, it’s more common nowadays to use a static site generator like Hugo to build the site. You set it up once for how you want the site to look and then you write your posts in markdown or whatever your particular generator uses.
I don’t have anything to manage my dynamic IP
Most domain name providers have some sort of setup for dealing with dynamic IP addresses, a program called
ddclient
is pretty common and is available in most repos.Alright everyone, thank you so much for your thoughtful recommendations! To sum it up, here’s what I have done:
- I used let’s encrypt’s Certbot to get my SSL certs and setup https, auto-renew every 3 months and I setup a reminder to update Certbot every month.
- I setup a permanent redirect from http to https in Apache
- I installed a firewall on the Pi, only 80, 443 and [22 from my computer to the RPi] are open. I couldn’t find the firewall settings on my router but I assume they exist since I had to forward 80 and 443 there.
- installed the following plugins: WordFence and WP Fail2Ban
- changed the user password on the pi to a better longer one
I think I should be all set, shouldn’t I?
You may want to consider dockerizing your services just for maintainability and isolation from your host. I recommend something like Nginx Proxy Manager to serve as the “main entrance” for your docker network and to handle Let’s Encrypt for you.
I second this. I didn’t understand that until…you know, like you install the latest python or something and then your website is proof! Gone. Dockerization gives it a little bit of stability.
Definitely use cloudflare in front of your website
In my experience cloudflare has an issue with being slow