[NOOB] CSRF check failed. [SOLVED] => ReInstall

Started by MarieSophieSG, October 11, 2024, 12:10:30 PM

Previous topic - Next topic
October 11, 2024, 12:10:30 PM Last Edit: October 12, 2024, 01:42:09 AM by MarieSophieSG
Hello,
This morning,
I log in to my OPNsense GUI as usual, but got this instead:
CSRF check failed. Your form session may have expired, or you may not have cookies enabled.
Config is the same as it was yesterday
What did I do wrong this time ?

While searching the forum, I found an old post mentioning this problem, but it'S only a question, no answer, no workaround ...
Hunsn RS39 (N5105, 4x i225) 24.7.5_0 testing
LAN1 = swtch1 Laptop1 MX23, NAS, Laptop2 Win10
LAN2 = WiFi router AP, Laptop2, tablet, phone, printer, IoT, etc.
LAN3 = Swtch2 Laptop3 Suse; Laptop4 Qube-OS/Win10, printer
Pretending to be tech Savvy with a HomeLab :-p

Sounds like a stale cookie is making OPNsense think you're not legit. This is a client (browser) side issue.

Try from an icognito/private windows or use a different browser. Dropping cache may help but it is a hassle.

Bart...

Indeedledy. Just to add:
Usually a close tab, then open solves.
Sometimes it needs a new broser session, but rarely.
As Bart says, stale bowser session cookie.

October 11, 2024, 03:38:43 PM #3 Last Edit: October 11, 2024, 05:10:35 PM by MarieSophieSG
Same result in private window
Same result in different browser

From Laptop1 on LAN1 =
Access to Interface GUI )192.168.101.101) ok, I have the log-in page, I enter my login and password, and *then*
on Brave: move to HTTP:// (instead of HTTPS:) with CSFR error msg
On FF: Stays on HTTPS:// with CSRF error msg

Same test, same results from Tablet on LAN2 (accessing 192.168.102.101) ...
Same test, same results from Laptop2 on LAN2 (accessing 192.168.102.101) ...
Same test, same results from Laptop4 on LAN3 (accessing 192.168.103.101) ...

SSH from Laptop1 => root access OK
Hunsn RS39 (N5105, 4x i225) 24.7.5_0 testing
LAN1 = swtch1 Laptop1 MX23, NAS, Laptop2 Win10
LAN2 = WiFi router AP, Laptop2, tablet, phone, printer, IoT, etc.
LAN3 = Swtch2 Laptop3 Suse; Laptop4 Qube-OS/Win10, printer
Pretending to be tech Savvy with a HomeLab :-p

just refreshing the page the problem not going away?
Some browser extension blocky thingie?

October 11, 2024, 05:12:54 PM #5 Last Edit: October 11, 2024, 05:28:07 PM by MarieSophieSG
Quote from: cookiemonster on October 11, 2024, 04:30:09 PM
just refreshing the page the problem not going away?
Some browser extension blocky thingie?

No browser extension, same browser as yesterday, no change
Tried different browser, from 4 devices (on all 3 LAN)
Seems to be centralised to OPNsense, not client specific

Devices on LAN2 have access to the WiFi router AP GUI, connect + login, no problem

