Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > Developers' Forum

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 27th September 2012, 21:21
Disassembler Disassembler is offline
Junior Member
 
Join Date: Jul 2012
Posts: 19
Thanks: 2
Thanked 7 Times in 5 Posts
Default SOAP API problems in 3.0.4.6

I have a sizeable Plesk installation to migrate to ISPconfig. Being the type who rather than doing a couple hours of mindless clicking would spend three times that writing code, I set out to write a generic converter that might even benefit others in the same situation. But I'm having problems with the SOAP API, particularly the domains_domain_add function. It always gives me a "permission denied" error even though my API user has every single checkmark for permissions set. I'm not sure whether the problem occurs with other functions too so far as I've only done the bits for clients and domains so far; clients work fine though.

The problem occurs with both my Perl program and the PHP example by the way. So far I've simply hacked checkPerm() to always return true to be able to go on with development ...

I'm on a remote island in the Galapagos with rather intermittent internet at the moment, so please excuse any delays in getting back to this thread (and my inability to do any serious debugging on this ISPconfig install running in VirtualBox on my little netbook ). Just checked out the SVN version to see if it makes a difference though.
Reply With Quote
Sponsored Links
  #2  
Old 28th September 2012, 08:35
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 34,586
Thanks: 792
Thanked 4,983 Times in 3,903 Posts
Default

Please check that the permission "sites_web_domain_add" is listed in the remote_functions field of the remote user in the remote_user table in the ispconfig mysql database.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #3  
Old 29th September 2012, 01:24
Disassembler Disassembler is offline
Junior Member
 
Join Date: Jul 2012
Posts: 19
Thanks: 2
Thanked 7 Times in 5 Posts
Default

Hi Till,

thanks for the hint, but yes, it's set. Here's the only record defined:

root@dennis:~# ssh 192.168.56.101 "mysql -uroot -p123456 -Ddbispconfig -e \"select * from remote_user\\\\G\""
root@192.168.56.101's password:
*************************** 1. row ***************************
remote_userid: 1
sys_userid: 1
sys_groupid: 1
sys_perm_user: riud
sys_perm_group: riud
sys_perm_other:
remote_username: apiuser
remote_password: e10adc3949ba59abbe56e057f20f883e
remote_functions: server_get,get_function_list,client_templates_get_ all,server_get_serverid_by_ip,server_ip_add,server _ip_update,server_ip_delete;client_get,client_add, client_update,client_delete,client_get_sites_by_us er,client_get_by_username,client_change_password,c lient_get_id,client_delete_everything;mail_domain_ get,mail_domain_add,mail_domain_update,mail_domain _delete,mail_domain_set_status,mail_domain_get_by_ domain;mail_mailinglist_get,mail_mailinglist_add,m ail_mailinglist_update,mail_mailinglist_delete;mai l_user_get,mail_user_add,mail_user_update,mail_use r_delete;mail_alias_get,mail_alias_add,mail_alias_ update,mail_alias_delete;mail_forward_get,mail_for ward_add,mail_forward_update,mail_forward_delete;m ail_catchall_get,mail_catchall_add,mail_catchall_u pdate,mail_catchall_delete;mail_transport_get,mail _transport_add,mail_transport_update,mail_transpor t_delete;mail_whitelist_get,mail_whitelist_add,mai l_whitelist_update,mail_whitelist_delete;mail_blac klist_get,mail_blacklist_add,mail_blacklist_update ,mail_blacklist_delete;mail_spamfilter_user_get,ma il_spamfilter_user_add,mail_spamfilter_user_update ,mail_spamfilter_user_delete;mail_policy_get,mail_ policy_add,mail_policy_update,mail_policy_delete;m ail_fetchmail_get,mail_fetchmail_add,mail_fetchmai l_update,mail_fetchmail_delete;mail_spamfilter_whi telist_get,mail_spamfilter_whitelist_add,mail_spam filter_whitelist_update,mail_spamfilter_whitelist_ delete;mail_spamfilter_blacklist_get,mail_spamfilt er_blacklist_add,mail_spamfilter_blacklist_update, mail_spamfilter_blacklist_delete;mail_user_filter_ get,mail_user_filter_add,mail_user_filter_update,m ail_user_filter_delete;mail_filter_get,mail_filter _add,mail_filter_update,mail_filter_delete;sites_c ron_get,sites_cron_add,sites_cron_update,sites_cro n_delete;sites_database_get,sites_database_add,sit es_database_update,sites_database_delete, sites_database_get_all_by_user;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_dele te;sites_web_domain_get,sites_web_domain_add,sites _web_domain_update,sites_web_domain_delete,sites_w eb_domain_set_status;sites_web_aliasdomain_get,sit es_web_aliasdomain_add,sites_web_aliasdomain_updat e,sites_web_aliasdomain_delete;sites_web_subdomain _get,sites_web_subdomain_add,sites_web_subdomain_u pdate,sites_web_subdomain_delete;dns_zone_get,dns_ zone_add,dns_zone_update,dns_zone_delete,dns_zone_ set_status,dns_templatezone_add;dns_a_get,dns_a_ad d,dns_a_update,dns_a_delete;dns_aaaa_get,dns_aaaa_ add,dns_aaaa_update,dns_aaaa_delete;dns_alias_get, dns_alias_add,dns_alias_update,dns_alias_delete;dn s_cname_get,dns_cname_add,dns_cname_update,dns_cna me_delete;dns_hinfo_get,dns_hinfo_add,dns_hinfo_up date,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,dn s_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;vm_openvz

