1

Firstly, I'm a complete beginner with Raspberry Pi and Linux, so sorry if I don't say or understand everything correctly :)

Is it possible to create a web server with Apache, PHP, MYSQL (and phpmyadmin) and then restrict access to the server based on MAC addresses. Basically, I'm looking to whitelist a few MAC addresses in my house and then I can be (kind of) worry free for hacking (although I don't really have very sensitive data on it). I can't find anything on Google regarding this, with my searches something like rpi web server restrict and variations.

Please either link to websites saying how to do this, or tell me yourself (whilst remembering I'm a beginner, but not complete alien :)

0

2 Answers 2

3

What you want to do is called mac address filtering. This page should get you started in the right direction - this is not a foolproof method of securing a box since the mac address can be spoofed.

If you are only accessing the Pi from your local network and are behind a cable or DSL modem that does NAT a host based firewall may be enough (check out uncomplicated firewall - a simple interface for iptables). If you are going to access this from outside your local network then I would add SSH tunneling or a VPN (in addition to the firewall), both of which may require configuring your router to forward the required ports. Keep in mind the first rule of security is defense in depth (and that mac/ip addresses can be spoofed). BTW the second rule of security is that there is no perfectly secure system.

I would definitely add .htpasswd protection in front of phpmyadmin and any sensitive web directories (like admin directories for wordpress and the like, Is it enough alone, no. Again remember the rule is to protect things in depth. .Htpasswd will do nothing to protect your ssh connection, or other services you may expose (mysql).

Let me address one of the underlying assumptions: You say "although I don't really have very sensitive data on it." You may have far more data at risk than you first think. Will you browse the web on it? If so will you use it to access password protected websites? or your bank? will you buy anything with a credit card? will you store things that could be embarrassing if others saw them (that selfie from the holiday party)? Are there others sharing the network who can spread malware/viruses and attacks by their unsafe behaviour otr compromised PC?

I would suggest that you take the opportunity to learn more about hardening a linux server, this is a great use case for the Pi. You can look at this other question and its links as a start.

2

You can restrict access based MAC addresses. This would done within your PHP logic, but is fairly useless. MAC addresses are incredibly easy to spoof, and it's not hard for someone to lift your MAC address if they know how.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.