1
23.1 Legacy Series / Re: Captive Portal seems to be broken following update to 23.1.2
« on: March 09, 2023, 02:26:43 pm »
So I just mocked around with sqlite on my instance, and there seem to be no problem with my database.
I can manually select all entries in the table.
So I tried to manually fire off the query generated in db.py - and it seems sqlite don't like double quotes in a query:
Code at line 245 in /usr/local/opnsense/scripts/OPNsense/CaptivePortal/lib/db.py (from the error message) looks like this:
Workaround:
In /usr/local/opnsense/scripts/OPNsense/CaptivePortal/lib/db.py line 251 - replace the double quotes (") with single quotes (').
After doing this on my box, the captive portal and my whitelist is working again, and I get no more errors about forced database repair.
Although I still get spammed in the logs with an error message about no active session, user not found.
Don't know what that is about - oh well...
So I guess this needs to be officially fixed in the next release.
Take this info for what it is: not a permanent solution. Use at your own risk.
I can manually select all entries in the table.
So I tried to manually fire off the query generated in db.py - and it seems sqlite don't like double quotes in a query:
Code: [Select]
sqlite> select cc.sessionid sessionId, cc.username userName from cp_clients cc where cc.zoneid = 0 and cc.deleted = 0 and cc.username is not null and cc.username <> "" order by case when cc.username is not null then cc.username else cc.ip_address end, cc.created desc;
Parse error: no such column:
0 and cc.username is not null and cc.username <> "" order by case when cc.use
error here ---^
sqlite>
Code at line 245 in /usr/local/opnsense/scripts/OPNsense/CaptivePortal/lib/db.py (from the error message) looks like this:
Code: [Select]
cur.execute(""" select cc.sessionid sessionId
, cc.username userName
from cp_clients cc
where cc.zoneid = :zoneid
and cc.deleted = 0
and cc.username is not null
and cc.username <> "" <---- problem here !!!
order by case when cc.username is not null then cc.username else cc.ip_address end
, cc.created desc
""", {'zoneid': zoneid})
Workaround:
In /usr/local/opnsense/scripts/OPNsense/CaptivePortal/lib/db.py line 251 - replace the double quotes (") with single quotes (').
After doing this on my box, the captive portal and my whitelist is working again, and I get no more errors about forced database repair.
Although I still get spammed in the logs with an error message about no active session, user not found.
Don't know what that is about - oh well...
Code: [Select]
2023-03-09T14:12:40 Error api [2023-03-09T14:12:40+01:00][ERROR] no active session, user not found
2023-03-09T14:12:39 Error api [2023-03-09T14:12:39+01:00][ERROR] no active session, user not found
2023-03-09T14:12:35 Error api [2023-03-09T14:12:35+01:00][ERROR] no active session, user not found
2023-03-09T14:12:35 Error api [2023-03-09T14:12:35+01:00][ERROR] no active session, user not found
2023-03-09T14:12:29 Error api [2023-03-09T14:12:29+01:00][ERROR] no active session, user not found
2023-03-09T14:12:28 Error api [2023-03-09T14:12:28+01:00][ERROR] no active session, user not found
2023-03-09T14:12:23 Notice captiveportal starting captiveportal background process
So I guess this needs to be officially fixed in the next release.
Take this info for what it is: not a permanent solution. Use at your own risk.