Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0001017 [SysCP] General feature always 2008-11-30 20:08 2010-06-13 22:49
Reporter monotek View Status public  
Assigned To
Priority normal Resolution open  
Status feedback   Product Version 1.4.1
Summary 0001017: Proftpd - Quota should be added
Description I just got this solved via mod_qoutatab_sql by myself. I would really appreciate if this could be implemented.

Its only necessary to add 2 tables to syscp db and edit /etc/proftpd/proftpd.conf and /etc/proftpd/modules.conf as follows:

1.) Create Tables in Syscp DB:

[code]
CREATE TABLE IF NOT EXISTS `ftp_quotalimits` (
  `name` varchar(30) default NULL,
  `quota_type` enum('user','group','class','all') NOT NULL default 'user',
  `per_session` enum('false','true') NOT NULL default 'false',
  `limit_type` enum('soft','hard') NOT NULL default 'hard',
  `bytes_in_avail` float NOT NULL,
  `bytes_out_avail` float NOT NULL,
  `bytes_xfer_avail` float NOT NULL,
  `files_in_avail` int(10) unsigned NOT NULL,
  `files_out_avail` int(10) unsigned NOT NULL,
  `files_xfer_avail` int(10) unsigned NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

INSERT INTO `ftp_quotalimits` (`name`, `quota_type`, `per_session`, `limit_type`, `bytes_in_avail`, `bytes_out_avail`, `bytes_xfer_avail`, `files_in_avail`, `files_out_avail`, `files_xfer_avail`) VALUES
('syscp', 'user', 'false', 'hard', 0, 0, 0, 0, 0, 0);

CREATE TABLE IF NOT EXISTS `ftp_quotatallies` (
  `name` varchar(30) NOT NULL,
  `quota_type` enum('user','group','class','all') NOT NULL,
  `bytes_in_used` float NOT NULL,
  `bytes_out_used` float NOT NULL,
  `bytes_xfer_used` float NOT NULL,
  `files_in_used` int(10) unsigned NOT NULL,
  `files_out_used` int(10) unsigned NOT NULL,
  `files_xfer_used` int(10) unsigned NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
[/code]

2.) Add to /etc/proftpd/modules.conf:

[code]
LoadModule mod_quotatab.c
LoadModule mod_quotatab_sql.c
[/code]

3.) Add to /etc/proftpd/proftpd.conf:

[code]
QuotaEngine on
QuotaShowQuotas on
QuotaDisplayUnits Mb
QuotaLock /var/lock/ftpd.quotatab.lock
QuotaLimitTable sql:/get-quota-limit
QuotaTallyTable sql:/get-quota-tally/update-quota-tally/insert-quota-tally
SQLNamedQuery get-quota-limit SELECT "ftp_users.username AS name, ftp_quotalimits.quota_type, ftp_quotalimits.per_session, ftp_quotalimits.limit_type, panel_customers.diskspace*1024 AS bytes_in_avail, ftp_quotalimits.bytes_out_avail, ftp_quotalimits.bytes_xfer_avail, ftp_quotalimits.files_in_avail, ftp_quotalimits.files_out_avail, ftp_quotalimits.files_xfer_avail FROM ftp_users, ftp_quotalimits, panel_customers WHERE ftp_users.username = '%{0}' AND panel_customers.loginname = SUBSTRING_INDEX('%{0}', 'ftp', 1) AND quota_type ='%{1}'"
SQLNamedQuery get-quota-tally SELECT "name, quota_type, bytes_in_used,bytes_out_used, bytes_xfer_used, files_in_used, files_out_used,files_xfer_used FROM ftp_quotatallies WHERE name = '%{0}' AND quota_type = '%{1}'"
SQLNamedQuery update-quota-tally UPDATE "bytes_in_used = bytes_in_used + %{0}, bytes_out_used = bytes_out_used + %{1}, bytes_xfer_used = bytes_xfer_used + %{2}, files_in_used = files_in_used + %{3}, files_out_used= files_out_used + %{4}, files_xfer_used = files_xfer_used + %{5} WHERE name= '%{6}' AND quota_type = '%{7}'" ftp_quotatallies
SQLNamedQuery insert-quota-tally INSERT "%{0}, %{1}, %{2}, %{3}, %{4},%{5}, %{6}, %{7}" ftp_quotatallies
[/code]



Thats it.
You have now a hard quota limit (diskspace from table panel_customers) for every Syscp FTP Account.


The field "bytes_in_used" of table "ftp_quotatallies" should be updated by cron every night to also count content not uploaded by ftp.



https://mantis.syscp.org/view.php?id=693 [^]
Additional Information
Tags No tags attached.
Attached Files ? file icon tables.inc.php.patch [^] (62 bytes) 2008-12-15 13:04
? file icon cron_traffic.php.patch [^] (265 bytes) 2008-12-15 13:04
? file icon customer_ftp.php.patch [^] (1,111 bytes) 2008-12-27 19:39
? file icon syscp.sql.patch [^] (1,310 bytes) 2008-12-29 22:18
? file icon update_1.4.inc.php.patch [^] (2,453 bytes) 2008-12-29 22:18
? file icon admin_customers.php_v2.patch [^] (740 bytes) 2009-01-29 16:27
? file icon syscp142_proftpd_quota.patch [^] (24,522 bytes) 2009-02-27 12:56
? file icon syscp142_ftpquota.patch [^] (30,828 bytes) 2009-03-03 17:29
? file icon syscp142_ftpquota_v2.patch [^] (34,676 bytes) 2009-03-04 16:48
? file icon syscp1421_ftpquota.patch [^] (38,481 bytes) 2009-04-02 12:42

Sponsor -  Users sponsoring this issue
Sponsors List Total Sponsorship = EUR 10

2010-02-09 18:02: NoPoday (EUR 10)

- Relationships
related to 0001016new Pureftpd - quota should be added 

-  Notes
(0000179)
arieser (reporter)
2008-12-17 01:48

# The field "bytes_in_used" of table "ftp_quotatallies"
# should be updated by cron every night to also count
# content not uploaded by ftp.

That's not necessary - since 1.3.1rc1 and later proftpd supports the following setting

QuotaOptions ScanOnLogin

If configured, this causes mod_quotatab to recursively scan the user's home directory when the user logs in, and to update the tally entry for that user, if any, with the number of bytes and files found. Note that these scans will cause a longer login time for the user, depending on the size of their home directory.

That is described here:
http://proftpd.org/docs/contrib/mod_quotatab.html#QuotaOptions [^]


IMHO ftp-quota is a really important feature for syscp!
(0000180)
monotek (reporter)
2008-12-17 10:13
edited on: 2008-12-18 16:47

Thanks for the hint but this would not count MySQL & Mail dir sizes of customers and sub ftp accounts like customer1ftp1 would not work, because this accounts gets the quota from customer1.

(0000328)
monotek (reporter)
2009-03-03 17:35
edited on: 2009-04-02 20:27

This is the final patch (syscp1421_ftpquota.patch) for proftpd and pureftpd quota in syscp 1.4.2.1 (Please delete the other files).

admin_settings.php:
- new config option "FTP Server"


cron_traffic.php:
- updating also the column "bytes_in_used" of table "ftp_quotatallies" when "diskspace_used" of table "panel_customers" is updated.
- if purftpd is selected in admin_settings.php the .ftpquota files for purftpd quota is created in ftp user dirs


tables.inc.php:
- added tables "ftp_quotatallies" & "ftp_quotalimits"


admin_customers.php:
- if a new customer is created there is now also a new user in ftp_qoutatallies created
- if admin deletes customer all entries of customer in table ftp_quotatallies are deleted too.


update_1.4.inc.php:
- added ftpserver to table panel_settings
- new tables ftp_quotalimits and ftp_quotatallies
- content for ftp_quotalimits
- quota for all users in ftp_users is set in ftp_quotatallies


syscp.sql:
- added ftpserver to table panel_settings
- new tables ftp_quotalimits and ftp_quotatallies
- content for ftp_quotalimits


english.lng.php & german.lng.php::
- Updated with warning, that you also have to change the quota sql query in ftp server config, when changing ftp prefix.
- added ftpserver lng strings for admin_settings.php


settings_ftpserver.tpl
- template for admin_settings.php


- configs for all distros

(0000460)
kscholz (reporter)
2010-02-08 12:30

The patch you supplied works great!
I would appreciate an implemantion in syscp.

Only pureftpd gives the user no warning as he reaches his quota.
Upload of files continues and when it's finished they're simply gone. ;-)
But this is an issue with pureftpd i think.
(0000463)
NoPoday (reporter)
2010-02-09 18:03

