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 11th June 2010, 01:11
BorderAmigos BorderAmigos is offline
Senior Member
 
Join Date: Apr 2008
Location: San Diego & Tijuana
Posts: 302
Thanks: 26
Thanked 33 Times in 31 Posts
Send a message via MSN to BorderAmigos Send a message via Yahoo to BorderAmigos
Default Remote question...

I'm writing some PHP scripts to be used in Drupal pages as front ends to the SOAP remote functions. For my first testing and debugging I'm using the mail_user add, delete, and update functions. It seems to be working at this point and doing the proper changes in the database.

The question is that when I delete a mail user the /www/vmail/domain/user files do not get deleted. Is this the expected function and should I write the file deletion routine into my script?

Also just noticed that the quota value shown in the ISPConfig 3 interface does not match the value sent to the SOAP function.
__________________
System6Hosting.com, ISPConfig 3, Debian.

Last edited by BorderAmigos; 11th June 2010 at 15:25.
Reply With Quote
Sponsored Links
  #2  
Old 13th June 2010, 15:34
till till is online now
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 35,455
Thanks: 813
Thanked 5,222 Times in 4,092 Posts
Default

Quote:
The question is that when I delete a mail user the /www/vmail/domain/user files do not get deleted. Is this the expected function and should I write the file deletion routine into my script?
Thats all handled by ISPConfig. Do not write it in your script.

Quote:
Also just noticed that the quota value shown in the ISPConfig 3 interface does not match the value sent to the SOAP function.
Be aware that you have to send the quota in bytes when you use the API as the internal quota handling of courier is in bytes and not MB. 1 kb has 1024 bytes and 1 MB has 1024*1024 bytes when you calculyte the quota.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #3  
Old 13th June 2010, 16:12
BorderAmigos BorderAmigos is offline
Senior Member
 
Join Date: Apr 2008
Location: San Diego & Tijuana
Posts: 302
Thanks: 26
Thanked 33 Times in 31 Posts
Send a message via MSN to BorderAmigos Send a message via Yahoo to BorderAmigos
Default

Thanks Till. I added some mail users, sent and received emails to them, then deleted them. All seems to work as far as mail and database functions. But now, 3 days after deleting the users (and verifying they are deleted in the database), the files are still in /var/vmail so ISPConfig doesn't seem to be deleting them as it should. The directory owner appears to be set by ISPConfig 3 as vmail with permissions 700.

Here is the script:
Code:
<?php

// Configuration values
$username = 'admin';
$password = 'password';
$server_ip = '123.456.789.123.';
$server_port = '8080';
$db_user='root';
$db_password='password';
$db_host='localhost';
$db_name='dbispconfig';
$db_table='mail_user';

function get_mailuser_id($db_host, $db_user, $db_password,$db_name,$db_table,$soap_email) {
	$conn = mysql_connect($db_host, $db_user, $db_password) or die('Error connecting to mysql');
	$db_found=mysql_select_db($db_name);
	if ($db_found) {
		$SQL = "SELECT mailuser_id FROM $db_table WHERE email='$soap_email'";
		$dbread = mysql_fetch_row(mysql_query($SQL));
		$mailuser_id = $dbread[0];
	} else {
		$soap_result .= 'Database Not Found ';
	}
	mysql_close($conn);
	return $mailuser_id;
}