So it seems it's only OPNsense
Since I have access to the SSH, I'm wondering if I should restart with a previous BU, but ... IDK what change I did that triggered this BU, therefore if I revert, I will lose the last changes which I don't remember about :(
Hunsn RS39 (N5105, 4x i225) 24.7.5_0 testing
LAN1 = swtch1 Laptop1 MX23, NAS, Laptop2 Win10
LAN2 = WiFi router AP, Laptop2, tablet, phone, printer, IoT, etc.
LAN3 = Swtch2 Laptop3 Suse; Laptop4 Qube-OS/Win10, printer
Pretending to be tech Savvy with a HomeLab :-p

Potentially, the system time is off on either OpnSense or your clients?
Intel N100, 4 x I226-V, 16 GByte, 256 GByte NVME, ZTE F6005

1100 down / 770 up, Bufferbloat A

And, still same issue right:? CSRF check failed. Your form session may have expired, or you may not have cookies enabled.

No, don't restore a Boot Environment. This is just client side message saying the session cookie has expired, nothing else.
Ctl+Shift+I on windows machine brings the dev tools console. Refresh the page and see on the network "tab" of this tool what shows. From there you can also remove the cookie stored. Storage "tab".

Quote from: meyergru on October 11, 2024, 05:35:53 PM
Potentially, the system time is off on either OpnSense or your clients?

SSH - 8 shell the time is the same as for the clients
Hunsn RS39 (N5105, 4x i225) 24.7.5_0 testing
LAN1 = swtch1 Laptop1 MX23, NAS, Laptop2 Win10
LAN2 = WiFi router AP, Laptop2, tablet, phone, printer, IoT, etc.
LAN3 = Swtch2 Laptop3 Suse; Laptop4 Qube-OS/Win10, printer
Pretending to be tech Savvy with a HomeLab :-p

October 11, 2024, 06:22:26 PM #9 Last Edit: October 11, 2024, 06:47:55 PM by MarieSophieSG
Quote from: cookiemonster on October 11, 2024, 05:47:40 PM
And, still same issue right:? CSRF check failed. Your form session may have expired, or you may not have cookies enabled.

No, don't restore a Boot Environment. This is just client side message saying the session cookie has expired, nothing else.
Ctl+Shift+I on windows machine brings the dev tools console. Refresh the page and see on the network "tab" of this tool what shows. From there you can also remove the cookie stored. Storage "tab".

On all 5 clients all at the same time ?

All cookies and cash cleared on Laptop1 (192.168.101.102) to 192.168.101.101 => no change
Ctrl-shft-I on Laptop4 (192.168.103.102) => 192.168.103.101 - 403 Forbidden
Hunsn RS39 (N5105, 4x i225) 24.7.5_0 testing
LAN1 = swtch1 Laptop1 MX23, NAS, Laptop2 Win10
LAN2 = WiFi router AP, Laptop2, tablet, phone, printer, IoT, etc.
LAN3 = Swtch2 Laptop3 Suse; Laptop4 Qube-OS/Win10, printer
Pretending to be tech Savvy with a HomeLab :-p

Can you try browsing to the IP address (ignore the cert warning, of course) and/or add an entry for the firewall name in your hosts file?

Quote from: bartjsmit on October 11, 2024, 06:25:21 PM
Can you try browsing to the IP address (ignore the cert warning, of course) and/or add an entry for the firewall name in your hosts file?

I can browse to the IP, since it's giving me the login page, but it's when I enter my credential and hit send that I got the CSRF error message

Adding an entry for the FW name in my host ? I have no idea what that is
Hunsn RS39 (N5105, 4x i225) 24.7.5_0 testing
LAN1 = swtch1 Laptop1 MX23, NAS, Laptop2 Win10
LAN2 = WiFi router AP, Laptop2, tablet, phone, printer, IoT, etc.
LAN3 = Swtch2 Laptop3 Suse; Laptop4 Qube-OS/Win10, printer
Pretending to be tech Savvy with a HomeLab :-p

I went ahead and reverted to last BU in my list
SSH => 8 shell => 13 revert => 1 last change

Error, No space left !

what ? how did it fill-up 90Gb of disk in one night ??
I guess I left some tracking on overnight ...

So no trying option 5, turn off
Otherwise, hard kill.
Hunsn RS39 (N5105, 4x i225) 24.7.5_0 testing
LAN1 = swtch1 Laptop1 MX23, NAS, Laptop2 Win10
LAN2 = WiFi router AP, Laptop2, tablet, phone, printer, IoT, etc.
LAN3 = Swtch2 Laptop3 Suse; Laptop4 Qube-OS/Win10, printer
Pretending to be tech Savvy with a HomeLab :-p

Quote from: MarieSophieSG on October 11, 2024, 10:18:43 PM
Error, No space left !

what ? how did it fill-up 90Gb of disk in one night ??
Quotedf -h
?

Let's check the disk usage:
SSH to the machine, change directory to the root, then df -h
$ cd /
$ df -h

Then let's have a little look at the partitions:
$ gpart show

Previous:
> On all 5 clients all at the same time ?
No, this web dev tools is useful to delete specific cookies and to analyse the browser-server conversation. Just the one machine being used to diagnose is sufficient.

For seeing if you can trace the login error on the server side you could try (with root permissions):
# cat /var/log/audit/latest.log | grep 'WebGui'
after the attempt to login. Should leave a trace. 403 Forbidden is good in a way.
Are you logging in as a user you created previously that is not "root"?
If as root and perhaps the password is wrong, you can reset it from the console main menu, option 3

And just so we know the right port and interface where lighttpd is listening can you post also the result of (in code quotes here):
# sockstat | grep light

Finally, it would be good also to see the ifconfig result:
#ifconfig
you can redact your public ip if you wish for privacy. We just need the rest.