Re: wildcard with zeroshell

#46492

kostis
Member

I just registered to this forum to say thank you to tphipps for his workaround and give a solution for keeping these changes after reboot:

Comment out the code in /root/kerbynet.cgi/scripts/cp_auth_start that updates the cp_as-httpd file with the CN of the certificate like so:

    render "$TEMPLATE/$HTTPCONF" | sed "s/%{SERVER_ADDR}/$CN/g" #> /var/register/system/cp/Auth/cp_as-httpd
else
render "$TEMPLATE/$HTTPCONF" #> /var/register/system/cp/Auth/cp_as-httpd
fi
else
render "$TEMPLATE/$HTTPCONF" #> /var/register/system/cp/Auth/cp_as-httpd

and then hardcode the appropriate hostname directly into /var/register/system/cp/Auth/cp_as-httpd like so:

RewriteRule ^.*$ https://captiveportal.example.com:12081/cgi-bin/zscp?Section=CPAuth&Action=Show&${filter:%{QUERY_STRING}} [L]

instead of:

RewriteRule ^.*$ https://*.example.com:12081/cgi-bin/zscp?Section=CPAuth&Action=Show&${filter:%{QUERY_STRING}} [L]

Now, the only system folders that keep changes after reboot are /Database and /DB. Therefore, you can copy the modified files there:

mkdir /Database/Scripts
cp /root/kerbynet.cgi/scripts/cp_auth_start /Database/Scripts/
cp /var/register/system/cp/Auth/cp_as-httpd /Database/Scripts/

and then copy them back automatically on system boot:
at the `Web-GUI > Setup > Startup/Cron > Pre Boot` enter these commands:

/bin/cp /Database/Scripts/cp_auth_start /root/kerbynet.cgi/scripts/
/bin/cp /Database/Scripts/cp_as-httpd /var/register/system/cp/Auth/

If you are running ZeroShell from a Live CD you might also find this useful: How to install ZeroShell on Hard Disk however just note that installing ZeroShell on an HDD doesn’t make changes persistent, it still runs live on RAM.

There you go! Now the users will be redirected to “https://captiveportal.example.com:12081” instead of “https://*.example.com:12081”

Regards,
/kostis