Since a couple people are having issues with the ipWhitelist (me included), I’m putting this up to help people use the whitelist correctly.
For starters, the easiest way to whitelist your IP is to start up Magic Mirror with the default settings. Try opening it up remotely from the computer you want to grant access to. You’ll probably see an error that says:
“This device is not allowed to access your mirror.
Please check your config.js or config.js.sample to change this.”
Now you need to check your MagicMirror logs.
- If you are VPN’d into (or running directly on your pi), take a look at the terminal output.
- If you are running MagicMirror using SSH and
DISPLAY=:0 nohup npm start &to start your mirror, take a look at your nohup.out file (
tail -f ~/MagicMirror/nohup.out) to see the output.
- If you are using pm2, run
tail -f ~/.pm2/logs/mm-out-0.log
You should see an error in there stating something like
Access denied to IP address: ::ffff:192.168.1.120
Change/Add your ipWhitelist in your
If you upgraded to MM 2.1.0 you’ll probably need to add the line
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.1.120"], to your file, otherwise just add the IP that was denied to the list.
If you want to give all of your network IPs access to your MagicMirror
You’ll have to use IPv6 CIDR.
For example, you have a couple devices with the IPs of 192.168.1.120, 192.168.1.155, 192.168.1.230 and you want to give them all access (along with everything else in the 192.168.1.X range), you should put
"::ffff:192.168.1.1/120" in your ipWhitelist.
If you want to allow 192.168.0.0 - 192.168.255.255 access, you should use
Restart MagicMirror to update your changes
The reason why “/24” works
A couple different threads state to add /24 to the end of the IP address. (I’ve put a couple of those up before doing some research too). While this will indeed allow your network devices access to your magic mirror, it will also allow any device with an IPv4 based address access to your mirror (obviously your router would need to be configured to allow this).
This “/24” in IPv6 CIDR allows 20,282,409,603,651,670,423,947,251,286,016 different IP addresses access. (IPv4’s total addresses are 4,294,967,296).
If you’d like to learn more or have different sub-netting needs, I found this page useful.