Up to now I'm using a raspberry pi as a local server for trying out things or hosting my own little projects (beginner level), but I want to make it publicly available (most likely only for people I know, e.g. using self signed certificates). I know that you can never be 100% secure. All I ask is a fair chance.

I wonder why the opinions on self hosted webservers are that controversial. There are endless amounts of tutorials which claim to set up the server relatively safe, but on the other hand, especially in forums like this (obviously specialized in security), all you read is that it's extremely risky and disadvised.

I followed all of the obvious safety-mechanisms:

  • deactivating all unnecessary services
  • choosing secure passwords for multiple users (and deleting the default ones)
  • running apache on a non-sudo user with almost zero privileges
  • using SSH Keys
  • adjusting the read/write privileges on all relevant files
  • using iptables to block everything except 3 non-default ports for ssh, http and https
  • keeping everything up-to-date
  • fail2ban

Planned, if I don't discard the whole idea after this post:

  • preemtively blocking all IPs not from my country
  • using a separate wireless network, like a guestnetwork, for the pi

My questions boil down to:
What else would you recommend to secure the server?

and (disregarding DoS,evading access-control and using the compromised pi for illegal activity)
How would an attack look like, especially on the other devices in the local network if the only differences are the forwarded ports for http and https to the pi?

closed as too broad by Steffen Ullrich, schroeder Jul 26 '18 at 19:32

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    Do you mean "dangerous to the local network"? What danger are you talking about? – schroeder Jul 22 '18 at 16:37
  • You have covered most topics. The remaining topics are vulnerabilities within the web server and SSH server (zero day exploits). Review hardening Apache and OpenSSH (or your choice of servers). The guest network is a good idea, physical servers need a DMZ to mitigate LAN attacks. Running another router with port forwarding would also be viable. NAT is not your friend in this scenario. Finally, if you can afford the resources configure remote logging, possibly with rsyslog. – safesploit Jul 22 '18 at 16:52
  • I consider your question as too broad since you essentially ask multiple mostly independent questions: 1. Why is self-hosting a site considered dangerous (especially for beginners)? 2. What can be done additionally to secure the server? 3. How do attacks look like? - I would say that asking about 2+3 explains essentially 1. - i.e. not knowing how attacks look like (3) makes it hard to properly protect yourself (2) and that's why it is better to let professionals manage such servers (1). – Steffen Ullrich Jul 22 '18 at 18:43
  • @SteffenUllrich I understand where you are coming from but you just admitted that 2.+3. explain 1. and therefore they are not really independent. And all the questions combine each other to: "If these well known security mechanisms, which everybody knows and advises, are implemented, why is there still so much distrust?" Also, how are you supposed to become professional if you never try it? – Nesuma Jul 22 '18 at 21:02
  • @Nesuma: not the answer to 2+3 explains 1 but the fact that you need to ask about 2+3 in the first place. The questions are still mostly independent. – Steffen Ullrich Jul 22 '18 at 21:42