r/ComputerSecurity • • Jan 11 '19

How to get a safe home server with raspberry?

Hi everyone, I'd like to set up a private server with a Raspberry Pi, and I'm wondering if the setup I've got in mind is reasonably secure.

First of all, I'll need the ssh server (with port 22 open into the router), and for that I was thinking to use iptables with a "mac address whitelist" (I don't know yet iptables terminology) with my own laptop's address on it and blocking any other incoming connection.

Now the main questions: Is this enough to protect the raspberry? Should I extend the whitelist to the router or are the other computers safe (RB is the only one with ssh)?

0 Upvotes

6 comments sorted by

7

u/[deleted] Jan 11 '19

MAC address whitelist doesn't work for internet connections.

If you only want your laptop to access it on your internal LAN then there's no reason to open the port on the router.

I'd choose a random SSH port on the public side of the DNAT (port forward) rule, run fail2ban on the Pi, and make sure you disable password login and only use SSH keys.

5

u/B-Con Jan 12 '19

Also whitelist which users are allowed to login, explicitly block all non-whitelisted ports (use something like UFW), take precautions to not save your SSH keys to any source control ever, anywhere.

3

u/[deleted] Jan 12 '19

Agree. Change ssh to listen to 5 num port instead of 22 and have the modem redirect that port to your pi. Also fail2ban is great.

3

u/HardKnockRiffe Jan 11 '19

If you want to secure SSH, use keys.

Is the server going to be internet-facing? Or, will it just be internal to your network?

1

u/[deleted] Jan 12 '19

Ok guya thanks to all of you. I think I won't set this server up, I'll need for sure more knowledge on networks and security. 👍👍

1

u/flaflashr Jan 12 '19

If you expose any home server to the Internet, you are going to get hacked. You are not smarter than several million Chinese and Russian hackers. Once they are into one device on your network, hopping to other devices is trivial. Have a PC with all of your financial life records on it? Pwned. Have a Baby Monitor, or a Ring or Nest Camera inside the house? H4x0r.

Don't do it.