Page 1 of 1

Lighttpd.conf gets corrupted at random

Posted: Thu Apr 21, 2016 6:32 am
by flameproof
Hi all,

I have various WS-12-250A in operation. Every so often (1-3 weeks), the configuration of the built-in web server gets corrupted, resulting in either an empty /etc/lighttpd.conf or one with badly formatted content - wrong settings, many tabs, etc.

Has anyone seen this happen?

Example corrupt config (tabs not shown but each line increments by one tab) - there is a missing section after the server.pid-file line:

Code: Select all

admin@SW0002:/www# cat /etc/lighttpd.conf
server.port = 80
server.max-worker = 2
$SERVER["socket"] == ":35443" {
 ssl.engine = "enable"
 ssl.pemfile = "/etc/config/lighttpd.pem"
 }
# bounce all HTTP requests to HTTPS
 $HTTP["scheme"] == "nomatch" {
 $HTTP["host"] =~ "(.*)" {
 url.redirect = ("^/(.*)" => "https://%1:35443/$1")
 }
 }
server.modules = (
 "mod_rewrite",
 "mod_redirect",
 # "mod_alias",
 # "mod_auth",
 # "mod_status",
 # "mod_setenv",
 "mod_fastcgi",
 "mod_proxy",
 # "mod_simple_vhost",
 "mod_cgi",
 # "mod_ssi",
 # "mod_usertrack",
 # "mod_expire"
 )
server.network-backend = "write"
server.document-root = "/www/"
index-file.names = ( "index.html", "default.html", "index.htm", "default.htm", "index.php" )
mimetype.assign = (
 ".pdf" => "application/pdf",
 ".class" => "application/octet-stream",
 ".pac" => "application/x-ns-proxy-autoconfig",
 ".swf" => "application/x-shockwave-flash",
 ".wav" => "audio/x-wav",
 ".gif" => "image/gif",
 ".jpg" => "image/jpeg",
 ".jpeg" => "image/jpeg",
 ".png" => "image/png",
 ".ico" => "image/x-icon",
 ".css" => "text/css",
 ".html" => "text/html",
 ".htm" => "text/html",
 ".js" => "text/javascript",
 ".woff" => "application/font-woff",
 ".txt" => "text/plain",
 ".dtd" => "text/xml",
 ".xml" => "text/xml"
 )
$HTTP["url"] =~ "\.pdf$" {
 server.range-requests = "disable"
 }
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi", ".lua", ".cgi", ".json" )
server.pid-file = "/var/run/lighttpd.pid"
admin@SW0002:/www#

Re: Lighttpd.conf gets corrupted at random

Posted: Thu Apr 21, 2016 6:36 am
by flameproof
Further to my last, restoring the lighttpd.conf from another switch brings up the web server again. I'm running v1.3.9 on all switches.

Re: Lighttpd.conf gets corrupted at random

Posted: Thu Apr 21, 2016 8:29 am
by sirhc
Maybe a little more info?

What browser are you using?

When this happens are you just opening the browser and going to the switch or was the switch UI left open for some period of time?

How do you correct it when it happens?

Foes it do this from another computer/browser?

Re: Lighttpd.conf gets corrupted at random

Posted: Thu Apr 21, 2016 8:33 am
by flameproof
More info:

- I'm using Firefox but not sure how a browser could cause corruption of a web server's configuration file(s).
- When this happens I go to connect to the browser, and find I no longer have access. I then SSH and find the config corrupt. The switch UI is not open for more than a few minutes at a time (maximum 10).
- To correct it, I copy the .conf from a good switch, delete the .conf on the bad switch, vi a new .conf and paste the contents, :wq and start lighttpd manually. Browser can then connect correctly.
- It does it regardless of computer/browser. I see lighttpd no longer running on the switch via ps -ef.

Re: Lighttpd.conf gets corrupted at random

Posted: Thu Apr 21, 2016 9:41 am
by Eric Stern
Does it only happen on 1 switch?

Its possible the flash file system has gotten corrupted. You can try this.

- backup the config
- at the command line run "mtd erase rootfs_data" (this will take about a minute)
- at the command line run "reboot"
- when it comes back up it will be at the default IP address of 192.168.1.20
- restore the config

Re: Lighttpd.conf gets corrupted at random

Posted: Thu Apr 21, 2016 9:43 am
by flameproof
It has happened to two of the switches, three times on one, and once on the other. I am very remote to these switches, so doing things that may leave me without access are a no-go unless really required.

Re: Lighttpd.conf gets corrupted at random

Posted: Thu Apr 21, 2016 9:47 am
by sirhc
I would then schedule a visit and do it on site as soon as possible.

I would also take a spare just in case.

Another option would be to rotate these units back to a more easily accessible location.

Re: Lighttpd.conf gets corrupted at random

Posted: Sat Apr 23, 2016 3:45 pm
by flameproof
I'll take a look next time I'm there. We cannot rotate these to more accessible locations as we have no accessible locations where we are installing these switches.

Re: Lighttpd.conf gets corrupted at random

Posted: Sat Apr 23, 2016 4:11 pm
by sirhc
flameproof wrote:I'll take a look next time I'm there. We cannot rotate these to more accessible locations as we have no accessible locations where we are installing these switches.


Then I would replace with a spare and further test in shop. If you do not have a spare you live on the edge!

Re: Lighttpd.conf gets corrupted at random

Posted: Sun Apr 24, 2016 4:35 am
by flameproof
I did not say we have no spares - we do - just that the locations are remote ;-)