HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Developers' Forum (http://www.howtoforge.com/forums/forumdisplay.php?f=33)
-   -   IspConfig API: FTP & Email not accessible (http://www.howtoforge.com/forums/showthread.php?t=55240)

vaio1 5th December 2011 10:12

IspConfig API: FTP & Email not accessible
 
Hi guys,

I am using your API to connect my software to your IspConfig these are my steps:

1. Create a client (client_add)
2. Create the website (sites_web_domain_add)
3. Create the FTP account (sites_ftp_user_add)
4. Create the Email Account (mail_user_add)
5. Create the Database (sites_database_add)

All the elements are visible in the IspConfig panel but the FTP and the Email doesn't work. :confused:

I mean that If I try to log with roundcube for the email account and/or browse by the Filezilla the ftp profile created It doesn't connect.

These are the parameters log from my software to your software:

Code:

05-12-2011 09:48:32 - ID 1 - Shineisp_Api_Panels_Ispconfig_Main::create_client - Paramenters: {"company_name":"My User","contact_name":"John Doe","customer_no":"212","vat_id":"IT1231231231","email":"info@johndoe.com","street":"via Roma 31","zip":"20111","city":"Milan","state":"TS","country":"IT","mobile":[],"fax":[],"telephone":"+39.0400644524","language":"it","usertheme":"default","template_master":0,"template_additional":"","created_at":0,"limit_web_quota":"3000","limit_mailbox":"10","limit_database":"3","limit_traffic_quota":"12000","limit_ftp_user":"3","limit_web_domain":"5","limit_mailaliasdomain":"1","limit_maildomain":"10","limit_mailcatchall":"3","limit_mailforward":"10","limit_mailrouting":"10","limit_fetchmail":"3","limit_mailfilter":"10","limit_mailquota":"1000","limit_spamfilter_wblist":"-1","limit_web_aliasdomain":"10","limit_cron_frequency":"15","limit_cron_type":"url","limit_web_subdomain":"15","limit_spamfilter_policy":"-1","ssh_chroot":"no,jailkit","limit_spamfilter_user":"-1","limit_webdav_user":"0","limit_cron":"7","limit_shell_user":"0","web_php_options":"no,fast-cgi","username":"johndoe","password":"furerufe"}
05-12-2011 09:48:33 - ID 1 - Shineisp_Api_Panels_Ispconfig_Main::create_website - Paramenters: {"server_id":"1","ip_address":"","domain":"johndoe.com","type":"vhost","parent_domain_id":0,"vhost_type":"name","hd_quota":"3000","traffic_quota":"12000","errordocs":1,"is_subdomainwww":1,"subdomain":"www","php":"fast-cgi","active":"y","traffic_quota_lock":"n","system_user":"web1","allow_override":"All","custom_php_ini":"","apache_directives":""}
05-12-2011 09:48:34 - ID 1 - Shineisp_Api_Panels_Ispconfig_Main::create_ftp - Paramenters: {"server_id":1,"parent_domain_id":3790,"username":"xewewajo","password":"wudoteyo","quota_size":"3000","active":"y","uid":"5000","gid":"5000","dir":"maybe","quota_files":-1,"ul_ratio":-1,"dl_ratio":-1,"ul_bandwidth":-1,"dl_bandwidth":-1}
05-12-2011 09:48:43 - ID 1 - Shineisp_Api_Panels_Ispconfig_Main::create_mail - Paramenters: {"server_id":"3","email":"info@johndoe.com","login":"admin@johndoe.com","password":"dedubati","uid":5000,"gid":5000,"maildir":"","quota":1048576000,"cc":"","homedir":"","autoresponder":"n","autoresponder_start_date":"","autoresponder_end_date":"","autoresponder_text":"","move_junk":"n","custom_mailfilter":"spam","postfix":"y","access":"n","disableimap":"n","disablepop3":"n","disabledeliver":"n","disablesmtp":"n"}
05-12-2011 09:48:47 - ID 1 - Shineisp_Api_Panels_Ispconfig_Main::create_database - Paramenters: {"server_id":"2","type":"y","database_name":"db_o","database_user":"mahugima","database_password":"yuwicini","database_charset":"UTF8","remote_access":"y","remote_ips":"","active":"y"}

FTP:
Code:

Risposta:        220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
Risposta:        220-You are user number 1 of 50 allowed.
Risposta:        220-Local time is now 09:56. Server port: 21.
Risposta:        220-This is a private system - No anonymous login
Risposta:        220-IPv6 connections are also welcome on this server.
Risposta:        220 You will be disconnected after 15 minutes of inactivity.
Comando:        USER xewewajo
Risposta:        331 User xewewajo OK. Password required
Comando:        PASS ********
Risposta:        421 Home directory not available - aborting

Email
Seems that the email has been not created. Roundcube tells me that there is not any account with the credencials posted.

Furthermore if I delete the customer and all the services by the IspConfig panel I get this error: Possible security violation when deleting the maildir

If you need to see my inteface for IspConfig take a look at: http://code.google.com/p/shineisp/so...onfig/Main.php

till 5th December 2011 10:16

Seems as if you have not set the maildir or that you set a invalid maildir path while you created. You might want to take a look at bthe example functions that we proviude in the 3.0.4.1 tar.gz and also compare the database records for mail users that you created with the api with one that you created in ispconfig to see the correct parameters.

vaio1 5th December 2011 10:45

Hi Till,

these are my email parameters sent to ISPConfig API:

Code:

{
  "server_id":"3",
  "email":"info@johndoe.com",
  "login":"admin@johndoe.com",
  "password":"dedubati",
  "uid":5000,
  "gid":5000,
  "maildir":"",
  "quota":1048576000,
  "cc":"",
  "homedir":"",
  "autoresponder":"n",
  "autoresponder_start_date":"",
  "autoresponder_end_date":"",
  "autoresponder_text":"",
  "move_junk":"n",
  "custom_mailfilter":"spam",
  "postfix":"y",
  "access":"n",
  "disableimap":"n",
  "disablepop3":"n",
  "disabledeliver":"n",
  "disablesmtp":"n"
}

and these are your parameters:

Code:

'server_id' => 1,
                        'email' => 'hmmnoe@test.int',
                        'login' => 'hmmnoe@test.int',
                        'password' => 'howtoforge',
                        'name' => 'hmmnoe',
                        'uid' => 5000,
                        'gid' => 5000,
                        'maildir' => '',
                        'quota' => 10000000000,
                        'cc' => '',
                        'homedir' => '',
                        'autoresponder' => 'n',
                        'autoresponder_start_date' => '',
                        'autoresponder_end_date' => '',
                        'autoresponder_text' => 'hallo',
                        'move_junk' => 'n',
                        'custom_mailfilter' => 'spam',
                        'postfix' => 'n',
                        'access' => 'n',
                        'disableimap' => 'n',
                        'disablepop3' => 'n',
                        'disabledeliver' => 'n',
                        'disablesmtp' => 'n'

I don't see any difference for the maildir param. :(

vaio1 5th December 2011 11:20

I have solved the eMail maildir problem.
In your example you have to write the default value

Code:

'gid' => 5000,
'maildir' => '',
'quota' => 10000000000,
'cc' => '',

You have to tell to your "fans" that the maildir needs a parameter like:

Code:

'gid' => 5000,
'maildir' => '/var/vmail/yourdomain.com/info',
'quota' => 10000000000,
'cc' => '',

Now I can login with roundcube!

Anyway when the email is deleted by IspConfig this error appears: Possible security violation when deleting the maildir

till 5th December 2011 11:26

Quote:

Anyway when the email is deleted by IspConfig this error appears: Possible security violation when deleting the maildir
The reason are your test records without maildir, as a empty maildir is a security violation for the system.

vaio1 5th December 2011 11:27

Yes now I have completely solved the email problem, thanks!

Now I am trying to solve the ftp problem.

vaio1 5th December 2011 12:27

Nothing to do :(

I have set the parameters as mentioned in your example but If I set the UID and the GID Filezilla doesn't connect to the profile. This is my snipped code: http://code.google.com/p/shineisp/so...g/Main.php#268

Code:

Risposta:        220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
Risposta:        220-You are user number 1 of 50 allowed.
Risposta:        220-Local time is now 12:18. Server port: 21.
Risposta:        220-This is a private system - No anonymous login
Risposta:        220-IPv6 connections are also welcome on this server.
Risposta:        220 You will be disconnected after 15 minutes of inactivity.
Comando:        USER jdoe_ftp1
Risposta:        331 User jdoe_ftp1 OK. Password required
Comando:        PASS ********
Risposta:        530 Login authentication failed

Updates:
- When I set the UID and GID with the value: 5000 I can login with filezilla but I see only empty dir and not the web dir.
- When I set the UID and GID with the correct web3798 and client133 I don't connect myself anymore.

Why!?

till 5th December 2011 12:44

Quote:

When I set the UID and GID with the value: 5000 I can login with filezilla but I see only empty dir and not the web dir.
Thats the UID for the email accounts in /var/vmail, not websites. Dont use this uid for anything related to websites.

Quote:

When I set the UID and GID with the correct web3798 and client133 I don't connect myself anymore.
Compare your ftp user and the website you created by the remote api with a website and FTP user that you created trough ispconfig interface to see the correct parameters for the records.

vaio1 5th December 2011 13:09

I have found a little bug in the vhost configuration:

Code:

/etc/apache2/sites-enabled/100-thedomain.com.vhost
In the IspConfig vhost file I can see the <VirtualHost *:80> but when the API create the vhost file I get <VirtualHost :80>.

Why?

Furthermore when I restart the webserver I get:
Code:

# /etc/init.d/apache2 restart
sh: getcwd() failed: No such file or directory
Restarting web server: apache2sh: getcwd() failed: No such file or directory
 ... waiting sh: getcwd() failed: No such file or directory


vaio1 5th December 2011 13:27

Quote:

Originally Posted by till (Post 268852)
Compare your ftp user and the website you created by the remote api with a website and FTP user that you created trough ispconfig interface to see the correct parameters for the records.

It's hard to debug your code or read your database without any documentation. I have followed what you are written in the samples and the FTP doesn't work.

What have I wrong in these parameters?

Code:

Paramenters: {
  "server_id":1,
  "parent_domain_id":3800,
  "username":"jdoe_ftp1",
  "password":"bexujuga",
  "quota_size":"3000",
  "active":"y",
  "uid":"web135",
  "gid":"client3800",

  "dir":"\/var\/www\/clients\/client135\/web3800",
  "quota_files":-1,
  "ul_ratio":-1,
  "dl_ratio":200,
  "ul_bandwidth":-1,
  "dl_bandwidth":100
}

Web Site Parameters
Code:

{
  "server_id":"1",
  "ip_address":"",
  "domain":"testdomain.com",
  "type":"vhost",
  "parent_domain_id":0,
  "vhost_type":"name",
  "hd_quota":"3000",
  "traffic_quota":"12000",
  "errordocs":1,
  "is_subdomainwww":1,
  "subdomain":"www",
  "php":"fast-cgi",
  "active":"y",
  "traffic_quota_lock":"n",
  "system_user":"web1",
  "allow_override":"All",
  "custom_php_ini":"",
  "apache_directives":""
}



All times are GMT +2. The time now is 03:52.

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