Skip to content

Commit

Permalink
v8.21 (#6545)
Browse files Browse the repository at this point in the history
- DietPi-Software | TasmoAdmin: Resolved an issue on Bookworm systems with Nginx and Lighttpd webserver where login and logout did not work anymore as the rewrite directives pointed to a file which does not exist anymore since TasmoAdmin v3. Many thanks to @TBirth for reporting this issue: https://dietpi.com/forum/t/tasmoadmin-not-found-after-visiting-login-page/17632
  • Loading branch information
MichaIng authored Aug 13, 2023
1 parent a6624fe commit 1585906
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 10 deletions.
14 changes: 14 additions & 0 deletions .conf/dps_27/lighttpd.tasmoadmin.3.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
$HTTP["url"] =~ "^/tasmoadmin($|/)" {
# Deny direct access to .htaccess and data directory
$HTTP["url"] =~ "^/tasmoadmin/(\.|data)" {
# Allow direct access to firmwares
$HTTP["url"] !~ "^/tasmoadmin/data/firmwares" {
url.access-deny = ("")
}
}

# TasmoAdmin URL rewrites
else $HTTP["url"] !~ "^/tasmoadmin/index\.php($|/)" {
url.rewrite-if-not-file = ("^/tasmoadmin/(.*)$" => "/tasmoadmin/index.php?$1")
}
}
2 changes: 1 addition & 1 deletion .conf/dps_27/lighttpd.tasmoadmin.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ $HTTP["url"] =~ "^/tasmoadmin($|/)" {
}
}

