# Modified captive system

**URL:** <https://community.ipfire.org/t/modified-captive-system/16141>\
**Category:** Add-Ons\
**Created:** [12 September 2026 07:53 UTC](https://community.ipfire.org/t/modified-captive-system/16141 "2026-09-12T07:53:23Z")\
**Posts on this page:** 16\
**Page:** 2

<div class="post-metadata">

**Author:** ![bonnietwin](https://community.ipfire.org/user_avatar/community.ipfire.org/bonnietwin/32/12350_2.png) [@bonnietwin](https://community.ipfire.org/u/bonnietwin)\
**Post date:** [13 September 2026 13:08 UTC](https://community.ipfire.org/t/modified-captive-system/16141/21 "2026-09-13T13:08:56Z")

</div>

> [@tratru](#):
>
> I’m not familiar with Git and have never used it.

You have learnt how to use perl to create your desired changes and learning about git is not more difficult and that is where I would be more than willing to help when you run into any issues.

---

<div class="post-metadata">

**Author:** ![tratru](https://community.ipfire.org/user_avatar/community.ipfire.org/tratru/32/8787_2.png) [@tratru](https://community.ipfire.org/u/tratru)\
**Post date:** [13 September 2026 14:04 UTC](https://community.ipfire.org/t/modified-captive-system/16141/22 "2026-09-13T14:04:35Z")

</div>

Hi there.  
You’re right, in a way—but there is a “but.”  
In my career as a programmer—I think I’m hitting the 40-year mark this year—I’ve never used Git. At first, it didn’t exist; later on, the systems I develop didn’t allow for the use of platforms like Git or similar tools.

So, I adopted a technique that I’ve been using for many years—and still use every day—and I’m certainly not the only one in my field who uses alternative methods like mine.

I learned languages ​​like Perl, Python, and others for personal enrichment and just to tinker with them; consequently, when I write code in those languages, I apply the same technique I use for my professional work.

It’s true, I _could_ learn it, but I think that opens up a whole other discussion—one I don’t really want to get into here.

---

<div class="post-metadata">

**Author:** ![pscar13](https://community.ipfire.org/user_avatar/community.ipfire.org/pscar13/32/16558_2.png) [@pscar13](https://community.ipfire.org/u/pscar13)\
**Post date:** [13 September 2026 14:15 UTC](https://community.ipfire.org/t/modified-captive-system/16141/23 "2026-09-13T14:15:17Z")

</div>

> [@bonnietwin](#):
>
> The fix is to find out why the escape function from header.pl is not working in index.cgi when it works in other .cgi pages and then correct that issue.

header.pl cannot simply be included in captive/index.cgi, because doing so breaks the captive portal.  
Therefore the real bug is the dependency/side effect of header.pl, not the existence of a local escape().

There is also already an example of this exact situation in `/srv/web/ipfire/html/redirect.cgi`:

```auto
sub escape($) {
    my $s = shift;
    return HTML::Entities::encode_entities($s);
}

```

---

<div class="post-metadata">

**Author:** ![bonnietwin](https://community.ipfire.org/user_avatar/community.ipfire.org/bonnietwin/32/12350_2.png) [@bonnietwin](https://community.ipfire.org/u/bonnietwin)\
**Post date:** [13 September 2026 14:19 UTC](https://community.ipfire.org/t/modified-captive-system/16141/24 "2026-09-13T14:19:28Z")

</div>

> [@pscar13](#):
>
> header.pl cannot simply be included in captive/index.cgi, because doing so breaks the captive portal.

I would say we need to find out why and fix it. I don’t accept that using header.pl intrinsically breaks index.cgi when it works fine for aliases.cgi, backup.cgi, captive.cgi …  
EDIT  
I haven’t checked if those cgi pages use the escape function but header.pl is used in 87 .cgi files and many of those will use the escape function from header.pl to prevent Cross Site Scripting attacks.

> [@pscar13](#):
>
> There is also already an example of this exact situation in `/srv/web/ipfire/html/redirect.cgi`:

I would say that should be changed to use the escape function in header.pl

---

<div class="post-metadata">

**Author:** ![pscar13](https://community.ipfire.org/user_avatar/community.ipfire.org/pscar13/32/16558_2.png) [@pscar13](https://community.ipfire.org/u/pscar13)\
**Post date:** [13 September 2026 14:46 UTC](https://community.ipfire.org/t/modified-captive-system/16141/25 "2026-09-13T14:46:47Z")

</div>

I think the important point here is that `header.pl` is designed for the normal IPFire Web interface, which is accessed through HTTPS on port 444.

```auto
// config/cfgroot/header.pl
98: ### Make sure this is an SSL request
99: if ($ENV{'SERVER_ADDR'} && $ENV{'HTTPS'} ne 'on') {
100: print "Status: 302 Moved\r\n";
101: print "Location: https://$ENV{'SERVER_ADDR'}:444/$ENV{'PATH_INFO'}\r\n\r\n";
102: exit 0;
103: }
104:

```

The HTTPS check in `header.pl` therefore makes sense for the regular CGI pages: if they are accessed over HTTP, they are redirected to port 444.

However, `captive/index.cgi` is not a normal Web UI page. It is served by the captive portal on port 1013, and `html/redirect.cgi` is served on port 81.

Therefore, the HTTPS redirection in `header.pl` cannot simply be applied to these pages. Including `header.pl` in `captive/index.cgi` triggers that redirect and prevents the captive portal page from being displayed.

This is why I had to remove the `header.pl` include and keep a local copy of `escape()` as a workaround.

I agree that duplicating the function is not the cleanest solution. But the underlying issue is that `header.pl` contains code that is specific to the port 444 Web interface and is not suitable for the captive portal.

---

<div class="post-metadata">

**Author:** ![pscar13](https://community.ipfire.org/user_avatar/community.ipfire.org/pscar13/32/16558_2.png) [@pscar13](https://community.ipfire.org/u/pscar13)\
**Post date:** [13 September 2026 15:08 UTC](https://community.ipfire.org/t/modified-captive-system/16141/26 "2026-09-13T15:08:04Z")

</div>

> [@bonnietwin](#):
>
> I would say that should be changed to use the escape function in header.pl

I think there is another important point here.  
The problem was introduced by adding the `header.pl` import to `captive/index.cgi` during the fix for bug 13996.  
This change was apparently made without testing the captive portal afterwards.

If the modified code had been tested with the captive portal, the problem would have been immediately apparent: `header.pl` redirects the request to port 444 and exits, so `captive/index.cgi` never gets the opportunity to display the portal page.  
I reported this issue, but it was deferred:

> **[13996 – \[CU202\] : French (and Spanish) accents corrupted in WUI](https://bugzilla.ipfire.org/show_bug.cgi?id=13996#c10)**

Ultimately, captive portal users cannot use it with the CU203

> [@Problems with Captive Portal and 203](https://community.ipfire.org/t/problems-with-captive-portal-and-203/16106/5):
>
> I will just revert to 202 for now.

---

<div class="post-metadata">

**Author:** ![pscar13](https://community.ipfire.org/user_avatar/community.ipfire.org/pscar13/32/16558_2.png) [@pscar13](https://community.ipfire.org/u/pscar13)\
**Post date:** [13 September 2026 16:23 UTC](https://community.ipfire.org/t/modified-captive-system/16141/27 "2026-09-13T16:23:09Z")

</div>

And finally, I know you’re not going to like this:

You often mention the limited time you have to deal with all the issues. But this also clearly illustrates how much time anyone, including you or me and users, can lose when a change isn’t tested

---

<div class="post-metadata">

**Author:** ![bonnietwin](https://community.ipfire.org/user_avatar/community.ipfire.org/bonnietwin/32/12350_2.png) [@bonnietwin](https://community.ipfire.org/u/bonnietwin)\
**Post date:** [13 September 2026 17:21 UTC](https://community.ipfire.org/t/modified-captive-system/16141/28 "2026-09-13T17:21:51Z")

</div>

> [@pscar13](#):
>
> But this also clearly illustrates how much time anyone, including you or me and users, can lose when a change isn’t tested

That’s why more people need to carry out evaluation of the Testing release.

No one person can test everything and also some issues relate to corner cases where the systems the developers have don’t show the effect or where a specific combination of IPFire functions trigger issues.

Suggesting that the developers are not putting enough time into testing, I find a very demotivating response.

---

<div class="post-metadata">

**Author:** ![pscar13](https://community.ipfire.org/user_avatar/community.ipfire.org/pscar13/32/16558_2.png) [@pscar13](https://community.ipfire.org/u/pscar13)\
**Post date:** [13 September 2026 17:44 UTC](https://community.ipfire.org/t/modified-captive-system/16141/29 "2026-09-13T17:44:09Z")

</div>

> [@bonnietwin](#):
>
> Suggesting that the developers are not putting enough time into testing, I find a very demotivating response.

I understand your response, but in this case, I am the one who is demotivated.

I have been actively participating in testing for a long time.  
But I think you need to understand why I am frustrated in this particular case:

1. The change that introduced the problem was not tested by the developer.
2. I tested it myself and reported the resulting problem, only to be told that it was a new bug — even though the bug had just been introduced by the change.
3. I proposed a fix.
4. You replied that you had tested it and could not reproduce any problem, and the bug was closed.
5. When CU203 was released, users started reporting the same problem.
6. You eventually reopened the bug.
7. You are now challenging my proposed fix.
8. And I have been spending my time since then explaining where the problem actually comes from.

I think that is a lot of time wasted for what was essentially an untested change.

I am not saying this to blame anyone. I am saying it because this particular sequence of events has been quite frustrating from my side as well.

---

<div class="post-metadata">

**Author:** ![tratru](https://community.ipfire.org/user_avatar/community.ipfire.org/tratru/32/8787_2.png) [@tratru](https://community.ipfire.org/u/tratru)\
**Post date:** [17 September 2026 09:45 UTC](https://community.ipfire.org/t/modified-captive-system/16141/31 "2026-09-17T09:45:47Z")

</div>

Hi,  
As mentioned, I would like to submit the modified code for validation, but I am not very familiar with Git.  
I was wondering if anyone would be willing to help me.  
I have uploaded the original and modified files to GitHub:  
capture.cgi

> <https://github.com/ParmaU/IPFire_Captive/pull/1/files>

index.cgi

> <https://github.com/ParmaU/IPFire_Captive/commit/606e5c0247a772debcab71a7afeac0830b1d6ba2>

template.html

> <https://github.com/ParmaU/IPFire_Captive/commit/19a9f2253cd510ca91afc39e02d78c002c2120f3>

---

<div class="post-metadata">

**Author:** ![tratru](https://community.ipfire.org/user_avatar/community.ipfire.org/tratru/32/8787_2.png) [@tratru](https://community.ipfire.org/u/tratru)\
**Post date:** [21 September 2026 16:54 UTC](https://community.ipfire.org/t/modified-captive-system/16141/32 "2026-09-21T16:54:02Z")

</div>

Anyone interested in the modified files should contact me privately.

---

<div class="post-metadata">

**Author:** ![pscar13](https://community.ipfire.org/user_avatar/community.ipfire.org/pscar13/32/16558_2.png) [@pscar13](https://community.ipfire.org/u/pscar13)\
**Post date:** [21 September 2026 18:08 UTC](https://community.ipfire.org/t/modified-captive-system/16141/33 "2026-09-21T18:08:41Z")

</div>

your patch works, try to publish it respecting the advice given by @bonnietwin

> **[Re: Modifications to the captive portal system - Adolf Belka](https://lists.ipfire.org/development/a9129537-143d-43f4-8eaf-12cdde6d0192@ipfire.org/)**

---

<div class="post-metadata">

**Author:** ![tratru](https://community.ipfire.org/user_avatar/community.ipfire.org/tratru/32/8787_2.png) [@tratru](https://community.ipfire.org/u/tratru)\
**Post date:** [21 September 2026 18:55 UTC](https://community.ipfire.org/t/modified-captive-system/16141/34 "2026-09-21T18:55:25Z")

</div>

Hi @pscar13

As I believe I’ve already mentioned, I’m a programmer “from the old school” 😊. I don’t work in PC software development, but mainly in the industrial field, and I believe that these days I’m reaching 40 years of professional experience in this sector.

Over all these years, I’ve developed and adopted my own methods and techniques for keeping track of changes to the code I write. It’s not because I don’t like Git or similar systems, but simply because the development environments I normally work with don’t allow me to use platforms of that kind.

As for languages such as Perl or Python, my knowledge is fairly basic and comes mainly from personal interest and self-study rather than from my everyday work environment.

I read the guide for publishing the code very carefully, and I also discussed it with @bonnietwin To be honest, considering the way I normally work and the type of development environment I use, the whole process is quite challenging for me.

I completely understand that changing and adapting my entire way of working just for three files probably wouldn’t make much sense. So, although I’m a little disappointed about it, I’ve decided not to proceed with making the code officially available at this time.

That said, this absolutely doesn’t mean that I’m unwilling to collaborate. As I’ve mentioned several times, I’m more than happy to make any changes that the development team considers necessary, so that the code can be integrated more easily or made compliant with your requirements.

I’d also like to add one thing that is particularly important to me: I know that the code works. I’m very meticulous in my work, and I tend to test and re-test everything before considering it ready. In my field, an error doesn’t simply result in some lost data or a software malfunction: in certain situations, it can have much more serious consequences, potentially even putting human lives at risk.

That’s why the code has been tested, re-tested, and thoroughly checked several times before I made it available.

I hope my decision will therefore be understood not as a lack of willingness to cooperate, but simply as the difficulty of adapting a working method that has been established over 40 years to the procedures required for publishing the code.

---

<div class="post-metadata">

**Author:** ![tratru](https://community.ipfire.org/user_avatar/community.ipfire.org/tratru/32/8787_2.png) [@tratru](https://community.ipfire.org/u/tratru)\
**Post date:** [24 September 2026 08:35 UTC](https://community.ipfire.org/t/modified-captive-system/16141/35 "2026-09-24T08:35:51Z")

</div>

## 🚀 Captive Portal System Updates: Work Completed!

I can finally share the latest updates with you: **the modifications to the Captive Portal system are now complete!** 🎉

A lot of work has gone into improving and extending the system, with several changes aimed at making both the administration and the end-user experience easier, clearer, and more flexible.

Here is an overview of the main changes.

### 🔐 Coupon Improvements

The **coupon** system has been updated.

The coupon length has been increased from **8 to 10 characters** , and some **special characters** have also been introduced.

The goal is to provide more robust and flexible coupon codes while keeping them simple for users to enter and use.

### 🌐 Hosting Without a Coupon

It is now possible to add a **host/device without requiring a coupon**.

This is particularly useful for devices that cannot easily go through the normal authentication process, such as:

- 🖨 network printers;

- 📡 IoT devices;

- 🔧 other devices that need network access without user interaction.

This makes it much easier to manage devices that need permanent or direct access to the network.

### 🗣 Support for a Second Language

Support for **two languages in the Terms of Use** has been added.

The first language is the **local language** , while the second can, for example, be set to **English**.

This is useful for environments where some users may not understand the local language and therefore need access to the Terms of Use in English as well.

### 📶 SSID Added to the Printed Coupon

Another small but useful improvement is the addition of the **Wi-Fi network name (SSID)** directly to the printed coupon.

This means that users now have **all the information they need to connect to the network** in one place, without having to find the network name separately.

### 🔑 Authentication Page Improvements

The **authentication page** has also been updated.

Support for a **second language** has been added, allowing users to see the information in both configured languages.

The issue that could prevent the authentication page from being displayed correctly has also been fixed, as reported in **[Bug 14006](https://bugzilla.ipfire.org/show_bug.cgi?id=14006) – CU203**, as pointed out by @pscar13.

### 🆕 New Page for Creating Coupons

One of the most interesting additions is the new page dedicated to **creating coupons**.

It is no longer necessary to access the firewall configuration page in order to generate them.

Coupons can now be created directly from the new dedicated page, making the process much simpler and more convenient.

For security reasons, the page is protected by a **username and password** , which are stored in the appropriate configuration file.

The page must also be placed **outside the `cgi-bin` directory**.

### 🏢 Information Displayed on the Page

Among the information displayed on the page is the **SSID** , which is retrieved directly from the `settings` file created by the coupon management page.

There is also a **Company** field, which must be entered manually.

This field identifies who is providing or managing the Wi-Fi service.

For example:

- a school;

- a bar;

- a hotel;

- a company;

- a public facility.

This makes it possible to clearly identify **who is providing the Wi-Fi service** directly on the generated coupon.

 ![coupons1](https://community.ipfire.org/uploads/default/original/3X/8/c/8c237e12b444bdbf709eaa0a1594d7654ed06874.png)

### 🖨 PDF Generation

The new page also allows you to **generate a PDF containing the coupons** , ready to be printed.

The PDF includes all the information required by the user to connect to the network, making the coupon immediately ready for use.

 ![coupons2](https://community.ipfire.org/uploads/default/original/3X/e/a/ea17c6f33e1b21f101c4e9961e37941ad49d9299.png)

### 🌍 Translations

To complete the work, **translations in several languages** have also been added.

The language to be used is determined by a specific string stored in the `settings` file.

This makes it possible to change the system language easily without having to modify the page code directly.

* * *

## 📦 Interested in Trying the Complete Version?

For anyone interested in getting **all the files and modifications** , feel free to contact me privately.

Unfortunately, I cannot post all the files directly on the forum, and at the moment managing everything through a file-sharing service is also rather difficult for me.

So, if you are interested, **send me a private message and I will provide you with everything you need**.

## 📚 And Now… the Manual!

There is only one final step left: **the documentation**. 😄

So, please be a little patient while I prepare the manual with all the necessary explanations.

The goal is to make sure that, once the documentation is complete, **everyone will be able to install, configure, and modify the system independently** , without having to rely on me for every single change.

In other words, the main development work is now finished… **the only thing left is to put everything down on paper!** 😉

Thanks to everyone who has followed the project, reported issues, and provided suggestions. **Many of these improvements came directly from the needs and feedback that emerged while using the system.**

---

<div class="post-metadata">

**Author:** ![raffe](https://community.ipfire.org/user_avatar/community.ipfire.org/raffe/32/15847_2.png) [@raffe](https://community.ipfire.org/u/raffe)\
**Post date:** [24 September 2026 10:51 UTC](https://community.ipfire.org/t/modified-captive-system/16141/36 "2026-09-24T10:51:58Z")

</div>

> [@tratru](#):
>
> As mentioned, I would like to submit the modified code for validation, but I am not very familiar with Git.  
> I was wondering if anyone would be willing to help me.

I think you can do it like this (If I’m wrong, please feel free to correct me if you know the right way to do it)

1. Clone IPFire and create a branch

```auto
git clone https://git.ipfire.org/pub/git/ipfire-2.x.git
cd ipfire-2.x
git fetch origin
git checkout -b captive-changes origin/next

```

Configure your Git name and email:  
First, check whether your name and email are already configured:

```auto
git config user.name
git config user.email

```

If they are correct, you don’t need to do anything.

If they are missing or incorrect, set them with:

```auto
git config user.name "Your Name"
git config user.email "your@email.com"

```

2. Copy your three files  
Assuming they’re in ~/captive-modified/:

```auto
cp ~/captive-modified/captive.cgi html/cgi-bin/captive.cgi
cp ~/captive-modified/index.cgi html/cgi-bin/captive/index.cgi
cp ~/captive-modified/template.html html/html/captive/template.html

```

3. Commit the changes

```auto
git add html/cgi-bin/captive.cgi html/cgi-bin/captive/index.cgi html/html/captive/template.html
git commit -sv

```

4. Generate and email the patch

```auto
git format-patch -1

```

Then send the resulting 0001-\*.patch file as an attachment to [development@lists.ipfire.org](mailto:development@lists.ipfire.org)

If possible, reply to the existing development mailing-list thread when sending it, so that the patch remains associated with the previous discussion.

I see that you’re using AI, so it can also help if you run into problems with Git.

---

<div class="post-metadata">

**Author:** ![tratru](https://community.ipfire.org/user_avatar/community.ipfire.org/tratru/32/8787_2.png) [@tratru](https://community.ipfire.org/u/tratru)\
**Post date:** [25 September 2026 14:49 UTC](https://community.ipfire.org/t/modified-captive-system/16141/37 "2026-09-25T14:49:08Z")

</div>

@raffe  
I’ve already considered the matter, and I find it complicated given my usual way of working, but I’ll look into it again and run some tests—partly because I’d hate not to share the work I’ve done.

[Previous page](https://community.ipfire.org/t/modified-captive-system/16141.md?page=1)