if (isset($_REQUEST['SOAP_FUNCTION'])) {

	$soap_location = 'http://'.$server_ip.':'.$server_port.'/remote/index.php';
	$soap_uri = 'http://'.$server_ip.':'.$server_port.'/remote/';
	$soap_result = 'Results: ';
	$soap_function = $_REQUEST['SOAP_FUNCTION'];
	$soap_user = $_REQUEST['SOAP_USER'];
	$soap_domain = $_REQUEST['SOAP_DOMAIN'];
	$soap_email = $soap_user.'@'.$soap_domain;
	$soap_password = $_REQUEST['SOAP_PASSWORD'];
	$soap_quota = $_REQUEST['SOAP_QUOTA'];
	$soap_maildir = '/var/vmail/'.$soap_domain.'/'.$soap_user;
	$client = new SoapClient(null, array('location' => $soap_location,'uri' => $soap_uri,'trace'=>1));

	//echo htmlentities($client->__getFunctions());

	try {

		if($session_id = $client->login($username,$password)) {
			$soap_result .= 'Logged In...&nbsp;Session:&nbsp;'.$session_id.'...&nbsp;';   // Zalogowany. Sesja:
		}

		switch ($soap_function){

			case 'Add':
				$params = array(
					'server_id' => 1,
					'email' => $soap_email,
					'password' => $soap_password,
					'quota' => $soap_quota,
					'maildir' => $soap_maildir,
					'homedir' => '/var/vmail',							
					'uid' => '5000',
					'gid' => '5000',
					'postfix' => 'y',
					'disableimap' => 'n',
					'disablepop3' => 'n'
				);
				$client_id = 0;
				$domain_id = $client->mail_user_add($session_id,$client_id,$params);
			break;

			case 'Update':
				$params = array(	
					'server_id' => 1,
					'email' => $soap_email,
					'password' => $soap_password,
					'quota' => $soap_quota,
					'maildir' => $soap_maildir,
					'homedir' => '/var/vmail',							
					'uid' => '5000',
					'gid' => '5000',
					'postfix' => 'y',
					'disableimap' => 'n',
					'disablepop3' => 'n'
				);
				$client_id = 0;
				$mailuser_id = get_mailuser_id($db_host, $db_user, $db_password,$db_name,$db_table,$soap_email);
				$domain__id = $client->mail_user_update($session_id, $client_id, $mailuser_id , $params);
			break;

			case 'Delete':
				$client_id = 0;				
				$mailuser_id = get_mailuser_id($db_host, $db_user, $db_password,$db_name,$db_table,$soap_email);
				$domain__id = $client->mail_user_delete($session_id,$mailuser_id);
				$soap_user = '';
				$soap_domain = '';
				$soap_password = '';
				$soap_quota = '';
			break;

		}

		if($client->logout($session_id)) {
			$soap_result .= 'Logged Out!<br /><br />';   // Wylogowany
		}

	} catch (SoapFault $soapFault) {
		echo "Request :<br><pre>", htmlentities($client->__getLastRequest()), "</pre><br>";
		echo "Response :<br><pre>", htmlentities($client->__getLastResponse()), "</pre><br>";
		die('SOAP Error: '.$e->getMessage());   // SOAP Blad
	}

	print $soap_result;

} else {
	print 'Please select function (Add, Update or Delete).<br><br>';
}

$output = '
	<form action="http://domain.com/this-page" method="post">
		<table><tr><td>
		<table>
		<tr><td>Username:</td><td><input type="text" name="SOAP_USER" value="'.$soap_user.'" /></td></tr>
		<tr><td>Domain:</td><td><input type="text" name="SOAP_DOMAIN" value="'.$soap_domain.'"  /></td></tr>
		<tr><td>Password:</td><td><input type="text" name="SOAP_PASSWORD" value="'.$soap_password.'"  /></td></tr>
		<tr><td>Quota:</td><td><input type="text" name="SOAP_QUOTA" value="'.$soap_quota.'"  /></td></tr>
		</table>
		</td><td>
		<input type="radio" name="SOAP_FUNCTION" value="Add"> Add<br>
		<input type="radio" name="SOAP_FUNCTION" value="Update"> Update<br>
		<input type="radio" name="SOAP_FUNCTION" value="Delete"> Delete<br>
		<input type="submit" value="Submit" />
		</td></tr></table>
	</form>';
print $output;
?>
__________________
System6Hosting.com, ISPConfig 3, Debian.

Last edited by BorderAmigos; 13th June 2010 at 16:32.
Reply With Quote
  #4  
Old 14th June 2010, 11:35
till till is online now
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 35,455
Thanks: 813
Thanked 5,222 Times in 4,092 Posts
Default

Which ISPConfig version do you use?

Quote:
The directory owner appears to be set by ISPConfig 3 as vmail with permissions 700.
Thats the correct setting.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #5  
Old 14th June 2010, 15:11
BorderAmigos BorderAmigos is offline
Senior Member
 
Join Date: Apr 2008
Location: San Diego & Tijuana
Posts: 302
Thanks: 26
Thanked 33 Times in 31 Posts
Send a message via MSN to BorderAmigos Send a message via Yahoo to BorderAmigos
Default

Version 3.0.2.1. Some permissions are set as root as well.

ls -la

