Commit 0e2978ef authored by Dominik's avatar Dominik
Browse files

Mailbox quota can now be included into website quota (FS#3297)

--------------------------------------------------------------
Feature can be activated over admin mailserver settings. when activated websites uid is used instead of standard vmail-uid. this only takes effect if web and mailserver are on the same server, otherwise it will be old behaviour. switching this setting when mailboxes exist doesn't matter. Mailboxfolder will be created with website uid for this. access of postfix and dovecot now works over mysql-table mail_user. virtual_uid_maps is changed from static to mysql-table. for dovecot<->postfix communication protocoll is changed vrom lda to lmtp. disablelmtp-column is added to mail_user-table. uid and gid can be overwritten by remoting.
ONE OPEN ISSUE: since remoting has completly changed and mail_user_add function is missing at the moment, this function now was inclulded again. it is important to add the both new lines to the future function and then remove this new one.
parent d73810d8
ALTER TABLE `mail_user` ADD `disablelmtp` ENUM( 'n', 'y' ) NOT NULL DEFAULT 'n' AFTER `disablelda` ;
\ No newline at end of file
......@@ -884,6 +884,7 @@ CREATE TABLE `mail_user` (
`disablesmtp` enum('n','y') NOT NULL default 'n',
`disablesieve` enum('n','y') NOT NULL default 'n',
`disablelda` enum('n','y') NOT NULL default 'n',
`disablelmtp` enum('n','y') NOT NULL default 'n',
`disabledoveadm` enum('n','y') NOT NULL default 'n',
`last_quota_notification` date NULL default NULL,
`backup_interval` VARCHAR( 255 ) NOT NULL,
......
listen = *,[::]
protocols = imap pop3
protocols = imap pop3 lmtp
auth_mechanisms = plain login
disable_plaintext_auth = no
log_timestamp = "%Y-%m-%d %H:%M:%S "
......@@ -31,6 +31,13 @@ service auth {
}
user = root
}
service lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
group = postfix
mode = 0600
user = postfix
}
}
service imap-login {
client_limit = 1000
process_limit = 500
......@@ -44,4 +51,8 @@ protocol pop3 {
}
protocol lda {
mail_plugins = sieve quota
}
protocol lmtp {
postmaster_address = webmaster@localhost
mail_plugins = quota sieve
}
\ No newline at end of file
listen = *,[::]
protocols = imap pop3
protocols = imap pop3 lmtp
auth_mechanisms = plain login
disable_plaintext_auth = no
log_timestamp = "%Y-%m-%d %H:%M:%S "
......@@ -31,6 +31,13 @@ service auth {
}
user = root
}
service lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
group = postfix
mode = 0600
user = postfix
}
}
service imap-login {
client_limit = 1000
process_limit = 500
......@@ -44,4 +51,8 @@ protocol pop3 {
}
protocol lda {
mail_plugins = sieve quota
}
protocol lmtp {
postmaster_address = webmaster@localhost
mail_plugins = quota sieve
}
\ No newline at end of file
......@@ -5,8 +5,8 @@ virtual_alias_maps = proxy:mysql:{config_dir}/mysql-virtual_forwardings.cf, prox
virtual_mailbox_domains = proxy:mysql:{config_dir}/mysql-virtual_domains.cf
virtual_mailbox_maps = proxy:mysql:{config_dir}/mysql-virtual_mailboxes.cf
virtual_mailbox_base = {vmail_mailbox_base}
virtual_uid_maps = static:{vmail_userid}
virtual_gid_maps = static:{vmail_groupid}
virtual_uid_maps = mysql:/etc/postfix/mysql-virtual_uids.cf
virtual_gid_maps = mysql:/etc/postfix/mysql-virtual_gids.cf
inet_protocols=all
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
......@@ -25,7 +25,7 @@ smtpd_client_restrictions = check_client_access mysql:{config_dir}/mysql-virtual
smtpd_client_message_rate_limit = 100
maildrop_destination_concurrency_limit = 1
maildrop_destination_recipient_limit = 1
virtual_transport = maildrop
virtual_transport = lmtp:unix:private/dovecot-lmtp
header_checks = regexp:{config_dir}/header_checks
mime_header_checks = regexp:{config_dir}/mime_header_checks
nested_header_checks = regexp:{config_dir}/nested_header_checks
......
listen = *,[::]
protocols = imap pop3
protocols = imap pop3 lmtp
auth_mechanisms = plain login
disable_plaintext_auth = no
log_timestamp = "%Y-%m-%d %H:%M:%S "
......@@ -31,6 +31,13 @@ service auth {
}
user = root
}
service lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
group = postfix
mode = 0600
user = postfix
}
}
service imap-login {
client_limit = 1000
process_limit = 500
......@@ -44,4 +51,8 @@ protocol pop3 {
}
protocol lda {
mail_plugins = sieve quota
}
protocol lmtp {
postmaster_address = webmaster@localhost
mail_plugins = quota sieve
}
\ No newline at end of file
......@@ -3,8 +3,8 @@ virtual_alias_maps = proxy:mysql:{config_dir}/mysql-virtual_forwardings.cf, prox
virtual_mailbox_domains = proxy:mysql:{config_dir}/mysql-virtual_domains.cf
virtual_mailbox_maps = proxy:mysql:{config_dir}/mysql-virtual_mailboxes.cf
virtual_mailbox_base = {vmail_mailbox_base}
virtual_uid_maps = static:{vmail_userid}
virtual_gid_maps = static:{vmail_groupid}
virtual_uid_maps = mysql:/etc/postfix/mysql-virtual_uids.cf
virtual_gid_maps = mysql:/etc/postfix/mysql-virtual_gids.cf
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_authenticated_header = yes
......@@ -22,7 +22,7 @@ smtpd_client_restrictions = check_client_access mysql:{config_dir}/mysql-virtual
smtpd_client_message_rate_limit = 100
maildrop_destination_concurrency_limit = 1
maildrop_destination_recipient_limit = 1
virtual_transport = maildrop
virtual_transport = lmtp:unix:private/dovecot-lmtp
header_checks = regexp:{config_dir}/header_checks
mime_header_checks = regexp:{config_dir}/mime_header_checks
nested_header_checks = regexp:{config_dir}/nested_header_checks
......
......@@ -3,8 +3,8 @@ virtual_alias_maps = proxy:mysql:{config_dir}/mysql-virtual_forwardings.cf, prox
virtual_mailbox_domains = proxy:mysql:{config_dir}/mysql-virtual_domains.cf
virtual_mailbox_maps = proxy:mysql:{config_dir}/mysql-virtual_mailboxes.cf
virtual_mailbox_base = {vmail_mailbox_base}
virtual_uid_maps = static:{vmail_userid}
virtual_gid_maps = static:{vmail_groupid}
virtual_uid_maps = mysql:/etc/postfix/mysql-virtual_uids.cf
virtual_gid_maps = mysql:/etc/postfix/mysql-virtual_gids.cf
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_authenticated_header = yes
......@@ -22,7 +22,7 @@ smtpd_client_restrictions = check_client_access mysql:{config_dir}/mysql-virtual
smtpd_client_message_rate_limit = 100
maildrop_destination_concurrency_limit = 1
maildrop_destination_recipient_limit = 1
virtual_transport = maildrop
virtual_transport = lmtp:unix:private/dovecot-lmtp
header_checks = regexp:{config_dir}/header_checks
mime_header_checks = regexp:{config_dir}/mime_header_checks
nested_header_checks = regexp:{config_dir}/nested_header_checks
......
user = {mysql_server_ispconfig_user}
password = {mysql_server_ispconfig_password}
dbname = {mysql_server_database}
table = mail_user
select_field = gid
where_field = email
additional_conditions = and postfix = 'y' and server_id = {server_id}
hosts = {mysql_server_ip}
\ No newline at end of file
user = {mysql_server_ispconfig_user}
password = {mysql_server_ispconfig_password}
dbname = {mysql_server_database}
table = mail_user
select_field = uid
where_field = email
additional_conditions = and postfix = 'y' and server_id = {server_id}
hosts = {mysql_server_ip}
listen = *,[::]
protocols = imap pop3
protocols = imap pop3 lmtp
auth_mechanisms = plain login
disable_plaintext_auth = no
log_timestamp = "%Y-%m-%d %H:%M:%S "
......@@ -31,6 +31,13 @@ service auth {
}
user = root
}
service lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
group = postfix
mode = 0600
user = postfix
}
}
service imap-login {
client_limit = 1000
process_limit = 500
......@@ -44,4 +51,8 @@ protocol pop3 {
}
protocol lda {
mail_plugins = sieve quota
}
protocol lmtp {
postmaster_address = webmaster@localhost
mail_plugins = quota sieve
}
\ No newline at end of file
......@@ -3,8 +3,8 @@ virtual_alias_maps = proxy:mysql:{config_dir}/mysql-virtual_forwardings.cf, prox
virtual_mailbox_domains = proxy:mysql:{config_dir}/mysql-virtual_domains.cf
virtual_mailbox_maps = proxy:mysql:{config_dir}/mysql-virtual_mailboxes.cf
virtual_mailbox_base = {vmail_mailbox_base}
virtual_uid_maps = static:{vmail_userid}
virtual_gid_maps = static:{vmail_groupid}
virtual_uid_maps = mysql:/etc/postfix/mysql-virtual_uids.cf
virtual_gid_maps = mysql:/etc/postfix/mysql-virtual_gids.cf
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_authenticated_header = yes
......@@ -22,7 +22,7 @@ smtpd_client_restrictions = check_client_access mysql:{config_dir}/mysql-virtual
smtpd_client_message_rate_limit = 100
maildrop_destination_concurrency_limit = 1
maildrop_destination_recipient_limit = 1
virtual_transport = maildrop
virtual_transport = lmtp:unix:private/dovecot-lmtp
header_checks = regexp:{config_dir}/header_checks
mime_header_checks = regexp:{config_dir}/mime_header_checks
nested_header_checks = regexp:{config_dir}/nested_header_checks
......
......@@ -38,6 +38,7 @@ mailuser_uid=5000
mailuser_gid=5000
mailuser_name=vmail
mailuser_group=vmail
mailbox_virtual_uidgid_maps=n
relayhost=
relayhost_user=
relayhost_password=
......
......@@ -184,7 +184,31 @@ class remoting {
return $app->db->affectedRows() == 1;
}
//* Add mail domain
public function mail_user_add($session_id, $client_id, $params){
global $app;
if (!$this->checkPerm($session_id, 'mail_user_add')){
$this->server->fault('permission_denied','You do not have the permissions to access this function.');
return false;
}
//* Check if mail domain exists
$email_parts = explode('@',$params['email']);
$tmp = $app->db->queryOneRecord("SELECT domain FROM mail_domain WHERE domain = '".$app->db->quote($email_parts[1])."'");
if($tmp['domain'] != $email_parts[1]) {
$this->server->fault('mail_domain_does_not_exist','Mail domain - '.$email_parts[1].' - does not exist.');
return false;
}
//* Set a few params to non empty values that will be overwritten by mail_plugin
if (!isset($params['uid'])) $params['uid'] = 999989999;
if (!isset($params['gid'])) $params['gid'] = 999989999;
$affected_rows = $this->insertQuery('../mail/form/mail_user.tform.php', $client_id, $params);
return $affected_rows;
}
//** protected functions -----------------------------------------------------------------------------------
......
......@@ -24,6 +24,7 @@ $wb['mailuser_uid_txt'] = 'Mailuser UID';
$wb['mailuser_gid_txt'] = 'Mailuser GID';
$wb['mailuser_name_txt'] = 'Mailuser Name';
$wb['mailuser_group_txt'] = 'Mailuser Group';
$wb['mailbox_virtual_uidgid_maps_txt'] = 'Use Websites Linux uid for mailbox (only if both on the same server)';
$wb['relayhost_txt'] = 'Relayhost';
$wb['relayhost_user_txt'] = 'Relayhost User';
$wb['relayhost_password_txt'] = 'Relayhost Password';
......
......@@ -22,6 +22,7 @@ $wb['mailuser_uid_txt'] = 'Mailuser UID';
$wb['mailuser_gid_txt'] = 'Mailuser GID';
$wb['mailuser_name_txt'] = 'Mailuser Name';
$wb['mailuser_group_txt'] = 'Mailuser Group';
$wb['mailbox_virtual_uidgid_maps_txt'] = 'Use Websites Linux uid for mailbox (only if both on the same server)';
$wb['relayhost_txt'] = 'Relayhost';
$wb['relayhost_user_txt'] = 'Relayhost User';
$wb['relayhost_password_txt'] = 'Relayhost Password';
......
......@@ -23,6 +23,7 @@ $wb['mailuser_uid_txt'] = 'UID usuário de email';
$wb['mailuser_gid_txt'] = 'GID usuário de email';
$wb['mailuser_name_txt'] = 'Nome usuário de email';
$wb['mailuser_group_txt'] = 'Grupo usuário de email';
$wb['mailbox_virtual_uidgid_maps_txt'] = 'Use Websites Linux uid for mailbox (only if both on the same server)';
$wb['relayhost_txt'] = 'Host Relay';
$wb['relayhost_user_txt'] = 'Usuário do Host Relay';
$wb['relayhost_password_txt'] = 'Senha do Host Relay';
......
......@@ -24,6 +24,7 @@ $wb['mailuser_uid_txt'] = 'Mail uživatel UID';
$wb['mailuser_gid_txt'] = 'Mail uživatel GID';
$wb['mailuser_name_txt'] = 'Mail uživatel jméno';
$wb['mailuser_group_txt'] = 'Mail uživatel skupina';
$wb['mailbox_virtual_uidgid_maps_txt'] = 'Use Websites Linux uid for mailbox (only if both on the same server)';
$wb['relayhost_txt'] = 'Relayhost';
$wb['relayhost_user_txt'] = 'Relayhost uživatel';
$wb['relayhost_password_txt'] = 'Relayhost heslo';
......
......@@ -25,6 +25,7 @@ $wb['mailuser_uid_txt'] = 'Mailbenutzer UID';
$wb['mailuser_gid_txt'] = 'Mailbenutzer GID';
$wb['mailuser_name_txt'] = 'Mailbenutzer Name';
$wb['mailuser_group_txt'] = 'Mailbenutzer Gruppe';
$wb['mailbox_virtual_uidgid_maps_txt'] = 'Website Linux Uid für Mailboxen (nur wenn beides auf gleichem Server)';
$wb['relayhost_txt'] = 'Relayhost';
$wb['relayhost_user_txt'] = 'Relayhost Benutzer';
$wb['relayhost_password_txt'] = 'Relayhost Passwort';
......
......@@ -24,6 +24,7 @@ $wb['mailuser_uid_txt'] = 'Mailuser UID';
$wb['mailuser_gid_txt'] = 'Mailuser GID';
$wb['mailuser_name_txt'] = 'Όνομα Mailuser';
$wb['mailuser_group_txt'] = 'Ομάδα Mailuser';
$wb['mailbox_virtual_uidgid_maps_txt'] = 'Use Websites Linux uid for mailbox (only if both on the same server)';
$wb['relayhost_txt'] = 'Relayhost';
$wb['relayhost_user_txt'] = 'Χρήστης Relayhost';
$wb['relayhost_password_txt'] = 'Συνθηματικό Relayhost';
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment