Installation


Upgrades


DTC-Xen Installation


DTC-Xen / Dom0 Howtos

DTC-Xen / DomU Howtos

FAQ


DTC Howtos


Manuals


Features


Roadmap


Devel docs


Wiki - i18n


Wiki - Meta


Scripting the panel

Even if the panel's UI is designed to be quick and easy to use, you might want - as a sys admin - to script it in order to get an even higer level of automation.

As everything is stored in a regular MySQL database, one may think importing information in the database is the easiest solution to control the system. But that might not be always relevant as the panel may perform additional tasks after inserting (or modifying) a row in the database.

An easy way script the panel is to re-create the url sent to the system, as all forms uses the GET method (which means that all parameters are easily readable in the URL)

In order to handle authentication, dtc is always adding two parameters to each URL :
- adm_login, which holds the login as regular, clear text
- adm_pass, which contains a password, which is a number, generated by the system, and varying from one query to the other.
When you log in, you put your real password in the authentication form (the first page), and then the system forwards a dynamically generated pass from one page to the other.

The trick is that you can replace the randomly generated adm_pass by your real password. Obviously, for security reason, you will only want to do that on your localhost or through an ssl connection.

This being said, you can easily reverse engineer any form to automate any action. For example, if you want to create a new email address, here are the parameters :

https://dtc.example.com/dtcadmin/index.php?
adm_login=*mylogin*
adm_pass=*mypass*
addrlink=*mydomain*%2Fmailboxs
edit_domain=$mydomain*
whatdoiedit=mails
newmail_login=*thenewaccountyouwanttocreate*
newmail_redirect1=
newmail_pass=*thepasswordyouwant*
newmail_redirect2=
newmail_deliver_localy=yes
newmail_spam_mailbox=SPAM
addnewmailtodomain=Ok

If everything go right, you'll see a full blown html page as an answer, otherwise, you'll see a text only error message.

To make it easier to reverse engineer the forms you might try using the tamper Firefox plugin - it's less error prone than going through the HTML form code and quicker:

https://addons.mozilla.org/extensions/moreinfo.php?application=firefox&category=Developer%20Tools&numpg=10&id=966

For adding new users automatically one only needs to support HTTP Challenge authentication and use your master dtc username/password. You need to remove adm_login and adm_password as this will cause an error when DTC tries to look it up as an Admin from the table.

There is an scripting panel to make scripting easier.
http://forums.gplhost.com/fudforum/mv/msg/1421/5929/#msg_5929

Editing this page means accepting its license.

Page last modified on June 20, 2012, at 05:39 PM EST