2014-03-05 50 views
1

我正在尝试使用cpanel api2修改其中一个cpanel帐户的区域文件。以下是我正在执行的代码。Cpanel api2 Zoneedit错误

$xmlapi = new xmlapi($ip); 
$xmlapi->set_host("192.168.1.1"); 
$xmlapi->set_port("2087"); 
$xmlapi->set_protocol('https'); 
$xmlapi->password_auth($cpusername,$cpuserpwd); 
$xmlapi->hash_auth("root",$root_hash); 
#print_r ($xmlapi); 
$xmlapi->set_output("json"); 
$xmlapi->set_debug(1); 
$xmlapi->api2_query($cpaccount, "ZoneEdit", "add_zone_record" , array($domain, $subdomain, $type, $ipaddr, $ttl)); 

评论代码使用系统散列进行验证。另一个使用密码认证。两种身份验证方法都会出现相同的错误。

当我设置的用户ID和帐户根,我得到一个内部500错误:

Internal Server Error 500

Could not setuid to root at /usr/local/cpanel/Whostmgr/XMLUI/cPanel.pm line 82.

如果我更改用户标识和区域文件是该帐户,我得到的消息:

{ 
    "cpanelresult":{ 
    "apiversion":2, 
    "func":"add_zone_record", 
    "data":[{ 
     "result":{ 
     "status":0, 
     "statusmsg":"You do not have permission to read the zone for : " 
     } 
    }], 
    "event":{ 
     "result":1 
    }, 
    "module":"ZoneEdit" 
    } 
} 

我很难下一步做什么。当我在命令行中作为非root帐户之一登录时,只要输入root密码就可以启动root。

任何援助将不胜感激。

回答

0

关闭此功能。在站点没有解决方案的情况下,最终编写了一个php脚本,通过适当的SOA序列号管理从头开始生成区域文件,并安排一个cron作业以root身份运行以替换区域文件并重新加载它。

换句话说,从来没有Cpanel接口工作,所以从头开始编写它。

如果有人对最终的广义实现感到好奇,那就是我的网站上的smartDNS功能,并在博客中进行了描述。