Merge pull request #759 from roramirez/readme-ipWhitelist

Add note to allow all IP addresses. ipWhitelist configuration directive.
This commit is contained in:
Michael Teeuw
2017-03-17 14:10:24 +01:00
committed by GitHub
3 changed files with 6 additions and 2 deletions

View File

@@ -110,7 +110,7 @@ The following properties can be configured:
| --- | --- | | --- | --- |
| `port` | The port on which the MagicMirror² server will run on. The default value is `8080`. | | `port` | The port on which the MagicMirror² server will run on. The default value is `8080`. |
| `address` | The ip address the accept connections. The default open bind `::` is IPv6 is available or `0.0.0.0` IPv4 run on. Example config: `192.168.10.100`. | | `address` | The ip address the accept connections. The default open bind `::` is IPv6 is available or `0.0.0.0` IPv4 run on. Example config: `192.168.10.100`. |
| `ipWhitelist` | The list of IPs from which you are allowed to access the MagicMirror². The default value is `["127.0.0.1", "::ffff:127.0.0.1", "::1"]`. It is possible to specify IPs with subnet masks (`["127.0.0.1", "127.0.0.1/24"]`) or define ip ranges (`["127.0.0.1", ["192.168.0.1", "192.168.0.100"]]`).| | `ipWhitelist` | The list of IPs from which you are allowed to access the MagicMirror². The default value is `["127.0.0.1", "::ffff:127.0.0.1", "::1"]`. It is possible to specify IPs with subnet masks (`["127.0.0.1", "127.0.0.1/24"]`) or define ip ranges (`["127.0.0.1", ["192.168.0.1", "192.168.0.100"]]`). Set `[]` to allow all IP addresses. For more information about how configure this directive see the [follow post ipWhitelist HowTo](https://forum.magicmirror.builders/topic/1326/ipwhitelist-howto) |
| `zoom` | This allows to scale the mirror contents with a given zoom factor. The default value is `1.0`| | `zoom` | This allows to scale the mirror contents with a given zoom factor. The default value is `1.0`|
| `language` | The language of the interface. (Note: Not all elements will be localized.) Possible values are `en`, `nl`, `ru`, `fr`, etc., but the default value is `en`. | | `language` | The language of the interface. (Note: Not all elements will be localized.) Possible values are `en`, `nl`, `ru`, `fr`, etc., but the default value is `en`. |
| `timeFormat` | The form of time notation that will be used. Possible values are `12` or `24`. The default is `24`. | | `timeFormat` | The form of time notation that will be used. Possible values are `12` or `24`. The default is `24`. |

View File

@@ -6,7 +6,7 @@
var config = { var config = {
port: 8080, port: 8080,
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], // Set [] to allow all IP addresses.
language: "en", language: "en",
timeFormat: 24, timeFormat: 24,

View File

@@ -19,6 +19,10 @@ var Server = function(config, callback) {
server.listen(config.port, config.address ? config.address : null); server.listen(config.port, config.address ? config.address : null);
if (config.ipWhitelist instanceof Array && config.ipWhitelist.length == 0) {
console.info("You're using a full whitelist configuration to allow for all IPs")
}
app.use(function(req, res, next) { app.use(function(req, res, next) {
var result = ipfilter(config.ipWhitelist, {mode: "allow", log: false})(req, res, function(err) { var result = ipfilter(config.ipWhitelist, {mode: "allow", log: false})(req, res, function(err) {
if (err === undefined) { if (err === undefined) {