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

    Where can I find information on the backup/restore XML schema?

    Scheduled Pinned Locked Moved Development
    14 Posts 4 Posters 1.8k 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.
    • I
      imthenachoman @noplan
      last edited by

      @noplan

      I think I am going crazy.

      I imported an XML file my tool created and it didn't work. Did this 15+ times with the same XML file and it didn't work.

      I gave up, came back a few hours later, imported the same XML file, and it worked.

      And by not working, I mean that the rules were there but not registering. For example, I had a rule to allow one VLAN access to the internet but the devices on that VLAN couldn't access the internet.

      It seems to be working now. But I would still like the schema so I can ensure the XML my tool generates is accurate.

      noplanN 1 Reply Last reply Reply Quote 0
      • noplanN
        noplan @imthenachoman
        last edited by

        @imthenachoman

        What do u do after the xml is imported?
        Reboot? Or nothing?

        What's the standard procedure for your import?

        I 3 Replies Last reply Reply Quote 0
        • I
          imthenachoman @noplan
          last edited by

          @noplan Okay. So I was wrong.

          When I import my XML and then reboot, they do not work. I import the working backup copy and reboot and they do work.

          If I import and don't reboot, they keep working but I assume that's cause of some caching or something.

          1 Reply Last reply Reply Quote 0
          • I
            imthenachoman @noplan
            last edited by

            @noplan I just saw that there is an error after importing my XML:

            There were error(s) loading the rules: /tmp/rules.debug:177: syntax error - The line in question reads [177]: block return in log quick on $LAN inet proto any from !192.168.1.0/24 to any tracker 1609008158 label "USER_RULE: reject anything not from net"
            @ 2021-01-31 11:42:07
            

            And this is the rule for that tracker ID:

                <rule>
                        <type>reject</type>
                        <interface>lan</interface>
                        <ipprotocol>inet</ipprotocol>
                        <protocol>any</protocol>
                        <source>
                            <network>lan</network>
                            <not />
                        </source>
                        <destination>
                            <any />
                        </destination>
                        <log />
                        <descr><![CDATA[reject anything not from net]]></descr>
                        <tracker>1609008158</tracker>
                        <statetype><![CDATA[keep state]]></statetype>
                    </rule>
            

            Not sure what is wrong...

            1 Reply Last reply Reply Quote 0
            • I
              imthenachoman @noplan
              last edited by

              @noplan So I think I figured it out.

              Unlike the pfsense backup XML file, my code was not creating empty nodes.

              So I fixed that. I create empty nodes.

              Now it seems to be working.

              Thanks!

              noplanN 1 Reply Last reply Reply Quote 0
              • noplanN
                noplan @imthenachoman
                last edited by

                @imthenachoman

                Cool thing!
                Glad u were able to fix it
                BrNP

                T 1 Reply Last reply Reply Quote 0
                • T
                  timblaktu @noplan
                  last edited by

                  @imthenachoman did you ever find any official xml schema to base this work on?

                  Im working on a solution to fully automate the installation/configuration of virtualized pfsense routers, and today i learned that all i have to do is generate a custom config.xml and mount it on boot. So the remaining part for me is to figure out the proper format. All i can find so far is the default confix.xml file in the main pfsense code base. This is workable, but i was hoping to find official xml schema or other spec/tools that would aid in this automation.

                  Thanks!
                  Tim

                  P I 2 Replies Last reply Reply Quote 0
                  • P
                    Patch @timblaktu
                    last edited by Patch

                    @timblaktu said in Where can I find information on the backup/restore XML schema?:

                    So the remaining part for me is to figure out the proper format. All i can find so far is the default confix.xml file

                    I suggest in pfsense manually configuring several of your installations. Create a back up of each and look at the backup file format. That should clarify what you need for the general case.

                    Then use https://docs.netgate.com/pfsense/en/latest/backup/restore-during-install.html

                    T 1 Reply Last reply Reply Quote 0
                    • T
                      timblaktu @Patch
                      last edited by

                      @Patch thanks. My issue is less "what to configure?" and more the actual mechanics of correctly and automatically generating the xml representation. I can reverse engineer a solution from the latest default config.xml in the pfsense repo but this feels archaic in this day and age. I feel this has to be a solved problem..

                      P 1 Reply Last reply Reply Quote 0
                      • I
                        imthenachoman @timblaktu
                        last edited by

                        @timblaktu No. I never did. :(

                        1 Reply Last reply Reply Quote 0
                        • P
                          Patch @timblaktu
                          last edited by

                          @timblaktu said in Where can I find information on the backup/restore XML schema?:

                          I can reverse engineer a solution from the latest default config.xml in the pfsense repo

                          Why on earth start there.
                          Start by comparing backup configuration files for the range of installation you actually require.

                          T 1 Reply Last reply Reply Quote 0
                          • T
                            timblaktu @Patch
                            last edited by

                            @Patch I'll definitely be looking at example configs pulled from manually-configured pfsense installs, and refining what I need to include in the config.xml. The point of what I'm doing is to fully-automate the pfsense installation, like described here in the docs by providing the installer a config.xml file to apply. This config.xml will be different for different installations on different machines, so I must generate it programatically, which is why I'm asking about the xml schema and/or other config generation tools.

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