Skip to content

Commit 70a8d91

Browse files
authored
Feature user management (openWB#3119)
* restrict access to mosquitto and apache * move mosquitto setup to own file * implement dis-/enabling unencrypted access * migrate simpleAPI * adopt lxde session * implement switching between acl and dynsec * fix mosquitto setup * fix apache setup * fix dynsec setup * migrate simpleAPI to localhost 1884 * add official mosquitto apt repository * configuration changes on boot only * fix disabling user management * add resetUserManagement command * upgrade npm packages * fix mosquitto.acl permissions * mosquitto: add ws listener on localhost * Koala: adopt mqtt options * upgrade theme and display wrappers to mqtt 5.14.1 * roles for theme and display wrapper * koala: login handling * koala: improve handling of invalid credentials * restructure security topics * koala: fix charge point display * classic: migrate mqtt package * Update command.py * Update default-dynamic-security.json * restructure dynsec methods * check acl roles at start * updated default and template acls * add acl roles for components and io * access controlled commands (#4) * access controlled commands * classic theme: fix publishing * koala: change command topics * koala: reset values on publish error * allow changing admin password * fix handling missing topics in shell scripts * clean mosquitto.conf after restore to allow downgrading * include user management specific files in backup/restore process * fix reload in theme and display wrapper * remove dynsec settings on factory reset * detect dynsec plugin path * resubscribe on reconnect * fix deleting mosquitto configuration on restore * fix battery card display for missing permissions * adjust role acls * koala: fix manual soc update for charge points * fix charge point sum ACL * ACL migration * add more topics to basic system role * fix counter role ACL * add roles for status, charge log, chart and general settings access * catch login error * koala: reload on failed login * koala: make grid and home optional in flow chart * koala: only display datasets with configured ACLs in history chart * koala: refactor daily totals chart for individual components * enable apache http on localhost:81 * replace router.go(0) with location.reload() * koala: warn if default credentials are used * refactor security topic structure * theme/display wrapper: fix missed publish function upgrade * standard-legacy theme: fix missed smart home upgrade to mqtt 5.14.1 * restructure permission topics * complete settings roles * fix default security roles * add default user group * prepare cards theme for mqtt auth * add version to default dynamic security roles * rename some roles for easier parsing * update acls (openWB#3106) * update acls * clean mosquitto conf.d on update * reset password * fix updating ACLs on startup * fix token request * minor fixes for password reset * fix removing outdated ACL roles * improve login and password reset dialogues * koala: require data protection acknowledge for password reset * koala: layout enhancements * cards: login handling (temporary) * cards: adopt logic for missing topics * Cards: add parameter "hide_login" * display wrapper: check for stored credentials * cards display: layout fixes * cleanup * cards display: improve logout * add stored credentials to backup * fix local display startup * add "userManagementSupported" flag for themes * cards: updated dependencies * koala: remove warning about anonymous connection * add mqtt chargepoint role * add io-device write rule * add mqtt soc write rule (partial) * integrate mqtt component write rules * integrate "others/#" data * fix adding roles on startup * add display clients * fix local display without internal charge point (standalone) * fix factory and user management reset * koala: modify mqtt connect message * koala: updated packages * cards: updated packages * update default ACLs * fix initializing user management * display hostname * HTTP-API: support basic auth for user management * update default role for active bat control * fix surplus charge configuration role * modify acls for io configuration * modify login/-out modals * optimize password reset dialog * fix init_user_management file check * reload display after user management initialization * fix initialization of roles and clients
1 parent 0d243cd commit 70a8d91

733 files changed

Lines changed: 82235 additions & 10175 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.htaccess

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@
77
RedirectMatch 404 \.conf$
88
RedirectMatch 404 \.ini$
99
RedirectMatch 404 \.py$
10+
RedirectMatch 404 \.sh$
1011
ErrorDocument 404 /openWB/web/error.html

data/clients/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.json

data/clients/.htaccess

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<Files "*.json">
2+
Require all denied
3+
</Files>

data/config/apache/000-default.conf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# openwb-version:5
1+
# openwb-version:6
22
<VirtualHost *:80>
33
# The ServerName directive sets the request scheme, hostname and port that
44
# the server uses to identify itself. This is used when creating
@@ -37,9 +37,9 @@
3737
# after it has been globally disabled with "a2disconf".
3838
#Include conf-available/serve-cgi-bin.conf
3939

40-
ProxyPass "/ws" "ws://localhost:9001"
41-
# ToDo: remove the next line when main page is using vue.js
42-
ProxyPass "/mqtt" "ws://localhost:9001"
40+
# Proxy WebSocket and MQTT connections to Mosquitto
41+
# ToDo: remove /mqtt target once all clients use /ws
42+
ProxyPassMatch "^/(ws|mqtt)(/|$)" "ws://127.0.0.1:9003/"
4343
</VirtualHost>
4444

4545
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

data/config/apache/apache-openwb-ssl.conf

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# openwb-version:6
1+
# openwb-version:8
22
<IfModule mod_ssl.c>
33
<VirtualHost _default_:443>
44
ServerAdmin webmaster@localhost
@@ -139,9 +139,10 @@
139139
# nokeepalive ssl-unclean-shutdown \
140140
# downgrade-1.0 force-response-1.0
141141

142-
ProxyPass "/ws" "ws://localhost:9001"
143-
# ToDo: remove the next line when main page is using vue.js
144-
ProxyPass "/mqtt" "ws://localhost:9001"
142+
# Proxy WebSocket and MQTT connections to Mosquitto
143+
# ToDo: remove /mqtt target once all clients use /ws
144+
ProxyPassMatch "^/(ws|mqtt)(/|$)" "ws://127.0.0.1:9003/"
145+
145146
</VirtualHost>
146147
</IfModule>
147148

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# openwb-version:1
2+
<VirtualHost *:80>
3+
# The ServerName directive sets the request scheme, hostname and port that
4+
# the server uses to identify itself. This is used when creating
5+
# redirection URLs. In the context of virtual hosts, the ServerName
6+
# specifies what hostname must appear in the request's Host: header to
7+
# match this virtual host. For the default virtual host (this file) this
8+
# value is not decisive as it is used as a last resort host regardless.
9+
# However, you must set it for any further virtual host explicitly.
10+
#ServerName www.example.com
11+
12+
ServerAdmin webmaster@localhost
13+
DocumentRoot /var/www/html
14+
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
15+
# error, crit, alert, emerg.
16+
# It is also possible to configure the loglevel for particular
17+
# modules, e.g.
18+
#LogLevel info ssl:warn
19+
20+
ErrorLog ${APACHE_LOG_DIR}/error.log
21+
#CustomLog ${APACHE_LOG_DIR}/access.log combined
22+
23+
# redirect all HTTP traffic to HTTPS
24+
RewriteEngine On
25+
RewriteCond %{HTTPS} off
26+
RewriteRule ^/?(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
27+
</VirtualHost>
28+
29+
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

data/config/apache/localhost.conf

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# openwb-version:2
2+
Listen 127.0.0.1:81
3+
4+
<VirtualHost *:81>
5+
# The ServerName directive sets the request scheme, hostname and port that
6+
# the server uses to identify itself. This is used when creating
7+
# redirection URLs. In the context of virtual hosts, the ServerName
8+
# specifies what hostname must appear in the request's Host: header to
9+
# match this virtual host. For the default virtual host (this file) this
10+
# value is not decisive as it is used as a last resort host regardless.
11+
# However, you must set it for any further virtual host explicitly.
12+
#ServerName www.example.com
13+
14+
ServerAdmin webmaster@localhost
15+
DocumentRoot /var/www/html
16+
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
17+
# error, crit, alert, emerg.
18+
# It is also possible to configure the loglevel for particular
19+
# modules, e.g.
20+
#LogLevel info ssl:warn
21+
22+
ErrorLog ${APACHE_LOG_DIR}/error.log
23+
#CustomLog ${APACHE_LOG_DIR}/access.log combined
24+
<Directory /var/www/>
25+
AllowOverride All
26+
Require all granted
27+
Options -Indexes
28+
</Directory>
29+
<Directory /var/www/html/openWB/ramdisk>
30+
Options +Indexes
31+
</Directory>
32+
<Directory /var/www/html/openWB/data/backup>
33+
Options +Indexes
34+
</Directory>
35+
# For most configuration files from conf-available/, which are
36+
# enabled or disabled at a global level, it is possible to
37+
# include a line for only one particular virtual host. For example the
38+
# following line enables the CGI configuration for this host only
39+
# after it has been globally disabled with "a2disconf".
40+
#Include conf-available/serve-cgi-bin.conf
41+
42+
# Proxy WebSocket and MQTT connections to Mosquitto
43+
# ToDo: remove /mqtt target once all clients use /ws
44+
ProxyPassMatch "^/(ws|mqtt)(/|$)" "ws://127.0.0.1:9003/"
45+
</VirtualHost>
46+
47+
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

data/config/display/lxdeautostart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# openwb-version:1
1+
# openwb-version:4
22
# enable screen blanking / power management
33
xset s 15
44
# Start Chromium in kiosk mode
55
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' ~/.config/chromium/'Local State'
66
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/; s/"exit_type":"[^"]\+"/"exit_type":"Normal"/' ~/.config/chromium/Default/Preferences
7-
chromium --start-fullscreen --kiosk --incognito --noerrdialogs --disable-translate --no-first-run --fast --fast-start --disable-infobars --disable-features=TranslateUI --disk-cache-dir=/dev/null --password-store=basic --disable-pinch --overscroll-history-navigation=disabled --disable-features=TouchpadOverscrollHistoryNavigation http://localhost/openWB/web/display/
7+
chromium --start-fullscreen --kiosk --incognito --noerrdialogs --disable-translate --no-first-run --fast --fast-start --disable-infobars --disable-features=TranslateUI --disk-cache-dir=/dev/null --password-store=basic --disable-pinch --overscroll-history-navigation=disabled --disable-features=TouchpadOverscrollHistoryNavigation --ignore-certificate-errors --allow-insecure-localhost http://127.0.0.1:81/openWB/web/display/

data/config/mosquitto/mosquitto_local.conf renamed to data/config/mosquitto/local/mosquitto_local.conf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ persistence_location /var/lib/mosquitto_local/
55
log_type error
66
log_type warning
77
log_dest file /var/log/mosquitto/mosquitto_local.log
8-
# timestamp format currently not supported in stretch or buster with mosquitto 1.5
9-
# only enable on bullseye and newer
108
log_timestamp_format %Y-%m-%dT%H:%M:%S
119

1210
include_dir /etc/mosquitto/conf_local.d
File renamed without changes.

0 commit comments

Comments
 (0)