Automated zonefile import

Discussion in 'General' started by pyte, Nov 25, 2022.

  1. pyte

    pyte Well-Known Member HowtoForge Supporter

    Hi,
    i need to import around 1500 zones into ISPConfig. Doing this manually through the webinterface is not a viable option. Is there a way to import zonefiles with the remoting client? I know of the dns_*_add functions but is there something for whole zonfiles?

    Or maybe someone with a script that can parse zonefiles, so i can add the zones and DNS entries with the remoting client?

    Any help or ideas are appriciated :)
     
  2. michelangelo

    michelangelo Active Member

    Look for the remoting client and sample scripts in ISPConfig's gitlab.
    That's how I did it in 2015 when I had to migrate our manually managed file-based Named zone files to ISPConfig database.
     
  3. pyte

    pyte Well-Known Member HowtoForge Supporter

    I know the API functions for DNS Entires/Zones, but there is no function to import a zonefile as a whole, right?
    Can you elaborate how to did it?
     
  4. michelangelo

    michelangelo Active Member

    If I recall correctly I wrote a bash wrapper script that looped through all Named zone files which passed the zone file as an argument to one of the ISPConfig dns import sample scripts.

    Sorry that I can't explain it more in detail. That's almost 8 years ago and I can't find the scripts anymore.
     
  5. pyte

    pyte Well-Known Member HowtoForge Supporter

    No worries :) But that script is exactly what i am looking for, the importing is clear to me, but the parsing through the zonefiles and extracting every record from a zone is a tiring task, especially when the zonefiles are edited by hand...
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    As far as I know, there is no API function for parsing zone files. What you might do is that you grab the zone file parsing code from the GUI zone file import function and use this to do API calls so you don't have to start from scratch. Or do some googling, maybe someone wrote such a script and published it somewhere.
     
    pyte likes this.
  7. pyte

    pyte Well-Known Member HowtoForge Supporter

    That seems like exactly what michelangelo did 8 years ago, he gave me his old script. I'll have a look into the current source and see if i can make use of it. Already tried my luck searching some scripts, but with no real luck :)

    If i'm able to make it work i'll update with the scripts in this thread
     
    ahrasis, Th0m and till like this.
  8. michelangelo

    michelangelo Active Member

    I think the script I gave you was the dns_import.php file that is used in ISPConfig if you want to import zone files via the ISPC UI.
    I just don't know if I adapted it or if I took it from somewhere else too. All of this happened simply too long ago.

    Anyway, good luck with it. ;)
     
  9. Th0m

    Th0m ISPConfig Developer Staff Member ISPConfig Developer

    If you figure it out, please share and we can add it to our git server. And if not, feel free to get in touch to see if I can be of service.
     

Share This Page