Hm, I noticed there are some records separated by commas and others by semicolons. That all right?
Reply With Quote
  #4  
Old 29th September 2012, 19:00
Disassembler Disassembler is offline
Junior Member
 
Join Date: Jul 2012
Posts: 19
Thanks: 2
Thanked 7 Times in 5 Posts
Default

By the way (sorry for bombarding you with questions, gotta get this out as long as teh interwebs are working here), I got a little confused with the API after a while because there's little documentation in terms of semantics. Here's what I didn't find anything on:

- My tool uses domains_domain_add() so far to add client's domains. But I don't find them associated with clients anywhere in the GUI, plus there are extra functions mail_domain_add() and sites_web_domain_add(). So what's the difference there, and do I have to use domains_domain_add() at all?

- The client_add() function takes a reseller_id parameter and adding a reseller is a separate form in the GUI, but I don't see how I can add a reseller via the API or indicate that some client is a reseller.

- There's also a parent_client_id column that I would assume does something similar to the reseller ID, but certainly there's a difference?
Reply With Quote
  #5  
Old 1st October 2012, 19:18
Croydon Croydon is offline
ISPConfig Developer
 
Join Date: Jul 2007
Location: Koblenz, Germany
Posts: 756
Thanks: 15
Thanked 215 Times in 166 Posts
Default

Quote:
Originally Posted by Disassembler View Post
- My tool uses domains_domain_add() so far to add client's domains. But I don't find them associated with clients anywhere in the GUI, plus there are extra functions mail_domain_add() and sites_web_domain_add(). So what's the difference there, and do I have to use domains_domain_add() at all?
domains_domain_add() adds a domain for the client to the domain module (that can be enabled to limit clients to use only their assigned domains).

sites_domain_add() adds a website

mail_domain_add() adds a mail domain for creating mailboxes with this domain later on
__________________
Marius Cramer

pixcept KG
Reply With Quote
  #6  
Old 13th October 2012, 10:18
Disassembler Disassembler is offline
Junior Member
 
Join Date: Jul 2012
Posts: 19
Thanks: 2
Thanked 7 Times in 5 Posts
Default

Thanks Marius, that lifted some of the fog already!
Would there happen to be some example or production code that uses the API that I can look at? Because now I'm having some problems figuring out the parameters and particularly their allowed values. E.g. sites_web_domain_add() gives me an "hd_quota_error_empty" error when hd_quota is definitely present but '0' in the SOAP request.

