core: WebGUI doesn't start on 24.1.10 and 24.7
Issue Summary
Problem: The WebGUI in OPNsense versions 24.1.10 and later (including 24.7) fails to work properly. Reverting to version 24.1.8 resolves the issue.
Steps to Reproduce
Upgrade OPNsense to version 24.1.10 or later.
Attempt to access the WebGUI.
Observe that the WebGUI does not load
OPNsense 24.1.8-amd64 FreeBSD 13.2-RELEASE-p11 OpenSSL 3.0.14
Log :
2024-07-25 15:32:48: (/usr/obj/usr/ports/www/lighttpd/work/lighttpd-1.4.76/src/mod_openssl.c.1453) SSL: inactive/expired X509 certificate '/var/etc/cert.pem' 2024-07-25 15:32:48: (/usr/obj/usr/ports/www/lighttpd/work/lighttpd-1.4.76/src/network.c.604) bind() [fe80::200:b1ff:fe4d:0]:443: Can't assign requested address ... 2024-07-25T15:32:48-04:00 opnsense 296 - [meta sequenceId="305"] <118>Starting web GUI...failed.
After doing configctl webgui restart renew
event @ 1721936304.36 exec: system event config_changed response: OK <171>1 2024-07-25T15:38:44-04:00 opn.exemple.com config 454 - [meta sequenceId="4"] /usr/local/etc/rc.restart_webgui: The command '/usr/local/bin/flock -ne /var/run/lighty-webConfigurator.pid /usr/local/sbin/lighttpd -f /var/etc/lighty-webConfigurator.conf' returned exit code '255', the output was '2024-07-25 15:38:44: (/usr/obj/usr/ports/www/lighttpd/work/lighttpd-1.4.76/src/network.c.604) bind() [fe80::200:b1ff:fe4d:0]:443: Can't assign requested address'
configt of lighttpd : lighty-webConfigurator.txt
I’ve Suricata, got some error after upgrading to 24.1.10 and 24.7
‘<13>1 2024-07-25T15:14:37-04:00 opn.exemple.com kernel - - [meta sequenceId=“419”] <6>vlan100: permanently promiscuous mode enabled <13>1 2024-07-25T15:14:37-04:00 opn.exemple.com kernel - - [meta sequenceId=“420”] 877.066913 [1171] generic_netmap_attach Emulated adapter for vlan100 created (prev was NULL) <13>1 2024-07-25T15:14:37-04:00opn.exemple.com kernel - - [meta sequenceId=“421”] 877.066980 [ 319] generic_netmap_register Emulated adapter for vlan100 activated <13>1 2024-07-25T15:14:37-04:00 opn.exemple.com kernel - - [meta sequenceId=“422”] 877.074053 [1171] generic_netmap_attach Emulated adapter for pppoe1 created (prev was NULL) <13>1 2024-07-25T15:14:37-04:00 opn.exemple.com kernel - - [meta sequenceId=“423”] 877.074067 [1076] generic_netmap_dtor Emulated netmap adapter for pppoe1 destroyed <13>1 2024-07-25T15:14:37-04:00 opn.exemple.com kernel - - [meta sequenceId=“424”] 877.074084 [1171] generic_netmap_attach Emulated adapter for pppoe1 created (prev was NULL) <13>1 2024-07-25T15:14:37-04:00 opn.jedduff.com kernel - - [meta sequenceId=“425”] 877.074092 [1076] generic_netmap_dtor Emulated netmap adapter for pppoe1 destroyed <13>1 2024-07-25T15:14:37-04:00 opn.exemple.com kernel - - [meta sequenceId=“426”] 877.074105 [1171] generic_netmap_attach Emulated adapter for pppoe1 created (prev was NULL) <13>1 2024-07-25T15:14:37-04:00 opn.exemple.com kernel - - [meta sequenceId=“427”] 877.074116 [1076] generic_netmap_dtor Emulated netmap adapter for pppoe1 destroyed <13>1 2024-07-25T15:14:37-04:00 opn.exemple.com kernel - - [meta sequenceId=“428”] <6>pppoe1: permanently promiscuous mode enabled <13>1 2024-07-25T15:14:37-04:00opn.exemple.comkernel - - [meta sequenceId=“429”] 877.076078 [1171] generic_netmap_attach Emulated adapter for pppoe1 created (prev was NULL) <13>1 2024-07-25T15:14:37-04:00 opn.exemple.com kernel - - [meta sequenceId=“430”] 877.076164 [ 319] generic_netmap_register Emulated adapter for pppoe1 activated <13>1 2024-07-25T15:14:37-04:00 opn.exemple.com kernel - - [meta sequenceId=“431”] <118>>>> Invoking start script ‘cron’ <13>1 2024-07-25T15:14:37-04:00 opn.exemple.com kernel - - [meta sequenceId=“432”] <118>Starting Cron: OK <13>1 2024-07-25T15:14:37-04:00 opn.exemple.com kernel - - [meta sequenceId=“433”] <118> <13>1 2024-07-25T15:14:37-04:00 opn.exemple.com kernel - - [meta sequenceId=“434”] <118>’
I did a opnsense-revert -r 21.1.8 and I don’t need to reboot and if i’m doing configctl webgui restart, i can access the gui right away.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 26 (19 by maintainers)
Commits related to this issue
- webgui: change locking in the webgui restart loosely related to #7649 Emit the new config, but do not write it to the disk yet. Make sure we can take the config file lock before proceeding. If we can... — committed to opnsense/core by fichtner 2 years ago
- webgui: change locking in the webgui restart loosely related to #7649 Emit the new config, but do not write it to the disk yet. Make sure we can take the config file lock before proceeding. If we can... — committed to opnsense/core by fichtner 2 years ago
I’ve tried to trace the issue why
lighttpdfails to bind to a link-local IPv6 address on boot and why this seems to affect users after upgrading to 24.1.10.TL;DR: There might be a race condition due to IPv6 Duplicate Address Detection (DAD) on boot.
Background: Previously when using OPNsense 24.1.6, as long as the IPv6 configuration type of an interface was set to “None”, the interface won’t get any IPv6 address assigned. Thus, when configuring this interface as “listen interface” for the WebGUI,
lighttpdwill only bind to the IPv4 address of the interface und start successfully. After the upgrade to 24.1.10, all interfaces seem to get a link-local IPv6 address assigned (fe80::/10), although “IPv6 Configuration Type” for an interface is set to “None”. This might be due to the changes regarding “Allow IPv6”, which moved from the advanced firewall config to the interface settings - although I’m not sure about the details. I couldn’t find any cause for the link-local IPv6 address in the commit which moved the setting (https://github.com/opnsense/core/commit/f5b298ec6cbfea7ee526d3eef2ebe12b49abc803). On boot,lighttpdgets started right after the interfaces come up and can’t bind to the link-local IPv6 address. This could be because the address is still “tentative” until IPv6 Duplicate Address Detection has validated that the address is unique on the local network. When the service gets reloaded manually later after boot, the link-local IPv6 is fully valid andlighttpdis able to bind to the address.The issue with
lighttpdnot beeing able to bind to link-local IPv6 addresses on boot has already been there in OPNsense 24.1.6. If a dedicated management interface for the WebGUI gets configured with static IPv4 and SLAAC for IPv6 with just a link-local address,lighttpdfails to start on boot as well, because it can’t yet bind to the link-local IPv6 address. This became an issue with 24.1.10, because now all interfaces get a link-local address as long as “Allow IPv6” is enabled at Interfaces: Settings, which is the default.As a workaround, adding the tunable „net.inet6.ip6.dad_count“ with value „0“ solves the race condition on boot by disabling IPv6 Duplicate Address Detection altogether.
I understand and fully acknowledge the remarks about “why are you messing with the listening interface in the first place?”.
Nonetheless, this behaviour seems to be unexpected.
lighttpdshould not fail on boot when a link-local IPv6 address is not yet ready.This might be related to a previous issue and forum topic:
About IPv6 Duplicate Address Detection:
The problem is you go from works -> not works with an update. What gets blamed? The update.
The first sin of UX is expecting people to read the docs prior to questions/issues arising, especially those not in an enterprise space.
The UI-level warning to me reads as “if you select the incorrect interface, you won’t be able to get to the page”, not “if you select a specific interface, it may stop working at any time”. Coming from other FW products, selecting an interface makes sense, and I know the correct interface I want to listen on. The warning is ambiguous and should be more specific (yes, that’s a separate Issue to raise).
How about:
@fichtner I was assuming a DAD race condition because setting the tunable „net.inet6.ip6.dad_count“ to „0“ solves the bind issue.
I’ve tried to find in interfaces_addresses() where tentative addresses are ignored. Seems as if the status is just returned, but the address is not omitted from the result.
The following change to webgui.inc#L85 filters tentative addresses and fixes the issue with lighttpd trying to bind to them.
Maybe this would be a more suitable approach than adding a “dad_delay”?
Sure, feel free to propose a better wording.