total 52
drwx------ 10 vmail vmail 4096 2010-06-09 15:26 .
drwx------ 28 vmail vmail 4096 2010-06-14 06:09 ..
drwx------ 2 vmail vmail 4096 2010-06-09 15:26 courierimapkeywords
-rw-r--r-- 1 vmail vmail 48 2010-06-09 15:26 courierimapsubscribed
-rw-r--r-- 1 vmail vmail 15 2010-06-09 15:26 courierimapuiddb
drwx------ 2 vmail vmail 4096 2010-06-09 15:26 cur
drwx------ 5 vmail root 4096 2010-06-09 15:26 .Drafts
drwx------ 5 vmail root 4096 2010-06-09 15:26 .Junk
drwx------ 2 vmail vmail 4096 2010-06-09 15:26 new
drwx------ 5 vmail root 4096 2010-06-09 15:26 .Sent
-rw-r--r-- 1 vmail vmail 24 2010-06-09 15:26 subscriptions
drwx------ 2 vmail vmail 4096 2010-06-09 15:26 tmp
drwx------ 6 vmail root 4096 2010-06-09 15:26 .Trash
__________________
System6Hosting.com, ISPConfig 3, Debian.
Reply With Quote
  #6  
Old 15th June 2010, 18:27
BorderAmigos BorderAmigos is offline
Senior Member
 
Join Date: Apr 2008
Location: San Diego & Tijuana
Posts: 302
Thanks: 26
Thanked 33 Times in 31 Posts
Send a message via MSN to BorderAmigos Send a message via Yahoo to BorderAmigos
Default

There appear to be pending actions related to inserting and deleting the mail_user in the sys_datalog table but they stay there for days. There are 5 pages of pending actions there (mail_user, content_filter, dns_rr, etc), is that normal?
__________________
System6Hosting.com, ISPConfig 3, Debian.
Reply With Quote
  #7  
Old 15th June 2010, 19:17
till till is online now
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 35,455
Thanks: 813
Thanked 5,222 Times in 4,092 Posts
Default

You can see if a action is pending or not only in the ispconfig monitor > jobqueue. You can not see this in the datalog, as the dalaog does not track the status of a action and it contains alwysa all actions from the last 30 days.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #8  
Old 15th June 2010, 19:35
BorderAmigos BorderAmigos is offline
Senior Member
 
Join Date: Apr 2008
Location: San Diego & Tijuana
Posts: 302
Thanks: 26
Thanked 33 Times in 31 Posts
Send a message via MSN to BorderAmigos Send a message via Yahoo to BorderAmigos
Default

Ok, thanks. ispconfig monitor > jobqueue is empty. sys_datalog contains data for the last 4 months (from the day I first installed ISPConfig 3).

Still the /var/vmail files and directories are not being deleted when the user is.
__________________
System6Hosting.com, ISPConfig 3, Debian.
Reply With Quote
  #9  
Old 15th June 2010, 19:38
till till is online now
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 35,455
Thanks: 813
Thanked 5,222 Times in 4,092 Posts
Default

Then I recommend that you post a request in the bugtracker so that the developers can review it (if you run the latest released ISPConfig version), otherwise update your system.

Quote:
sys_datalog contains data for the last 4 months (from the day I first installed ISPConfig 3).
Then you dont seem to use the latest ispconfig version (3.0.2.1 or 3.0.2.2 beta) as this has beens olved some time ago.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #10  
Old 15th June 2010, 19:41
BorderAmigos BorderAmigos is offline
Senior Member
 
Join Date: Apr 2008
Location: San Diego & Tijuana
Posts: 302
Thanks: 26
Thanked 33 Times in 31 Posts
Send a message via MSN to BorderAmigos Send a message via Yahoo to BorderAmigos
 
Default

"Then you dont seem to use the latest ispconfig version (3.0.2.1 or 3.0.2.2 beta) as this has been solved some time ago."

From ispconfig > help > version

ISPConfig Version: 3.0.2.1
__________________
System6Hosting.com, ISPConfig 3, Debian.
Reply With Quote
Reply

Bookmarks

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
Remote Framework - Client Add - Ispconfig 3 Germanius General 5 23rd December 2009 18:16
remote framework - is it customer or admin side? alipanick Developers' Forum 2 8th October 2009 20:35
Newb: Result of nessus scan Slowhand Installation/Configuration 12 4th June 2009 15:31
Configure VNC from remote CLI SoMBS Technical 1 16th September 2007 15:38
Support Ticket and MySQL Remote Access Question lewis_saint Installation/Configuration 3 20th May 2007 23:56


All times are GMT +2. The time now is 18:25.


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