Securifi Community Forum
Securifi Products => Almond+ => Topic started by: srcshelton on October 16, 2014, 08:19:06 pm
-
The LuCI web-interface is no longer loading, so I checked on the device and tried restarting lighttpd.
This have an error saying that /etc/lighttpd/conf.d/ was empty - it wasn't, but the only file present was named '005-webdav.conf' followed by two unprintable control-characters.
The contents of this file is:
$HTTP["host"] == "" {^M
server.document-root = ""^M
dir-listing.activate = "disable^M"^M
webdav.activate = "disable^M"^M
webdav.is-readonly = "disable^M"^M
webdav.sqlite-db-name = "/var/run/lighttpd-webdav-lock.db"^M
EOF^M
if [ "" -eq 1 ]; then^M
cat <<EOF>>/etc/lighttpd/conf.d/005-webdav.conf^M^M
auth.backend = "htpasswd"^M
auth.backend.htpasswd.userfile = "/etc/lighttpd/.htpasswd^M"^M
auth.require = ( "" => ( "method" => "basic",^M
"realm" => "webdav",^M
"require" => "valid-user" ) )^M
EOF^M
fi^M
echo "}" >> /etc/lighttpd/conf.d/005-webdav.conf^M^M
echo >> /etc/lighttpd/conf.d/005-webdav.conf^M^M
}^M
^M
do_user() {^M
local section="enabled"^M
local u^M
local p^M
local OPT^M
config_get u "enabled^M" "name"^M
config_get p "enabled^M" "password"^M
[ ! -e "/etc/lighttpd/.htpasswd^M" ] && OPT=-c^M
if [ -n "" -a -n "" ]; then^M
echo "" | htpasswd /etc/lighttpd/.htpasswd^M "" >/dev/null 2>/dev/null^M
fi^M
}^M
^M
vhost() {^M
local section="enabled"^M
local ip=""^M
config_get name "enabled^M" "name"^M
config_get enabled "enabled^M" "enabled"^M
if [ "" -gt 0 ]; then^M
echo " " >> /etc/lighttpd/webdav.vhosts^M^M
fi^M
}^M
^M
^M
reset_setting() {^M
^M
default_path=/mnt/usbs^M
^M
for share_entry in webdav.@partition[0] ; do^M
uci delete ^M
done^M ^M
uci add webdav partition^M
uci set webdav.@partition[-1].name='almondplus'^M
uci set webdav.@partition[-1].path=^M
uci set webdav.@partition[-1].read_only=1^M
uci set webdav.@partition[-1].dirlisting=1^M
uci set webdav.@partition[-1].readonly=1^M
uci set webdav.@partition[-1].authenticated=1^M
uci set webdav.@partition[-1].enabled=0^M
uci rename webdav.@partition[-1]=^M
uci commit webdav^M
}^M
^M
boot() {^M
reset_setting^M
start^M
}^M
^M
start() {^M
local ipaddr=10.1.137.9^M
config_load webdav^M
/bin/rm -f /etc/lighttpd/conf.d/005-webdav.conf^M^M
config_foreach partition partition^M
/bin/rm -f /etc/lighttpd/webdav.vhosts^M^M
config_foreach vhost partition ^M
/bin/rm -f /etc/lighttpd/.htpasswd^M^M
config_foreach do_user user^M
}^M
^M
# Called by GUI, should re-create conf files, then restart lighttpd^M
reload() {^M
start "enabled"^M
[ -x "/etc/init.d/lighttpd" ] && /etc/init.d/lighttpd enabled && {^M
/etc/init.d/lighttpd reload^M
}^M
[ -x "/etc/init.d/dnsmasq" ] && /etc/init.d/dnsmasq enabled && {^M
/etc/init.d/dnsmasq reload^M
}^M
}^M
$HTTP["host"] == "" {^M
server.document-root = ""^M
dir-listing.activate = "disable^M"^M
webdav.activate = "disable^M"^M
webdav.is-readonly = "disable^M"^M
webdav.sqlite-db-name = "/var/run/lighttpd-webdav-lock.db"^M
EOF^M
if [ "" -eq 1 ]; then^M
cat <<EOF>>/etc/lighttpd/conf.d/005-webdav.conf^M^M
auth.backend = "htpasswd"^M
auth.backend.htpasswd.userfile = "/etc/lighttpd/.htpasswd^M"^M
auth.require = ( "" => ( "method" => "basic",^M
"realm" => "webdav",^M
"require" => "valid-user" ) )^M
EOF^M
fi^M
echo "}" >> /etc/lighttpd/conf.d/005-webdav.conf^M^M
echo >> /etc/lighttpd/conf.d/005-webdav.conf^M^M
}^M
^M
do_user() {^M
local section="enabled"^M
local u^M
local p^M
local OPT^M
config_get u "enabled^M" "name"^M
config_get p "enabled^M" "password"^M
[ ! -e "/etc/lighttpd/.htpasswd^M" ] && OPT=-c^M
if [ -n "" -a -n "" ]; then^M
echo "" | htpasswd /etc/lighttpd/.htpasswd^M "" >/dev/null 2>/dev/null^M
fi^M
}^M
^M
vhost() {^M
local section="enabled"^M
local ip=""^M
config_get name "enabled^M" "name"^M
config_get enabled "enabled^M" "enabled"^M
if [ "" -gt 0 ]; then^M
echo " " >> /etc/lighttpd/webdav.vhosts^M^M
fi^M
}^M
^M
^M
reset_setting() {^M
^M
default_path=/mnt/usbs^M
^M
for share_entry in webdav.@partition[0] ; do^M
uci delete ^M
done^M
^M
uci add webdav partition^M
uci set webdav.@partition[-1].name='almondplus'^M
uci set webdav.@partition[-1].path=^M
uci set webdav.@partition[-1].read_only=1^M
uci set webdav.@partition[-1].dirlisting=1^M
uci set webdav.@partition[-1].readonly=1^M
uci set webdav.@partition[-1].authenticated=1^M
uci set webdav.@partition[-1].enabled=0^M
uci rename webdav.@partition[-1]=^M
uci commit webdav^M
}^M
^M
boot() {^M
reset_setting^M
start^M
}^M
^M
start() {^M
local ipaddr=10.1.137.9^M
config_load webdav^M
/bin/rm -f /etc/lighttpd/conf.d/005-webdav.conf^M^M
config_foreach partition partition^M
/bin/rm -f /etc/lighttpd/webdav.vhosts^M^M
config_foreach vhost partition ^M
/bin/rm -f /etc/lighttpd/.htpasswd^M^M
config_foreach do_user user^M
}^M
^M
# Called by GUI, should re-create conf files, then restart lighttpd^M
reload() {^M
start "enabled"^M
[ -x "/etc/init.d/lighttpd" ] && /etc/init.d/lighttpd enabled && {^M
/etc/init.d/lighttpd reload^M
}^M
[ -x "/etc/init.d/dnsmasq" ] && /etc/init.d/dnsmasq enabled && {^M
/etc/init.d/dnsmasq reload^M
}^M
}^M
$HTTP["host"] == "" {^M
server.document-root = ""^M
dir-listing.activate = "disable^M"^M
webdav.activate = "disable^M"^M
webdav.is-readonly = "disable^M"^M
webdav.sqlite-db-name = "/var/run/lighttpd-webdav-lock.db"^M
EOF^M
if [ "" -eq 1 ]; then^M
cat <<EOF>>/etc/lighttpd/conf.d/005-webdav.conf^M^M
auth.backend = "htpasswd"^M
auth.backend.htpasswd.userfile = "/etc/lighttpd/.htpasswd^M"^M
auth.require = ( "" => ( "method" => "basic",^M
"realm" => "webdav",^M
"require" => "valid-user" ) )^M
EOF^M
fi^M
echo "}" >> /etc/lighttpd/conf.d/005-webdav.conf^M^M
echo >> /etc/lighttpd/conf.d/005-webdav.conf^M^M
}^M
^M
do_user() {^M
local section="enabled"^M
local u^M
local p^M
local OPT^M
config_get u "enabled^M" "name"^M
config_get p "enabled^M" "password"^M
[ ! -e "/etc/lighttpd/.htpasswd^M" ] && OPT=-c^M
if [ -n "" -a -n "" ]; then^M
echo "" | htpasswd /etc/lighttpd/.htpasswd^M "" >/dev/null 2>/dev/null^M
fi^M
}^M
^M
vhost() {^M
local section="enabled"^M
local ip=""^M
config_get name "enabled^M" "name"^M
config_get enabled "enabled^M" "enabled"^M
if [ "" -gt 0 ]; then^M
echo " " >> /etc/lighttpd/webdav.vhosts^M^M
fi^M
}^M
^M
^M
reset_setting() {^M
^M
default_path=/mnt/usbs^M
^M
for share_entry in webdav.@partition[0] ; do^M
uci delete ^M
done^M
^M
uci add webdav partition^M
uci set webdav.@partition[-1].name='almondplus'^M
uci set webdav.@partition[-1].path=^M
uci set webdav.@partition[-1].read_only=1^M
uci set webdav.@partition[-1].dirlisting=1^M
uci set webdav.@partition[-1].readonly=1^M
uci set webdav.@partition[-1].authenticated=1^M
uci set webdav.@partition[-1].enabled=0^M
uci rename webdav.@partition[-1]=^M
uci commit webdav^M
}^M
^M
boot() {^M
reset_setting^M
start^M
}^M
^M
start() {^M
local ipaddr=10.1.137.9^M
config_load webdav^M
/bin/rm -f /etc/lighttpd/conf.d/005-webdav.conf^M^M
config_foreach partition partition^M
/bin/rm -f /etc/lighttpd/webdav.vhosts^M^M
config_foreach vhost partition ^M
/bin/rm -f /etc/lighttpd/.htpasswd^M^M
config_foreach do_user user^M
}^M
^M
# Called by GUI, should re-create conf files, then restart lighttpd^M
reload() {^M
start "enabled"^M
[ -x "/etc/init.d/lighttpd" ] && /etc/init.d/lighttpd enabled && {^M
/etc/init.d/lighttpd reload^M
}^M
[ -x "/etc/init.d/dnsmasq" ] && /etc/init.d/dnsmasq enabled && {^M
/etc/init.d/dnsmasq reload^M
}^M
}^M
... so, other than perhaps needing to run dos2unix, it appears that something has caused the code used to generate lighttpd configuration files to be copied/echoed into the destination files... although having said this, the presence of control-characters in the filename makes me wonder whether there's actually some filesystem corruption going on here.
Am I going to need to restore my firmware, or would a reboot (or some service restart) fix this issue?
-
Hopefully you get a more official response, but are you using webdav? If not, you can probably just comment out the last line in the lighttpd.conf file which tries to source conf.d files. I thought this was commented out by default, but maybe I'm wrong. Anyway, I have a similarly odd webdav conf file, but not including it does not seem to cause any issues.
-
Interesting - I don't know whether this is normal, but the 05-webdav.conf?? file is the *only* file in /etc/lighttpd/conf.d/ - and a quick glance at the parent lighttpd settings suggests that there should be more configuration files here... or, am I misunderstanding and lighttpd is *only* used for WebDAV, and the main web UI is served from a different process?
A reboot may well fix much of this - but even though the GUI is non-functional the Wifi connectivity is still working correctly and I am hesitant to restart the device with corrupt configuration present, in case this causes it to fail to restart at all!
@Securifi - could we get some official comment on this issue, please?
-
No idea what's going on, try a hard reset, it'll load a fresh image of the firmware from flash.