# TasmoAdmin URL rewrites required for sync clients
# TasmoAdmin URL rewrites
url.rewrite-if-not-file = (
"^/tasmoadmin/doAjax$" => "/tasmoadmin/index.php?doAjax=doAjax",
"^/tasmoadmin/doAjaxAll$" => "/tasmoadmin/index.php?doAjaxAll=doAjaxAll",
Expand Down
30 changes: 30 additions & 0 deletions .conf/dps_27/nginx.tasmoadmin.3.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Location: /etc/nginx/sites-dietpi/dietpi-tasmoadmin.conf
# Based on: https://github.com/TasmoAdmin/TasmoAdmin/blob/master/.docker/rootfs/etc/nginx/nginx.conf
location ^~ /tasmoadmin {
# Allow direct access to firmwares
location ^~ /tasmoadmin/data/firmwares {
add_header Access-Control-Allow-Origin *;
}

# Deny direct access to .htaccess and data directory
location ~ ^/tasmoadmin/(?:\.|data) {
deny all;
}

location ~ ^/tasmoadmin/index\.php(/|$) {
fastcgi_pass php;
fastcgi_read_timeout 900;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
internal;
}

location ~ \.(css|js|gif||jpe?g|png|json|cache\.json)$ {
}

location /tasmoadmin {
try_files $uri $uri/ /tasmoadmin/index.php$is_args$args;
}
}
9 changes: 6 additions & 3 deletions .conf/dps_27/nginx.tasmoadmin.conf
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
# Location: /etc/nginx/sites-dietpi/dietpi-tasmoadmin.conf
# Based on: https://github.com/TasmoAdmin/TasmoAdmin/blob/v2.4.2/.docker/rootfs/etc/nginx/nginx.conf
location ^~ /tasmoadmin {
# Allow direct access to firmwares
location ^~ /tasmoadmin/data/firmwares {
add_header Access-Control-Allow-Origin *;
}

# Deny direct access to .htaccess and data directory
location ~ ^/tasmoadmin/(?:\.|data) {
deny all;
}

location ~* \.php$ {
location ~ \.php$ {
fastcgi_pass php;
fastcgi_read_timeout 900;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
Expand All @@ -17,10 +20,10 @@ location ^~ /tasmoadmin {
include fastcgi_params;
}

location ~* \.(css|js|gif||jpe?g|png|json|cache\.json)$ {
location ~ \.(css|js|gif||jpe?g|png|json|cache\.json)$ {
}

# TasmoAdmin URL rewrites required for sync clients
# TasmoAdmin URL rewrites
location /tasmoadmin {
rewrite ^/tasmoadmin/login$ /tasmoadmin/login.php last;
rewrite ^/tasmoadmin/logout$ /tasmoadmin/login.php?logout=logout last;
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Bug fixes:
- DietPi-LetsEncrypt | Resolved a v8.20 regression where Lighttpd did not start after applying or renewing the certificate due to a syntax error. Many thanks to @JappeHallunken for fixing this issue: https://github.com/MichaIng/DietPi/pull/6517
- DietPi-Config | Resolved an issue where /etc/network/interfaces was created with missing key values if lines were previously manually removed. Defaults are now applied in this case. Many thanks to @huettenwirt for reporting this issue: https://dietpi.com/forum/t/ifup-error-due-to-faulty-etc-network-interfaces/17605
- DietPi-Config | Resolved an issue where the DHCP server failed to start after applying WiFi hotspot settings.
- DietPi-Software | TasmoAdmin: Resolved an issue on Bookworm systems with Nginx and Lighttpd webserver where login and logout did not work anymore as the rewrite directives pointed to a file which does not exist anymore since TasmoAdmin v3. Many thanks to @TBirth for reporting this issue: https://dietpi.com/forum/t/tasmoadmin-not-found-after-visiting-login-page/17632

As always, many smaller code performance and stability improvements, visual and spelling fixes have been done, too much to list all of them here. Check out all code changes of this release on GitHub: https://github.com/MichaIng/DietPi/pull/XXXX

Expand Down
20 changes: 14 additions & 6 deletions dietpi/dietpi-software
Original file line number Diff line number Diff line change
Expand Up @@ -11185,8 +11185,10 @@ _EOF_

if To_Install 27 # TasmoAdmin
then
# Install required PHP modules
aDEPS=("php$PHP_VERSION-curl" "php$PHP_VERSION-zip") # https://github.com/reloxx13/TasmoAdmin#linux
# Install required PHP modules: https://github.com/TasmoAdmin/TasmoAdmin/wiki/Guide-for-Debian-Server-10-(Buster)
aDEPS=("php$PHP_VERSION-curl" "php$PHP_VERSION-zip")
(( $G_DISTRO > 5 )) && aDEPS+=("php$PHP_VERSION-mbstring" "php$PHP_VERSION-xml")
local adeps=("${aDEPS[@]#*-}")

# Reinstall: Skip download and install, advice to use internal updater from web UI
if [[ -d '/var/www/tasmoadmin' ]]
Expand Down Expand Up @@ -11216,18 +11218,21 @@ _EOF_
fi

# Webserver config
# - Config file Version
local version=
(( $G_DISTRO > 6 )) && version='.3'
if (( ${aSOFTWARE_INSTALL_STATE[83]} > 0 ))
then
G_DIETPI-NOTIFY 2 'Apache webserver found, enabling TasmoAdmin specific configuration.'
G_EXEC a2enmod setenvif rewrite authz_core authn_core authn_file
local tasmoadmin_conf='/etc/apache2/sites-available/dietpi-tasmoadmin.conf'
if [[ -f $tasmoadmin_conf ]]
then
tasmoadmin_conf+='.dietpi-new'
G_WHIP_MSG "Existing TasmoAdmin Apache configuration found, will preserve the old one and save the new one for review and comparison to: $tasmoadmin_conf"
fi
dps_index=$software_id Download_Install 'apache.tasmoadmin.conf' "$tasmoadmin_conf"
a2enmod setenvif rewrite authz_core authn_core authn_file 1> /dev/null
a2ensite dietpi-tasmoadmin 1> /dev/null
G_EXEC a2ensite dietpi-tasmoadmin

elif (( ${aSOFTWARE_INSTALL_STATE[84]} > 0 ))
then
Expand All @@ -11238,7 +11243,7 @@ _EOF_
tasmoadmin_conf+='.dietpi-new'
G_WHIP_MSG "Existing TasmoAdmin Lighttpd configuration found, will preserve the old one and save the new one for review and comparison to: $tasmoadmin_conf"
fi
dps_index=$software_id Download_Install 'lighttpd.tasmoadmin.conf' "$tasmoadmin_conf"
dps_index=$software_id Download_Install "lighttpd.tasmoadmin$version.conf" "$tasmoadmin_conf"
G_EXEC_POST_FUNC(){ [[ $exit_code == 2 ]] && exit_code=0; } # Do not fail if modules are enabled already
G_EXEC lighty-enable-mod rewrite dietpi-tasmoadmin

Expand All @@ -11251,8 +11256,11 @@ _EOF_
owncloud_conf+='.dietpi-new'
G_WHIP_MSG "Existing TasmoAdmin Nginx configuration found, will preserve the old one and save the new one for review and comparison to: $tasmoadmin_conf"
fi
dps_index=$software_id Download_Install 'nginx.tasmoadmin.conf' "$tasmoadmin_conf"
dps_index=$software_id Download_Install "nginx.tasmoadmin$version.conf" "$tasmoadmin_conf"
fi

# Enable required PHP modules
G_EXEC phpenmod "${adeps[@]}"
fi

if To_Install 206 openhab # openHAB
Expand Down

0 comments on commit 1585906

Please sign in to comment.