Knowledge Base

Bitte , um Beiträge und Themen zu erstellen.

XML Objects with notepad++ for mass import FQDN

https://community.sophos.com/sophos-xg-firewall/f/recommended-reads/122450/creating-xml-objects-with-notepad-for-mass-import

Using a ZIP tool (for example 7zip), we can decompress this file and get an entities.xml file.

Open this .xml file with your Notepad++ and you will get the correct syntax, which we need to import this file with new data.

I'll now delete every entry except one to get the syntax correct.

Let's take a look at our "raw" data, which we want to import.

I have prepared a list of 4 domains but this could actually be as big as you like.

Pressing STRG+F in notepad++ will open the search / replace mode.

This is another useful guide on how to do that: https://www.launch2success.com/guide/advanced-find-and-replace-in-notepad/

I will now do the quick mode for you.

As your syntax dictates, an FQDN host needs to look like this:

<FQDNHost transactionid="">
<Name>*.staticforce.com</Name>
<FQDN>*.staticforce.com</FQDN>
</FQDNHost>

In Notepad++, we can actually select each entry and replace it with something else. The cool part about Notepad++ is, it can replace the entry and put the original content into the replaced content.

(German Screenshot):

It's important to select the regular expression.

You will look for: ^(.+)$      <--- This will actually find each entry in each row.

And we are going to replace it with:

<FQDNHost transactionid="">
<Name>(\1)</Name>
<FQDN>(\1)</FQDN>
</FQDNHost>

It is the same syntax as above. But each entry has a (\1).

Putting this into place, let's replace each entry in our test:

      

This code will now be placed into the Entities.xml, which we had earlier.

Quickly save this file and place it back to the original API.tar File. (I am using 7zip for this).

Replace the current Entities.xml. You should notice, the change date should be the current time frame.

 

Back to the XG web admin. Now use this API.tar, which we updated and "import" this file.

The import can take some time, depending on the size of your API File.

After the import, let's quickly verify that everything is correct: