Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    mass modification captive-portal file (ansible)

    Scheduled Pinned Locked Moved Captive Portal
    6 Posts 3 Posters 365 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      slybreiz
      last edited by

      Hello
      we have a hundred captive portal with pfsens e of installations.
      we have a small modification on the portal authentication page.

      I tried to modify the files by hand in:

      /usr/local/captiveportal/captiveportal-error.html
      /var/db/cpelements/captiveportal-error.html
      and
      /usr/local/captiveportal/captiveportal-captiveportal.html
      /var/db/cpelements/captiveportal-captiveportal.html

      but after saving in the captive portal tab.
      the values will appear as before ...

      I am going through editor in the diagnostic / edit tab, but also via SSH.

      I later wish to modify the files via Ansible but without the first step of validating.
      we will therefore have to modify all the captive portal via the file manager tab of the captive portal and Portal page contents.

      thank you in advance

      1 Reply Last reply Reply Quote 0
      • H
        heper
        last edited by

        afaik all of it is stored in config.xml

        you could probably find a way to change it directly in it.

        1 Reply Last reply Reply Quote 0
        • S
          slybreiz
          last edited by

          ok the files in config.xml it's encrypted :( don't modify

          1 Reply Last reply Reply Quote 0
          • H
            heper
            last edited by heper

            its not encrypted. its base64 encoded.

            like so:

            <page>
                                            <htmltext>PGZvcm0gbWV0aG9kPSJwb3N0IiBhY3Rpb249IiRQT1JUQUxfQUNUSU9OJCI+CiAgIDxpbnB1dCBuYW1lPSJhdXRoX3VzZXIiIHR5cGU9InRleHQiPgogICA8aW5wdXQgbmFtZT0iYXV0aF9wYXNzIiB0eXBlPSJwYXNzd29yZCI+CiAgIDxpbnB1dCBuYW1lPSJhdXRoX3ZvdWNoZXIiIHR5cGU9InRleHQiPgogICA8aW5wdXQgbmFtZT0icmVkaXJ1cmwiIHR5cGU9ImhpZGRlbiIgdmFsdWU9IiRQT1JUQUxfUkVESVJVUkwkIj4KICAgPGlucHV0IG5hbWU9InpvbmUiIHR5cGU9ImhpZGRlbiIgdmFsdWU9IiRQT1JUQUxfWk9ORSQiPgogICA8aW5wdXQgbmFtZT0iYWNjZXB0IiB0eXBlPSJzdWJtaXQiIHZhbHVlPSJDb250aW51ZSI+Cgk8YSBocmVmPSJvaG5vb2VzIj5vaG5vb2VzPC9hPgo8L2Zvcm0+Cg==</htmltext>
                                    </page>
            
            

            this can be easily decoded by using the builtin base64 functions in (m)any programming/scripting languages.

            even online you can easily find websites that do it for you:
            https://www.base64decode.org/

            1 Reply Last reply Reply Quote 0
            • S
              slybreiz
              last edited by

              Hello

              OK, thanks

              • I will therefore have to:
              • decode the part that interests me.
              • modify line
              • then encode it
              • and then rinse it out.
              1 Reply Last reply Reply Quote 0
              • GertjanG
                Gertjan
                last edited by Gertjan

                The config.xml contains all the settings, of any configuration file on pfSense.
                You have hundred pfSEnse installs in the field yet that very first strong point of pfSense is unknown to you ?

                When you read :
                Install pfSense 'from scratch', then import ONE congig file ans everything is setup, what do you make of that ?
                It must be something like : from the config.xml file, all system config files are created. Right ?
                Among them : (your own ) captive portal landing-login page.

                If the uploaded file is the default one, you can get it right out of your browser : just look at the html .....
                Every browser has a page inspection facility.
                Still, you need to look up "in the manual" what actually in that file, because some are variables, put in place "on the fly" when the page is send to the visitor.

                Or use :

                29ebbd82-92bc-4f0b-9c6b-a2b8c41f5026-image.png

                and then uses this info :

                053a9fec-6259-478b-a406-bfa4e5779a17-image.png

                to complete the minimal framework to get to a usable login page.

                That's all there is.

                So, no need to look and de-base64 parts of the config.xml.
                It would work, that's for sure.

                The final work flow will be :

                1. You make your page - start with the default one (see below).
                2. Import it using the GUI.
                3. Test, if no-go, goto 1)
                4. Done.

                Where step 4) might as well be the most difficult one ;)

                No "help me" PM's please. Use the forum, the community will thank you.
                Edit : and where are the logs ??

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post
                Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.