Hä ich hab da nicht geklickt wieso 10€?
(0000464)
monotek (reporter)
2010-02-16 13:20
edited on: 2010-02-16 13:21

This feature will likely be implemted in next froxlor relaese 0.9.2.

Froxlor is a Syscp fork.

Visit: www.froxlor.org

(0000470)
monotek (reporter)
2010-05-03 20:38

Its now implemented in Froxlor 0.9.6 :-)
(0000471)
kscholz (reporter)
2010-06-11 22:37

Is there any chance this patch gets updatet to syscp 1.4.2.2 or is it still working?
(0000472)
monotek (reporter)
2010-06-13 22:49

No, not by me.

But you could give froxlor a try ;-)

No SVN - commits yet

- Issue History
Date Modified Username Field Change
2008-11-30 20:08 monotek New Issue
2008-11-30 22:59 EleRas Target Version => 1.4.x
2008-12-02 14:34 d00p Relationship added child of 0001016
2008-12-02 14:36 d00p Status new => feedback
2008-12-02 14:36 d00p Projection none => minor fix
2008-12-02 14:36 d00p Category Adminpanel => i18n
2008-12-02 14:36 d00p ETA none => < 1 month
2008-12-02 14:36 d00p version 1.4 => 1.4.1
2008-12-02 14:37 d00p Relationship deleted child of 0001016
2008-12-02 14:37 d00p Relationship added related to 0001016
2008-12-15 13:04 monotek File Added: tables.inc.php.patch
2008-12-15 13:04 monotek File Added: cron_traffic.php.patch
2008-12-15 13:08 monotek Note Added: 0000175
2008-12-17 01:48 arieser Note Added: 0000179
2008-12-17 10:13 monotek Note Added: 0000180
2008-12-17 18:16 monotek Note Edited: 0000180
2008-12-18 16:47 monotek Note Edited: 0000180
2008-12-27 19:39 monotek File Added: customer_ftp.php.patch
2008-12-27 19:42 monotek Note Added: 0000197
2008-12-27 21:09 monotek File Added: admin_customers.php.patch
2008-12-27 21:10 monotek Note Added: 0000199
2008-12-29 22:18 monotek File Added: syscp.sql.patch
2008-12-29 22:18 monotek File Added: update_1.4.inc.php.patch
2008-12-29 22:21 monotek Note Added: 0000201
2009-01-02 15:25 monotek Note Edited: 0000201
2009-01-29 16:27 monotek File Added: admin_customers.php_v2.patch
2009-01-29 16:28 monotek Note Added: 0000243
2009-01-29 16:35 monotek Note Edited: 0000243
2009-02-23 15:22 JamieWolf File Deleted: admin_customers.php.patch
2009-02-27 12:56 monotek Note Deleted: 0000243
2009-02-27 12:56 monotek Note Deleted: 0000201
2009-02-27 12:56 monotek Note Deleted: 0000199
2009-02-27 12:56 monotek Note Deleted: 0000197
2009-02-27 12:56 monotek Note Deleted: 0000175
2009-02-27 12:56 monotek File Added: syscp142_proftpd_quota.patch
2009-02-27 12:58 monotek Note Added: 0000321
2009-03-03 17:29 monotek File Added: syscp142_ftpquota.patch
2009-03-03 17:35 monotek Note Deleted: 0000321
2009-03-03 17:35 monotek Note Added: 0000328
2009-03-04 11:37 Flo Category i18n => General
2009-03-04 16:48 monotek File Added: syscp142_ftpquota_v2.patch
2009-03-04 16:49 monotek Note Edited: 0000328
2009-04-02 12:42 monotek File Added: syscp1421_ftpquota.patch
2009-04-02 12:42 monotek Note Edited: 0000328
2009-04-02 20:27 monotek Note Edited: 0000328
2010-02-08 12:30 kscholz Note Added: 0000460
2010-02-09 18:02 NoPoday Sponsorship Added NoPoday: EUR 10
2010-02-09 18:02 NoPoday Sponsorship Total 0 => 10
2010-02-09 18:02 NoPoday Issue Monitored: NoPoday
2010-02-09 18:03 NoPoday Note Added: 0000463
2010-02-16 13:20 monotek Note Added: 0000464
2010-02-16 13:21 monotek Note Edited: 0000464
2010-05-03 20:38 monotek Note Added: 0000470
2010-06-11 22:37 kscholz Note Added: 0000471
2010-06-13 22:49 monotek Note Added: 0000472
Footer