Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Public access checker #2148

Merged
merged 6 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion admin/i18n/de/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,6 @@
"Loading background": "Hintergrund beim Laden",
"Use iobroker.acme adapter for letsencrypt certificates": "Verwenden Sie den iobroker.acme-Adapter für letsencrypt-Zertifikate",
"Reverse proxy": "Reverse-Proxy",
"You can use admin behind a reverse proxy.": "Sie können den Admin hinter einem Reverse-Proxy verwenden."
"You can use admin behind a reverse proxy.": "Sie können den Admin hinter einem Reverse-Proxy verwenden.",
"Do not check if this instance is available from internet": "Nicht überprüfen, ob diese Instanz aus dem Internet erreichbar ist"
}
3 changes: 2 additions & 1 deletion admin/i18n/en/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,6 @@
"Loading background": "Loading background",
"Use iobroker.acme adapter for letsencrypt certificates": "Use iobroker.acme adapter for letsencrypt certificates",
"Reverse proxy": "Reverse proxy",
"You can use admin behind a reverse proxy.": "You can use admin behind a reverse proxy."
"You can use admin behind a reverse proxy.": "You can use admin behind a reverse proxy.",
"Do not check if this instance is available from internet": "Do not check if this instance is available from internet"
}
3 changes: 2 additions & 1 deletion admin/i18n/es/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,6 @@
"Loading background": "Cargando fondo",
"Use iobroker.acme adapter for letsencrypt certificates": "Use el adaptador iobroker.acme para los certificados de letsencrypt",
"Reverse proxy": "Proxy inverso",
"You can use admin behind a reverse proxy.": "Puede usar admin detrás de un Reverse Proxy."
"You can use admin behind a reverse proxy.": "Puede usar admin detrás de un Reverse Proxy.",
"Do not check if this instance is available from internet": "No verifique si esta instancia está disponible en Internet."
}
3 changes: 2 additions & 1 deletion admin/i18n/fr/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,6 @@
"Loading background": "Chargement de l'arrière-plan",
"Use iobroker.acme adapter for letsencrypt certificates": "Utiliser l'adaptateur iobroker.acme pour les certificats Letsencrypt",
"Reverse proxy": "Proxy inverse",
"You can use admin behind a reverse proxy.": "Vous pouvez utiliser admin derrière un Reverse Proxy."
"You can use admin behind a reverse proxy.": "Vous pouvez utiliser admin derrière un Reverse Proxy.",
"Do not check if this instance is available from internet": "Ne vérifiez pas si cette instance est disponible sur Internet"
}
3 changes: 2 additions & 1 deletion admin/i18n/it/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,6 @@
"Loading background": "Caricamento dello sfondo",
"Use iobroker.acme adapter for letsencrypt certificates": "Utilizzare l'adattatore iobroker.acme per i certificati letsencrypt",
"Reverse proxy": "Procura inversa",
"You can use admin behind a reverse proxy.": "Puoi utilizzare l'amministratore dietro un Reverse Proxy."
"You can use admin behind a reverse proxy.": "Puoi utilizzare l'amministratore dietro un Reverse Proxy.",
"Do not check if this instance is available from internet": "Non verificare se questa istanza è disponibile da Internet"
}
3 changes: 2 additions & 1 deletion admin/i18n/nl/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,6 @@
"Loading background": "Achtergrond laden",
"Use iobroker.acme adapter for letsencrypt certificates": "Gebruik de iobroker.acme-adapter voor letsencrypt-certificaten",
"Reverse proxy": "Omgekeerde proxy",
"You can use admin behind a reverse proxy.": "U kunt admin gebruiken achter een Reverse Proxy."
"You can use admin behind a reverse proxy.": "U kunt admin gebruiken achter een Reverse Proxy.",
"Do not check if this instance is available from internet": "Controleer niet of dit exemplaar beschikbaar is via internet"
}
3 changes: 2 additions & 1 deletion admin/i18n/pl/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,6 @@
"Loading background": "Ładowanie tła",
"Use iobroker.acme adapter for letsencrypt certificates": "Użyj adaptera iobroker.acme dla certyfikatów letsencrypt",
"Reverse proxy": "Odwrotne proxy",
"You can use admin behind a reverse proxy.": "Możesz użyć administratora za Reverse Proxy."
"You can use admin behind a reverse proxy.": "Możesz użyć administratora za Reverse Proxy.",
"Do not check if this instance is available from internet": "Nie sprawdzaj, czy ta instancja jest dostępna z Internetu"
}
3 changes: 2 additions & 1 deletion admin/i18n/pt/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,6 @@
"Loading background": "Carregando plano de fundo",
"Use iobroker.acme adapter for letsencrypt certificates": "Use o adaptador iobroker.acme para certificados letsencrypt",
"Reverse proxy": "Proxy reverso",
"You can use admin behind a reverse proxy.": "Você pode usar admin atrás de um Reverse Proxy."
"You can use admin behind a reverse proxy.": "Você pode usar admin atrás de um Reverse Proxy.",
"Do not check if this instance is available from internet": "Não verifique se esta instância está disponível na Internet"
}
3 changes: 2 additions & 1 deletion admin/i18n/ru/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,6 @@
"Loading background": "Фон загрузки",
"Use iobroker.acme adapter for letsencrypt certificates": "Используйте адаптер iobroker.acme для сертификатов letsencrypt",
"Reverse proxy": "Reverse прокси",
"You can use admin behind a reverse proxy.": "Вы можете использовать admin за Reverse Proxy."
"You can use admin behind a reverse proxy.": "Вы можете использовать admin за Reverse Proxy.",
"Do not check if this instance is available from internet": "Не проверять, доступен ли этот экземпляр из Интернета"
}
3 changes: 2 additions & 1 deletion admin/i18n/uk/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,6 @@
"tooltip_ttl": "Тривалість входу в систему. Після закінчення цього часу користувач автоматично вийде з системи.",
"users permissions": "Дозволи користувачів",
"Reverse proxy": "Reverse проксі",
"You can use admin behind a reverse proxy.": "Ви можете використовувати admin за Reverse Proxy."
"You can use admin behind a reverse proxy.": "Ви можете використовувати admin за Reverse Proxy.",
"Do not check if this instance is available from internet": "Не перевіряйте, чи доступний цей екземпляр в Інтернеті"
}
3 changes: 2 additions & 1 deletion admin/i18n/zh-cn/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,6 @@
"Loading background": "加载背景",
"Use iobroker.acme adapter for letsencrypt certificates": "使用 iobroker.acme 适配器获取 letsencrypt 证书",
"Reverse proxy": "反向代理",
"You can use admin behind a reverse proxy.": "您可以在反向代理后面使用 admin。"
"You can use admin behind a reverse proxy.": "您可以在反向代理后面使用 admin。",
"Do not check if this instance is available from internet": "不检查此实例是否可从 Internet 获取"
}
9 changes: 9 additions & 0 deletions admin/jsonConfig.json5
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,15 @@
"md": 4,
"lg": 2
},
"doNotCheckPublicIP": {
"newLine": true,
"label": "Do not check if this instance is available from internet",
"type": "checkbox",
"sm": 12,
"md": 4,
"lg": 2,
"hidden": "!!data.auth"
}
}
},
"loadingTab": {
Expand Down
3 changes: 2 additions & 1 deletion io-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,8 @@
"reverseProxy": [],
"loadingBackgroundColor": "",
"loadingHideLogo": false,
"loadingBackgroundImage": false
"loadingBackgroundImage": false,
"doNotCheckPublicIP": false
},
"objects": [],
"instanceObjects": [
Expand Down
31 changes: 31 additions & 0 deletions lib/web.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ class Web {
wwwDir = 'www';

close = () => {
this.checkTimeout && clearTimeout(this.checkTimeout);
this.checkTimeout = null;

this.adapter.setState('info.connection', false, true);
this.server.server?.close();
};
Expand Down Expand Up @@ -1215,6 +1218,34 @@ class Web {
this.settings.secure ? 's' : ''
}://127.0.0.1:${port}" to configure.`
);

if (!this.adapter.config.doNotCheckPublicIP && !this.adapter.config.auth) {
this.checkTimeout = setTimeout(async () => {
this.checkTimeout = null;
try {
await IoBWebServer.checkPublicIP(this.settings.port);
} catch (e) {
// this supported first from js-controller 5.0.
this.adapter.sendToHost(
`system.host.${this.adapter.host}`,
'addNotification',
{
scope: 'system',
category: 'securityIssues',
message:
'Your admin instance is accessible from the internet without any protection. ' +
'Please enable authentication or disable the access from the internet.',
instance: `system.adapter.${this.adapter.namespace}`,
},
(/* result */) => {
/* ignore */
}
);

this.adapter.log.error(e.toString());
}
}, 1000);
}
}
);

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"dependencies": {
"@iobroker/adapter-core": "^3.0.3",
"@iobroker/socket-classes": "^1.4.3",
"@iobroker/webserver": "^0.3.7",
"@iobroker/webserver": "^1.0.1",
"@iobroker/ws-server": "^2.1.1",
"archiver": "^6.0.1",
"axios": "^1.5.1",
Expand Down
Loading