creating secondary zone with remote cli

Discussion in 'General' started by maumar, Aug 4, 2012.

  1. maumar

    maumar Member

    I would that secondary (or slave) zones are created automatically when primary (or master) zones are created.
    I think that using remote client api would be better, more portable when ispconf upgrades.
    is not there any api, yet, am i wrong?
    in the examples i see only dns_zone_* with primary zone, it seems
    thnx
     
    Last edited: Aug 4, 2012
  2. todx

    todx Member

    I think this is a good reference:
    http://www.howtoforge.com/how-to-create-remote-api-scripts-for-ispconfig-3

    From what I've been told, the ISPConfig Remote API can use any and all functions that ISPConfig uses. For instance if you can set DNS Slave Zone in ISPConfig Control Panel than you can use this feature also in Remote API. (like I said...from what I've been told) =)
     
  3. maumar

    maumar Member

    here is the complete list of remoting funcions:

    Code:
    grep "public function"  /usr/local/ispconfig/interface/lib/classes/remoting.inc.php| cut -d '(' -f 1| cut -d ' ' -f 3
    
    login
    logout
    
    server_get_serverid_by_ip
    server_ip_add
    server_ip_update
    server_ip_delete
    mail_domain_get
    mail_domain_add
    mail_domain_update
    mail_domain_delete
    mail_mailinglist_get
    mail_mailinglist_add
    mail_mailinglist_update
    mail_mailinglist_delete
    mail_user_get
    mail_user_add
    mail_user_update
    mail_user_delete
    mail_user_filter_get
    mail_user_filter_add
    mail_user_filter_update
    mail_user_filter_delete
    mail_alias_get
    mail_alias_add
    mail_alias_update
    mail_alias_delete
    mail_forward_get
    mail_forward_add
    mail_forward_update
    mail_forward_delete
    mail_catchall_get
    function
    mail_catchall_update
    mail_catchall_delete
    mail_transport_get
    mail_transport_add
    mail_transport_update
    mail_transport_delete
    mail_spamfilter_whitelist_get
    mail_spamfilter_whitelist_add
    mail_spamfilter_whitelist_update
    mail_spamfilter_whitelist_delete
    mail_spamfilter_blacklist_get
    mail_spamfilter_blacklist_add
    mail_spamfilter_blacklist_update
    mail_spamfilter_blacklist_delete
    mail_spamfilter_user_get
    mail_spamfilter_user_add
    mail_spamfilter_user_update
    mail_spamfilter_user_delete
    mail_policy_get
    mail_policy_add
    mail_policy_update
    mail_policy_delete
    mail_fetchmail_get
    mail_fetchmail_add
    mail_fetchmail_update
    mail_fetchmail_delete
    mail_whitelist_get
    mail_whitelist_add
    mail_whitelist_update
    mail_whitelist_delete
    mail_blacklist_get
    mail_blacklist_add
    mail_blacklist_update
    mail_blacklist_delete
    mail_filter_get
    mail_filter_add
    mail_filter_update
    mail_filter_delete
    client_get
    client_get_id
    client_get_groupid
    client_add
    client_update
    client_delete
    client_delete_everything
    sites_cron_get
    sites_cron_add
    sites_cron_update
    sites_cron_delete
    sites_database_get
    sites_database_add
    sites_database_update
    sites_database_delete
    sites_ftp_user_get
    sites_ftp_user_add
    sites_ftp_user_update
    sites_ftp_user_delete
    sites_shell_user_get
    sites_shell_user_add
    sites_shell_user_update
    sites_shell_user_delete
    sites_web_domain_get
    sites_web_domain_add
    sites_web_domain_update
    sites_web_domain_delete
    sites_web_aliasdomain_get
    sites_web_aliasdomain_add
    sites_web_aliasdomain_update
    sites_web_aliasdomain_delete
    sites_web_subdomain_get
    sites_web_subdomain_add
    sites_web_subdomain_update
    sites_web_subdomain_delete
    domains_domain_get
    domains_domain_add
    domains_domain_delete
    domains_get_all_by_user
    dns_templatezone_add
    dns_zone_get
    dns_zone_add
    dns_zone_update
    dns_zone_delete
    dns_aaaa_get
    dns_aaaa_add
    dns_aaaa_update
    dns_aaaa_delete
    dns_a_get
    dns_a_add
    dns_a_update
    dns_a_delete
    dns_alias_get
    dns_alias_add
    dns_alias_update
    dns_alias_delete
    dns_cname_get
    dns_cname_add
    dns_cname_update
    dns_cname_delete
    dns_hinfo_get
    dns_hinfo_add
    dns_hinfo_update
    dns_hinfo_delete
    dns_mx_get
    dns_mx_add
    dns_mx_update
    dns_mx_delete
    dns_ns_get
    dns_ns_add
    dns_ns_update
    dns_ns_delete
    dns_ptr_get
    dns_ptr_add
    dns_ptr_update
    dns_ptr_delete
    dns_rp_get
    dns_rp_add
    dns_rp_update
    dns_rp_delete
    dns_srv_get
    dns_srv_add
    dns_srv_update
    dns_srv_delete
    dns_txt_get
    dns_txt_add
    dns_txt_update
    dns_txt_delete
    client_get_sites_by_user
    
    client_get_by_username
    
    mail_domain_get_by_domain
    
    sites_database_get_all_by_user
    client_templates_get_all
    
    dns_rr_get_all_by_zone
    
    
    openvz_ostemplate_get
    openvz_ostemplate_add
    openvz_ostemplate_update
    openvz_ostemplate_delete
    openvz_template_get
    openvz_template_add
    openvz_template_update
    openvz_template_delete
    openvz_ip_get
    openvz_get_free_ip
    openvz_ip_add
    openvz_ip_update
    openvz_ip_delete
    openvz_vm_get
    openvz_vm_get_by_client
    openvz_vm_add
    openvz_vm_add_from_template
    openvz_vm_update
    openvz_vm_delete
    openvz_vm_start
    openvz_vm_stop
    openvz_vm_restart
    
    i can't see anyhing related to slave, but maybe it is enough to insert a zone using secondary server id as server_id
    i will try
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    There is no function to add a secondary dns record available yet, we will add it in 3.0.5. Dont use the primary function as this will create a domain conflict.

    If you use the ispconfig dns mirroring functions as described in the multiserver tutorials, then you dont have to add a slave recird at all as ispconfig takes care for mirroring the record to the dns slave automatically.
     
  5. maumar

    maumar Member

    hello till

    something like this, i suppose

    Code:
           public function dns_slave_add($session_id, $client_id, $params)
        {
                    if(!$this->checkPerm($session_id, 'dns_slave_add')) {
                            $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
                            return false;
                    }
                    return $this->insertQuery('../dns/form/dns_slave.tform.php',$client_id,$params);
            }
    
    it is too much simple, I am missing something , otherwise ...it was already in place, not in the next release :)
     
  6. maumar

    maumar Member

    i am using it at this moment and it seems working well, but i suppose it is just into
    3.0.5 beta, with the proper acl of the function, i am using dns_zone_add, to be quick and unsafe
     
    Last edited: Aug 11, 2012
  7. maumar

    maumar Member

    thsi one:
    Code:
    
            //* Add a record slave
            public function dns_slave_add($session_id, $client_id, $params)
            {
                    if(!$this->checkPerm($session_id, 'dns_zone_add')) {
                            $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
                            return false;
                    }
                    return $this->insertQuery('../dns/form/dns_slave.tform.php',$client_id,$params);
            }
    
    
     
  8. maumar

    maumar Member

    i did it for deleting slave zone:
    Code:
            //* Delete a record slave
            public function dns_slave_delete($session_id, $primary_id)
            {
                    if(!$this->checkPerm($session_id, 'dns_zone_add')) {
                            $this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
                            return false;
                    }
                    return $this->deleteQuery('../dns/form/dns_slave.tform.php',$primary_id);
            }
    
    
    
    
     
  9. maumar

    maumar Member

    OT: polish comments

    we have polish comments, too :)
    Code:
    //* przeniesienia e-mail
            public function mail_transport_add($session_id, $client_id, $params)
    
     
  10. mcules

    mcules New Member

    Thanks for the dns_slave_add function, that was exactly what i was looking for :)

    Anybody knows if the function will be added in the next version?
     
  11. maumar

    maumar Member

    As far as I can see, it is still missing in 3.0.5, but don't worry, it is a bunch of lines of code and I have added them into (my local version) 3.0.5 (that ones I coded into 3.0.4.6)
     

Share This Page