Massive DNS update, but from shell script

Discussion in 'General' started by cpasqualini, Sep 5, 2023.

  1. cpasqualini

    cpasqualini New Member

    Hi!

    I know there is an old thread, but one more question related to:
    I read on https://forum.howtoforge.com/threads/massive-dns-update-on-one-ispconfig-server.68251/ this

    Is there a way to execute this resync action from a script?
    There are a bunch of DNS records that I need to change to a fallback as soon as posible when a provider geas down, and prefer to prevent human action requirement.

    Thanks!
     
  2. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    There is, but in the older ISPConfig code. I had shared that resync command somewhere but I have to dig it out first.
     
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    Have you considered using ISPConfig remote API for that instead of editing the data in the database and resyncing? using the API would be the cleaner approach anyway.
     
    ahrasis likes this.
  4. cpasqualini

    cpasqualini New Member

    I thought that, indeed I use it for a kind of dynamic DNS for specific hosts, but as far as I can get it working, requires that every record to be full FQDN, like hostname.example.com. instead of only hostname inside example.com. zone.

    In that case, it will require me to modify hundreds of records to be expressed FQDN to be able to use de API, unless you can give mo some light on what I'm missing:

    PHP:
    $dnszone 'hostname.example.com.';
    $client = new SoapClient(null, array('location' => $soap_location,
                    
    'uri'      => $soap_uri,
                    
    'trace' => 1,
                    
    'exceptions' => 1));

    $zone $client->dns_zone_get($session_id, array('origin' => $dnszone));
    $dns_record $client->dns_a_get($session_id, array('name' => $domain));
    $dns_record[0]['data'] = $ip;
    $affected_rows $client->dns_a_update($session_id0$dns_record[0]['id'], $dns_record[0]);
    $newserial $zone[0]['serial']+1;
    $zone[0]['serial'] = $newserial;
    $client->dns_zone_update($session_id0$zone[0]['id'], $zone[0]);
    Is there any API documentation?
    Do we have a REST API now?

    Thanks
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    You can use the long and short syntax with ISPConfig as well as with the API.

    see remote_client folder in ISPConfig tar.gz file.

    You can call the API via SOAP and REST. But documentation is mostly about soap, but you might find some examples using the REST endpoint here in the forum or on the internet as well.
     
    ahrasis likes this.

Share This Page