Problems restoring configuration on IPFIRE relates to captivectrl

Dear friends,

I’m restoring a backup from one architecture to another new one.

When IPFIRE reboots, before entering Run level 3, a lot of console messages shows

iptables V1.8.7 (legacy): Invalid MAC address specified.
Try…

I tracked down the problem to a call inside /etc/init.d/firewall script, when the /usr/local/bin/captivectrl is called.

Everytime captivectrl is called, a lot of errors are shown in the console.

My captive portal is not currently activated, in green or blue. However, in the config web page, I see a lot of coupons. All of them are very malformed, with activated timestamp and expiry timestamp with ‘31.12.1969 21:00’. All other fileds are empty.

Seems that some garbage exists in some file that are resulting in some parser errors.

Where are these coupons stored in IPFIRE?

Thanks in advance.
Pellini

The coupons are stored in the following file

/var/ipfire/captive/coupons

If you have no coupons and the captive portal is not being used as on my system this file is empty so you could make a backup of this file and then clear the contents of the file.

Thanks for the answer.

It is strange but there is no coupons file anywhere in the filesystem.

Yet, the captive.cgi web page still shows a coupon.

I deleted most of the coupons there, but I left a single one in the page. This reduced the iptables errors that shows during the boot procedure.

Anyway, I`m trying to understand where this information comes from.

Currently the filesystem under /var/ipfire/captive has the following files:

-rw-r--r--  1 nobody nobody    0 Jun 26  2020 agb.txt
-rw-r--r--  1 nobody nobody    3 Feb  4 11:47 clients
-rw-r--r--  1 nobody nobody  115 Jan 31 13:56 settings
-rw-r--r--  1 nobody nobody   45 Jan 31 13:56 terms.txt
-rw-r--r--  1 nobody nobody    0 Jun 26  2020 voucher_out

The clients file has the number ‘13’ inside and a new line character.

I don’t understand how you can have a coupon shown on the wui page and not have a coupons file.

My coupons file exists but is empty. I then created a new coupon and then the coupons file is no longer empty but has a line for the generated coupon.
Then I deleted the coupon on the wui page and the coupons file was empty again.

I also tried creating a coupon on the wui page and then I edited the coupons file to remove the coupon entry and then refreshed the wui captive portal page and the coupon had gone.

Here is the filesystem on my system.

-rw-r–r-- 1 nobody nobody 0 Oct 22 2017 agb.txt
-rw-r–r-- 1 nobody nobody 0 Mar 16 2021 clients
-rw-r–r-- 1 nobody nobody 0 Feb 6 12:52 coupons
-rw-r–r-- 1 nobody nobody 106K Mar 16 2021 logo.dat
-rw-r–r-- 1 nobody nobody 110 Feb 6 12:50 settings
-rw-r–r-- 1 nobody nobody 0 Feb 6 12:48 terms.txt
-rw-r–r-- 1 nobody nobody 0 Oct 22 2017 voucher_out

My clients entry is empty. I would suspect that this only has an entry when you have a client using the captive portal. So if nothing is connected then I would expect that file to be empty. You could also try making a backup copy of it and then clearing the contents of it and see if that helps.

My logo.dat has content because I uploaded an image when I was testing out the captive portal. My terms.txt is empty because I never created any.

If you still have a coupon showing on the wui page but you have no coupons file then I don’t understand that. I think you would have to read the cgi page code to understand how that might happen but I don’t see any issue with you deleting that coupon on the wui page.
When all the coupons are gone on the page then you could test out creating a new one and see if the coupons file is created and filled.