• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
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.7k 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
    last edited by Jan 30, 2021, 11:51 PM

    I am working on a tool (https://github.com/imthenachoman/pfSense-Firewall-Rules-Manager) to work with pfSense's FW XML backup.

    I'm having trouble with getting pfSense to import an XML file I create. It imports properly but the rules don't seem active. I'm not sure why because the XML I create seems to have everything it needs/expect.

    Hoping someone can point me to the XML schema so I can maybe figure out what I am doing wrong.

    N 1 Reply Last reply Jan 31, 2021, 4:34 AM Reply Quote 0
    • N
      noplan @imthenachoman
      last edited by Jan 31, 2021, 4:34 AM

      @imthenachoman

      What r u doin after u changed the xml?

      When I changed xml I go to the rules move a separator an save and apply and works
      Keeps me avoiding a reboot

      I 1 Reply Last reply Jan 31, 2021, 4:36 AM Reply Quote 0
      • I
        imthenachoman @noplan
        last edited by Jan 31, 2021, 4:36 AM

        @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.

        N 1 Reply Last reply Jan 31, 2021, 6:59 AM Reply Quote 0
        • N
          noplan @imthenachoman
          last edited by Jan 31, 2021, 6:59 AM

          @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 Jan 31, 2021, 4:48 PM Reply Quote 0
          • I
            imthenachoman @noplan
            last edited by Jan 31, 2021, 4:48 PM

            @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 Jan 31, 2021, 4:52 PM

              @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 Feb 4, 2021, 3:56 AM

                @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!

                N 1 Reply Last reply Feb 4, 2021, 6:02 AM Reply Quote 0
                • N
                  noplan @imthenachoman
                  last edited by Feb 4, 2021, 6:02 AM

                  @imthenachoman

                  Cool thing!
                  Glad u were able to fix it
                  BrNP

                  T 1 Reply Last reply Aug 30, 2023, 1:53 AM Reply Quote 0
                  • T
                    timblaktu @noplan
                    last edited by Aug 30, 2023, 1:53 AM

                    @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 Aug 30, 2023, 2:42 AM Reply Quote 0
                    • P
                      Patch @timblaktu
                      last edited by Patch Aug 30, 2023, 3:00 AM Aug 30, 2023, 2:42 AM

                      @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 Aug 30, 2023, 3:28 AM Reply Quote 0
                      • T
                        timblaktu @Patch
                        last edited by Aug 30, 2023, 3:28 AM

                        @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 Aug 30, 2023, 10:44 PM Reply Quote 0
                        • I
                          imthenachoman @timblaktu
                          last edited by Aug 30, 2023, 5:30 PM

                          @timblaktu No. I never did. :(

                          1 Reply Last reply Reply Quote 0
                          • P
                            Patch @timblaktu
                            last edited by Aug 30, 2023, 10:44 PM

                            @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 Aug 31, 2023, 11:42 PM Reply Quote 0
                            • T
                              timblaktu @Patch
                              last edited by Aug 31, 2023, 11:42 PM

                              @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.
                                This community forum collects and processes your personal information.
                                consent.not_received