Other than that, the converter is coming along nicely. Still very unpolished but doing its job. Gonna test it on some real installation and then release it in the coming weeks.
Reply With Quote
  #7  
Old 13th October 2012, 15:13
Croydon Croydon is offline
ISPConfig Developer
 
Join Date: Jul 2007
Location: Koblenz, Germany
Posts: 756
Thanks: 15
Thanked 215 Times in 166 Posts
Default

Sure, there are some examples included in the ispconfig download.
They're in the folder remoting_client/examples/
__________________
Marius Cramer

pixcept KG
Reply With Quote
  #8  
Old 15th October 2012, 20:35
Disassembler Disassembler is offline
Junior Member
 
Join Date: Jul 2012
Posts: 19
Thanks: 2
Thanked 7 Times in 5 Posts
Default

Sure, I know about these ... it's just, they don't really do much. E.g. the client_add script has this "$random_rs_id" parameter that gets passed in as a reseller ID; it's somewhat like in XKCD What it doesn't tell me is what I actually need to know: What does that parameter mean? How do I obtain it? Do I pass the ID of an existing client that will thereby automatically be promoted to "reseller", namely of this newly created client, or is this some new ID that will become the reseller ID of the new client? What parameters are obligatory anyway? Apparently you can hand create_client() a parameter called "dafault_mailserver" without causing too much havoc. But then the underlying database is all MYISAM without any referential integrity, so I suppose you can enter quite some bullshit (as long as it passes ISPconfig's validation rules, but I don't think they'll catch nonexistent IDs, do they?) without causing any immediate errors---only later when other scripts expect data to be consistent will your system crash and burn.
I'd just like to understand what I'm doing before I do it to my production system.
Reply With Quote
  #9  
Old 16th October 2012, 08:20
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 34,586
Thanks: 792
Thanked 4,983 Times in 3,903 Posts
Default

The reseller_id is the id of a existing reseller were this client shall be assigned to.

Quote:
Apparently you can hand create_client() a parameter called "dafault_mailserver" without causing too much havoc.
Yes, because all unkown parameters get discarded automatically.

Quote:
What parameters are obligatory anyway?
All Parameters have to be passed to the function. See database table layout for the full list.

Quote:
But then the underlying database is all MYISAM without any referential integrity, so I suppose you can enter quite some bullshit (as long as it passes ISPconfig's validation rules, but I don't think they'll catch nonexistent IDs, do they?) without causing any immediate errors---only later when other scripts expect data to be consistent will your system crash and burn.
The remote api is designed as low level api, it is made to allow the developer to pass any parameters to the functions that have a valid type to allow usage scenarios that are not available in the interface. So the you as a developer have to ensure that the parameters that you pass to the function are logically correct.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #10  
Old 25th November 2012, 09:14
Disassembler Disassembler is offline
Junior Member
 
Join Date: Jul 2012
Posts: 19
Thanks: 2
Thanked 7 Times in 5 Posts
 
Default

Hi guys,

thanks for your help so far, work's getting along pretty well. I have a first version on GitHub that migrates clients, domains, mailboxes/forwards and websites. For certain sites (currently that's only Drupal) it can also migrate databases, but I'm still going to generalize that.

Last edited by Disassembler; 25th November 2012 at 18:45.
Reply With Quote
The Following 2 Users Say Thank You to Disassembler For This Useful Post:
falko (25th November 2012), till (25th November 2012)
Reply

Bookmarks

Tags
bug, soap

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ISPConfig 3 Remote api - SOAP error kassyo General 9 27th November 2013 13:05
SOAP problem with ISPConfig API xaver Programming/Scripts 4 5th January 2012 12:27
Soap API and Welcome email adminnc General 1 26th January 2011 08:27
Management/system config/settings & /server/settings not working!! dactor Installation/Configuration 9 6th February 2008 09:11
Empty Recycle Bin jon335 General 40 6th May 2006 11:56


All times are GMT +2. The time now is 20:00.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.