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.
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.
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:
sub escape($) {
my $s = shift;
return HTML::Entities::encode_entities($s);
}
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.
I would say that should be changed to use the escape function in header.pl
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.
// 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.
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:
Ultimately, captive portal users cannot use it with the CU203
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
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.
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:
- The change that introduced the problem was not tested by the developer.
- 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.
- I proposed a fix.
- You replied that you had tested it and could not reproduce any problem, and the bug was closed.
- When CU203 was released, users started reporting the same problem.
- You eventually reopened the bug.
- You are now challenging my proposed fix.
- 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.
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
index.cgi
template.html
Anyone interested in the modified files should contact me privately.
your patch works, try to publish it respecting the advice given by @bonnietwin
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.
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 – 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.
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.
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.
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
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:
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:
git config user.name "Your Name"
git config user.email "your@email.com"
2. Copy your three files
Assuming they’re in ~/captive-modified/:
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
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
git format-patch -1
Then send the resulting 0001-*.patch file as an attachment to 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.
@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.

